find and replace in PDF using sed and pdftk

1

I am doing a mass find and replace using sed and pdftk to find and replace a word in PDF files. When I run the following command,

sed -e "s/word1/word2/g" test.pdf

I get the following error,

sed: RE error: illegal byte sequence

I tried running sed with,

LANG=C sed -e "s/word1/word2/g" test.pdf

and it runs but doesn't find and replace the string.

I should mention that I tried uncompressing the PDF using pdftk, running sed, and then recompressing with no results. I am also running this through MAC OS X bash, but I'm thinking the solution should be relatively the same as Linux command line.

Can anyone offer any suggestions for this?

LJS

Posted 2013-09-29T05:38:42.663

Reputation: 11

Have you seen this Web page? http://stackoverflow.com/questions/220445/how-to-program-a-text-search-and-replace-in-pdf-files

– MariusMatutiae – 2013-09-29T06:19:29.813

As a side note/question: is this part of a mail-merge project of sorts? – MikeM – 2013-09-29T06:45:46.167

This might also be of interest: http://unix.stackexchange.com/questions/17220/how-to-view-and-edit-the-code-of-a-pdf-file

– MikeM – 2013-09-29T06:55:36.357

No answers