I have on each page of my PDF document a line with this string:
%REPLACE%
Which I'd like to find and replace with another string.
Does anyone know how to do this with some command line application such as PDFTK?
This folk gave me an important clue however I'd like something more direct.
Thanks.
Dingo
You can try to modify content of your PDF as follows
Uncompress the text streams of PDF
pdftk file.pdf output uncompressed.pdf uncompress
Use sed to replace your text with another
sed -e "s/ORIGINALSTRING/NEWSTRING/g" <uncompressed.pdf >modified.pdf
If this attempt was successful, re-compress the PDF with pdftk
pdftk modified.pdf output recompressed.pdf compress
Note: This way is not successful every time, mainly due to font subsetting
来源:https://stackoverflow.com/questions/9871585/how-to-find-and-replace-text-in-a-existing-pdf-file-with-pdftk-or-other-command