I need to "find and replace" text in a PDF file on OS X Yosemite.

It would be better if there was a "replace all" feature. How can I do this on OS X?


As Tom Gewecke mentioned in a comment, Adobe Acrobat can do this.

I was also able to do this with PDFpen, as also suggested by Tom Gewecke.

Both apps seem great. Since both of them are quite pricey, though, I would also like to share a way to do this with the free and open source software LibreOffice.

  1. Open the PDF with LibreOffice.
  2. Click Edit in the panel, then Find & Replace.... Use the feature as desired.
  3. Click File in the panel, then select Export as PDF.... Save the PDF.

I suspect LibreOffice probably decodes and re-encodes the document. But in my case the new document looked precisely identical to the original (except for the edits, of course.)

| improve this answer | |
  • 1
    I think LibreOffice may only be able to do this with certain kinds of pdfs with the right internal structure for text searching. I tried a couple of mine and it didn't work. – Tom Gewecke Jul 17 '16 at 14:44
  • @TomGewecke What type of error did you encounter? – Revetahw says Reinstate Monica Jul 17 '16 at 15:02
  • For reference, only Acrobat XI and later can do this. forums.adobe.com/thread/1518193 – Calion Sep 8 '18 at 14:44

Usually, you can actually get away with just replacing the string in the file contents. Make a copy of the PDF, open it in a pure text editor (textmate, atom, vim etc.) and search&replace.

| improve this answer | |
  • I just tried opening a PDF ebook with Atom, and I got this. No recognizable piece of the text can be seen. So how can I F&R? – Revetahw says Reinstate Monica Aug 3 '16 at 8:14
  • Yeah, you're right – though there is some metadata like the creator's name and document title. The pdf generators may use different methods to represent strings or it's an encoding problem. It used to help me quite often when I had to change a pdf while on the road and without internet – back then there was no free software for pdf authoring. – Matthias Winkelmann Aug 3 '16 at 12:34
  • Old, but it showed up on the front page, so adding this here. It's not a "pure" text editor (what would that even be?) that you want, it's a binary-safe text editor. TextMate and Atom (for example) are NOT binary safe. What that means is that if you open a binary file with one, and save it, making no changes... what comes out is NOT what went in. Vim, in some configurations, is binary-safe. – Marc Wilson Nov 11 '18 at 20:56

If you are willing to use latex, you could convert your pdf to ps, include it in a new document while using the psfrag package to do the replacement. A quick example would be


which replaces all occurrences of "bla" with "blub". The conversion to and from ps can be done by pdf2ps or ps2pdf.

| improve this answer | |

If the PDF is native and writable, you can open with preview,copy and paste all the contents into Word, then use the "find and replace all" feature in Word;

If the PDF is scanned, image-based, you can use online OCR tools, they can help to convert scanned PDFs into editable formats, such as Word, or others, then you will be able to find and replace texts in PDF.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .