Re: [PHP] Simple PDF manipulation



Yeah, this is exactly what we do at my work. We have a license for PDFLib and essentually we load blank forms and then say take this text and position it at this location. Kind of like putting words on a clear piece of acetate and overlaying it on top of a piece of paper.

If I recall, we had issues trying to do this with fpdf and some other PHP PDF libraries, but PDFlib allowed us to do it and it's what we've used ever since.

Actually, tedd.. did you use PDFlib or another library or maybe something in PHP5 (that we don't use yet)? We may be moving off of PDFlib at some point and I may be looking for alternatives. This is the main function we need. Ignorant question, but I havn't even thought of researching it yet and figured I'd ask while the topic was at hand.

-TG

= = = Original message = = =

Interesting, that's a good idea. I was not aware that it was possible
to load an existing PDF into memory and then add stuff to it.


On Dec 27, 2006, at 7:28 AM, tedd wrote:

At 6:32 AM -0800 12/27/06, Brian Dunning wrote:
Let's say I have a complicated PDF document, like a Christmas
card, that was made in Illustrator -- too complicated to easily
create from scratch using PDFlib. Is there a way to use PHP make
simple text changes - like changing "Dear XXX" to "Dear John"?
I've opened the files with a text editor and cannot locate the
simple text, it appears to be encoded somehow. The PDF has no
security or encryption in it. Thanks....

Brian:

I'm not saying that there is/isn't a way to do this, but I tried
and failed.

In my investigation, I found that the insides of a PDF file are not
conducive to a simple search and replace mechanism. The text is
encoded in some fashion that is not easy to decode and reassemble.

The solution I came up with was to combine the existing PDF file
with my coding and write over (on top of) the old to produce the
new PDF that I wanted. In your case, take your Christmas Card with
a big space where "xxx" appears and then write over that space with
"John" in your new code.

I wish someone would show me a simpler way to do this.

hth's

tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

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



___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
.



Relevant Pages

  • Re: Adding text layer to PDF
    ... Actually I'm already using PDFLib and since it was ... very expensive I thought that this functionality was included. ... I have a multipage PDF file and for each page I also have a corresponding ...
    (comp.text.pdf)
  • Re: php and pdf
    ... not provide PDFlib as part of their PHP installation. ... install PHP). ... Zend framework has PDF generation. ...
    (alt.html)
  • Re: [PHP] Re: header() function for displaying an opened PDF document.
    ... storing the file to the server because of two features. ... php script to use the email to pick up the file and send it to my boss. ... I'm thinking of using hte HTML conversion to PDF feature. ...
    (php.general)
  • RE: [PHP] Simple PDF manipulation
    ... www.carbonfree.org.uk - become Carbon Free ... We have a license for PDFLib ... we had issues trying to do this with fpdf and some other PHP ... PDF libraries, but PDFlib allowed us to do it and it's what we've used ever ...
    (php.general)
  • PDFlib and Russian characters
    ... A PDF file must get generated by my PHP 5.2.1 script (using PDFlib ...
    (php.general)