• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 995
  • Last Modified:

inserting inline .eps file with enscript

I'm trying to get a company logo printed inline with text via enscript and having no luck, hoping someone can help. See code below:
cat $1 |enscript -e^@epfs[c]{cheape.eps} -q -l -f Courier8 --margins=0:0:0:0 -r -p -|ps2pdf13 -|cat - > /tmp/gertest.pdf

Open in new window

  • 3
  • 2
2 Solutions
I tried to get this to work ... alas there was no joy in Mudville. It seems that enscript really wants a control char that can not be entered on the command line. I did find that I could create a text file, mylogo.txt with the escape sequence
and then run

cat mylogo.txt some_text.txt | enscript -e -B -p - |ps2pdf13 - bar.pdf

That worked....

Note that the ^@  in the text file is type in vi with Ctrl-v Ctrl-0 Ctrl-0 Ctrl-0
Those are zeros not the letter 0.

chr00tAuthor Commented:
Thanks ewest02, would you mind attaching your mylog.txt file so I can see it. I did the ^@ in vi like you said: Ctrl-v Ctrl-0 Ctrl-0 Ctrl-0, then typed: epsf[c]{test2.eps} after that, but when I look @ my mylogo.txt, I dont see anything before the: epsf[c]{test2.eps} & I did do: Ctrl-v Ctrl-0 Ctrl-0 Ctrl-0 (using #0).  I'm attaching my mylogo.txt so you can see what I mean
chr00tAuthor Commented:
Any help would be greatly appreciated. If you print your *nix reports
with a logo in another manner, I'd love to hear your solutions as well.
chr00tAuthor Commented:
I found a solution thanks to my local linux user group: FLUX (flux.org). Member Kwan Lowe sent me the following:

I have done a similar thing to generate some automated PDFs. I used m4
and tex to do it...

--Example Report--

% Title Page
\title{TPS Report}


This is the TPS report to be submitted in triplicate to the three bosses.

 \includegraphics[width=120mm,bb=0 0 808 660]{Diagram1.png}

The quick brown fox jumped over the lazy dogs.


--End TPS Report--

You can create an m4 template from the above, then just use it as a
wrapper to your report.  You may need to escape certain sequences in
the report text. If so, pipe it through sed to escape symbols like @,
for example.

Once complete you can run it through pdflatex to generate a PDF file.
Ahh. I was going to suggest writing this directly in PostScript, but that will work as well. Per your request I am attaching the text file containing the embedded EPS directive.

The trick with enscript is getting an escape character into the text stream. Here is the view of the attached file via od:

> od -c foo.txt
0000000  \0   e   p   s   f   [   c   ]   {   f   o   o   b   a   r   .
0000020   e   p   s   }  \n

Note the \0 that precedes the directive.

Pretty simple then to just cat this file along with the target text file to a pipe with the enscript command line.
      cat foo.txt xxx.txt|enscript -e -vB -p - |ps2pdf13 - bar.pdf
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now