I have a PDF file generated in Adobe Acrobat 5.0 in which there are several fields I would like to make customizeable. My thought was to create fields in the PDF file named %%STUDENT_NAME%% and then basically do a search/replace on the PDF file with PHP resulting in a PDF with the student's name in place of the variable.

However, my initial attempts at this have been thwarted because I can't figure out how Adobe is encoding the strings within their files. I have a snippet of code that uses a regular expression that I am guessing works with PDF files generated from older version of Acrobat -- the replace function uses ereg_replace() which isn't binary safe and the PDF files generated by Adobe 5.0 definitely appear to be binary (FWIW the regular expression it uses appears to be wrong as it won't work even with preg_replace()).

So, either I need to dig into some documentation and figure out Adobe's file format, figure out a way to get Adobe to generate ASCII PDF files, or generate my own PDF files using PDFlib or something similar.

I've asked a few different places and was told to use a full blown templating engine... this seems like such a trival thing though.. just replace some text in a PDF file!

Anyways, just looking for some suggestions. Right now I am thinking that generating the PDF file myself will be easier than figuring out how to match and replace text in Adobe's PDF 5+ files.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to