[gs-devel] overlay text ontop of an image.
Jeff Sadowski
jeff.sadowski at gmail.com
Mon Jan 16 19:07:15 UTC 2012
At my work they have something know as a "print redirect" that grabs
the content that originally went to a line printer and puts the
content of such to a kyocera printer in the kyocera language
overlaying it with a form image. Recently I was asked to redo the
print redirect. I'd like the output of it to pop up a pdf file.
Messing around with java I was able to use the ghostscript program
along with pdftk to get the desired pdf file. I was wondering If there
might be an easier way or a way to do the overlay in ghostscript and
not need pdftk?
I learned that I could get the text into a pdf by created a simple
postscript file test.ps
that looks like the following
%!PS-Adobe-3.0 EPSF-3.0
%%Creator: Jeff Sadowski
%%Title: Test
%%CreationDate: 2012 01 14
%%DocumentData: Clean7Bit
%%Origin: 0 0
%%BoundingBox: 0 0 612 792
%%LanguageLevel: 2
%%Pages: 1
%%Page: 1 1
/Courier findfont
12 scalefont
setfont
newpath
10 780 moveto(Hello World) show
%%EOF
(Creating a postscript file with the input coming from a telnet input
from java was a breeze.)
then I use ghost script to make it into a pdf
ps2pdf test.ps test.pdf
then I used pdftk to overlay with a backgroud pdf images of the document
pdftk test.pdf stamp document.pdf output page1.pdf
pdftk test.pdf stamp document2.pdf output page2.pdf
(could I have done that step with ghostscript?)
then I used ghostscript again to combine the pages
gs -q -dNOPAUSE -dSAFER -dBATCH -sOutputFile=result1.pdf
-sDEVICE=pdfwrite page1.pdf page2.pdf document3.pdf
this creates a pdf that has 2 pages with Hello World overlayed on the
document1.pdf and document2.pdf images and has the document3.pdf image
as the last page.
This works great but I was wondering if there was a way to do the
overlay with ghostscript?
More information about the gs-devel
mailing list