views:

4673

answers:

6

How would I be able to programmatically search and replace some text in a large number of PDF files? I would like to remove a URL that has been added to a set of files. I have been able to remove the link using javascript under Batch Processing in Adobe Pro, but the link text remains. I have seen recommendations to use text touchup, which works manually, but I don't want to modify 1300 files manually.

+3  A: 

Finding text in a PDF can be inherently hard because of the graphical nature of the document format -- the letters you are searching for may not be contiguous in the file. That said, CAM::PDF has some search-replace capabilities and heuristics. Give changepagestring.pl a try and see if it works on your PDFs.

Chris Dolan
Thanks a lot Chris, for the answer, and for the module on CPAN. That worked nicely for me. Hopefully Google picks up this page, I didn't see the CAM::PDF module in my searches.Roger
rpilkey
A: 

Hi, Try PDFTextReplaceTool http://pdfmagus.com

PDF Text Replace Tool allows to change or delete text in PDF files. Select thousand files and modify them by one click. Choose page or pages, and even corner to look for the text to replace. No Adobe Illustrator or Reader needed.

+1  A: 

I have also become desperate. After 10 PDF Editor installations which all cost money, and no success:

pdftk + editor suffice:

Replace Text in PDF Files

  • Use pdftk to uncompress PDF page streams

    pdftk original.pdf output original.clear.pdf uncompress

  • Replace the text (sometimes this works, sometimes it doesn't).

  • Repair the modified (and now broken) PDF

    pdftk original.clear.pdf output original.clear.fixed.pdf

(from Joel Dare)

ricardo
A: 

Ricardo,

It will not work because Text State in PDf files is not a plain text. Here is a short example of the part of uncompressed Stream :

[(www)6.7(.)-11.2(e)-0.2(lc)-5.4(om)-9.7(e)6.2(t)-4.8(er.c)-5.4(om )]TJ 0 -1.1456 TD 0 Tc ( )Tj 7.5077 0 0 7.5077 66 15.8401

How will you change a word "elcometer" in this mess?

And even more, Encodings, "unicode translate tables" ....

PDFTextReplaceTool ChangePDF.com

A: 

Now we have free online service to change text in pdf files. Visit: http://pdfmagus.com

+1  A: 

You can use the 'redaction' feature in Adobe Acrobat Pro to find & replace all references in a single document in one step...not sure if it can be automated to multiple steps.

http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=3723

davr