Hi,

Can you use fpdi to read pdfs as templates and base the creation of new pdfs ?

Fpdi says you can but I'm not sure how - the demos show how to join pdfs together or ouptut the pdf template in a new pdf but not actually parse parts of the pdf file and use the settings as a template.

Ideally what I want to do is read a pdf template file, and use the formatting used in the template to format my own dynamically created pdf.

For example; I might have a header, contents, table settings, and footer setup and use the formatting (font styles, background etc... ) from the template pdf to create a new pdf.

Any ideas how I can do that ??

    2 months later

    I am currently going through fpdi_pdf_parser.php and the associated files to find out how to replace a variable in the text content of my PDF template. I tried inserting the following code in the function rebuildContentStream() in the ASCII section to replace my variable:

    $stream = preg_replace("\$var","variable",$stream);

    This does not work. This seems like a similar problem to yours, did you ever come up with any options for your purposes? I thought I would be able to modify the generated PDF when it is being assembled, but perhaps I am wrong about where this takes place.

    All potential solutions would be helpful, as I am well into the trial and error process on this one. Thanks.

      Unfortunately not,

      Fpdfi seems more to create an image from the contents of a pdf rather than getting the actual contents of the pdf for manipulation.

      In my case I wanted to create a basic template and dynamically populate the template - which hasnt been possible with this library. I ended up using Apaches Cocoon and sending XML with my XSLT as my template / stylisation for the pdf.

        Write a Reply...