How to print on an existing PDF a logo/mark/date/…
I used a simple script, based on jpdftweaks, which did the job automatically in the PDF file saved in the working directory.
Although jpdftweaks has a gui interface, here I had used a command line version to create an automatic conversion procedure (based on bash script). Don’t worry, it is not complicate!
Info about available commands are in WatermarkOptions.java file in the jpdftweaks source-code (here a local copy)
Put the script into directory that contains PDF files. It looks for file extension “pdf” only in the current level and then begin to convert, one file at time.
Watermarked file will be saved in a new directory called pub_ready, no changes will be made to the original file!
Opening the script, there are some options that you can change
MARK it is obviously the text that will be printed on PDF
HOR pixel coordinate of watermark, from bottom left
Note. If you use a landscape sheet, the reference will be inverted (HOR -> vertical, VER -> horizotal)
FONT font height used
Pay attention to font dimension and PDF border! if some text is over the boundary, jpdftweaks returns an error.
jpdftweaks.jar in the script directory
(that needs Java runtime environment 5 or newer)
To run the script, you have to set execution permit on it
Just give a
chmod +x add_watermarks.sh
Now you be able to run with ./add_watermarks.sh