How can I insert text into an existing PDF using Ghostscript?
December 21, 2007 9:25 PM   Subscribe

How can I insert text into an existing PDF using Ghostscript?

I'm attempting to write a bash script that will take the output of the "tree" command, and insert it into an existing PDF template. The script works, bu I haven't been able to figure out how to take the output of it and stick it into this template. Does anyone know of a solution that does no use any additional software other than Ghostscript?
posted by jackofsaxons to Computers & Internet (3 answers total) 1 user marked this as a favorite
As a thought, postscript is usually easier to work with than PDF.

So start with a postscript template, insert your script output (which may need to be suitably massaged by inserting certain postscript commands as necessary), then send the resulting postscript to Ghostscript, which can turn it into a PDF.

You might be able to use something like groff? Working with groff is going to be much simpler yet than even messing with postscript. If your script could produce the text with needed groff formatting commands embedded, then you could send that output to groff to make PS, and the resulting PS output to Ghostscript to create a PDF.

Wiki for a bit more.
posted by flug at 10:21 PM on December 21, 2007

Even better, could you make the PDF template with latex?
posted by devilsbrigade at 10:54 PM on December 21, 2007

Perhaps pdftk will help. I googled for pdftk insert text into pdf and found this this, where they use pdftk to insert data into a pdf form.
posted by donut at 3:26 AM on December 22, 2007

« Older Recommended service for DVD/GameCube disk repair?   |   Please help my sister laugh for Christmas. Newer »
This thread is closed to new comments.