tags:

views:

86

answers:

3

How to do it with help of PHP?

+2  A: 

You may want to have a look at the PHP PDF functions reference (which require the pdflib library to be installed, as Mchl correctly pointed out)

nico
Note that these require external pdflib library to be installed.
Mchl
@Mchl: good point, I'll add it to the answer
nico
+1  A: 

First read PDF into a string, replace text within the string then write it to a PDF file. Read below posts:

Read pdf files with php

PDF Editing in PHP?

chanchal1987
A: 

PHP PDF functions won't help you much. The truth is that this task cannot be easily accomplished.

I've tried several ways to accomplish this task, and given up.

I would recommend that you use this: http://framework.zend.com/manual/en/zend.service.livedocx.html

It requires that you have the pdf in a docx, or similar format. Basically you use that format to do the search and replace and then you serialise the document to a pdf.

You don't need to use the entire ZEND framework to get this going either. You can just extract what you need from the zend libraries. Start by taking out the livedocx lib, and run it. It'll error and explain to you the dependencies that are also required. Pull them out and then you'll be ready to roll.

Let me know how you go with this, as I have yet to try this approach.

Jason