tags:

views:

267

answers:

1

I have a PDF document with some external links.

I'd like to parse the document, replace the destination of the links then close (and serve) the PDF document, all using PHP

I know I can do this with PDFLib but I don't want to incur this cost.

I could re-write the document with FPDF or DomPDF, but some of these PDFs are quite complex so this would be a major time investment.

Surely there must be a way to do this directly to PDF docs, using native PHP?

TIA

A: 

I don't think there is a text/hyperlink changer class for PHP. The closest products, like pdftk, only does higher-level stuff like merging, splitting and applying watermarks.

Changing a pdf is much more difficult than generating it, so you need to use a pdf editor like Nitro PDF (untested), or why not Acrobat/Illustrator/InDesign.

If you must use PHP, regenerating the PDF:s with one of the free classes seems to be your best choice. I like FPDF very much, it gets my recommendation. If you decide to use it, check out FPDI as well, it can use existing PDF files as a template, maybe it will help you. Good luck!

ciscoheat