Beefy Boxes and Bandwidth Generously Provided by pair Networks Ovid
"be consistent"
 
PerlMonks  

Re: PDF File Merging Data

by petecm99 (Pilgrim)
on Dec 22, 2010 at 16:32 UTC ( #878586=note: print w/ replies, xml ) Need Help??


in reply to PDF File Merging Data

Another option could be to have your template in an easily-readable format, such as a text file. Then the reading part becomes trivial, can replace your placeholders as they are encountered, and write to a pdf using pdf::create.

The reason I offer this solution as an alternative is due to the fact that I must be quite dense - I tried figuring out how pdf::reuse works, even looked at the PDF::Reuse::Tutorial, and have no clue how you could find the tags and replace them on the fly using that. I could just be a little low on IQ points, but I find pdf::create very easy to use...


Comment on Re: PDF File Merging Data
Re^2: PDF File Merging Data
by Anonymous Monk on Dec 22, 2010 at 17:25 UTC
    the flier is mostly images, it is a professionally designed flier for our members to share a free giveaway website we built for them to build their organization.

    So, if I had it done in HTML would that work? or does it have to be text? I have looked over the module you suggested, but I don't see an easy way to test it.

    thx,
    Richard
      Ahh, images. I don't see anything in pdf::create that allows for embedding images.

      In that case, you could try the module Rolf suggested (pdf::reuse), using the prText method to write to the existing template. But instead of replacing tags, set up the position of each dynamic data element in your Perl script (e.g. ~fullname~ has a position of {10,50}). Then, store/read the values for replacement separately. Doesn't have to be text - could get fancy and read them out of an Excel file, or database...
Re^2: PDF File Merging Data
by LanX (Abbot) on Dec 22, 2010 at 20:54 UTC
    >I tried figuring out how pdf::reuse works, even looked at the PDF::Reuse::Tutorial, and have no clue how you could find the tags and replace them on the fly using that.

    Can't say much about this, the docs seem to talk about form fields and mention JS, so it might not be what the OP wanted.

    Anyway the OP was talking about "replacing placeholders".

    With a PDF version where allowed fields are completely filled with blind text in a dedicated font, pdftohtml -xml could easily be used to parse and grep the absolute positions for these text boundaries.

    And plotting text by absolute positions is trivial with PDF::Reuse. (of course into a PDF without blind text)

    But as I already said, one has to care about line breaks and staying within bounding boxes, cause PDF is not HTML, it's a print format!

    see also: Parsing PDFs by text position?

    Cheers Rolf

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://878586]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2014-04-20 16:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls