inserting inline .eps file with enscript

Posted on 2009-04-17
Last Modified: 2013-12-26
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

Question by:chr00t
    LVL 4

    Assisted Solution

    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.


    Author Comment

    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

    Author Comment

    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.

    Accepted Solution

    I found a solution thanks to my local linux user group: FLUX ( 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.
    LVL 4

    Expert Comment

    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

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
    When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
    The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
    The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now