OS/2, eCS & ArcaOS - Technical > Utilities

Insert text on pdf's

(1/2) > >>

Per E. Johannessen:
I need to insert text, actually the filename of the pdf, to lots of pdf's.
Does anyone know about a "OS/2-utilty" that can do this, preferably in batch mode?
(Attached a sample, 12345.pdf)

Thomas Fauster:
One way would be to convert the files to postscript using pdftops from the xpdf utilities.
Then Insert before the showpage command at the end of the postscript file the text e.g.
/Helvetica findfont 12 scalefont setfont 1 0 0 setrgbcolor
490 755 moveto (TEXT) show
Finally convert the postscript file back to PDF using ghostscript..
You could write a rexx script to automate the process.

Edit: Ghostscript provides command files pdf2ps and ps2pdf for file cenversion


Per E. Johannessen:
Thanks, I already have ghostscript, did some more searching and found;

https://askubuntu.com/questions/872482/adding-a-logo-in-a-pdf-by-ghostscript

My infile test.pdf contains only one line with the word "test.pdf"
(No need to, but I changed "Sample" to "AddedText" and saved it as sample.ps)

Running

gsos2 -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=out.pdf sample.ps -f test.pdf

and it produced the attached out.pdf

So, it looks like this can be done without conversion.

Just noticed that it also added the number "1" in the lower right corner. Guess this can be controlled
by the ps-file, font, size, where to place text etc.

xynixme:
If possible, it may help to use "readable" and broadly supported PDF 1.1 instead of PDF 1.4. 12345.PDF is PDF 1.4, and so is OUT.PDF. With PDF 1.1 it may be quite easy to replace, for example, the "1" by a space.

Per E. Johannessen:
At this stage I didn't think about pdf versions at all, but in any case the pdf's I produce are only meant for our auditor and "IRS", plus internal use.
I assume that they use "latest everything" under Windows and so far they have not complained about pdf 1.4. (Latest pdf version is now at 1.7 I think.)

The number "1" which was added to lower right corner was my mistake. Created the pdf in OO and I think it automatically added page numbering.
Have done several tests with "new" pdfs and no numbers are added.

Navigation

[0] Message Index

[#] Next page

Go to full version