Hello all; I'm after some pointers:

I have a requirement to produce mail merges with data in a "hierarchical" format - e.g. printing letters to multiple customers that have ordered multiple photographs, and perhaps have ordered multiple albums that contain multiple photographs ... the result maybe something like this:

Dear Bob A, Here are details on the photos you've ordered: Picture 1 (8"x6") Picture 2 (8"x6") Picture 3 (10"x8") Prints in a 10"x8" Red Album ------------------------------- Picture 4, Picture 5, Picture 6 [repeat etc.] Yours, Bob B
My first thought was to put the data into XML, and use Template Toolkit to render the result. The problem is that the result will be paper-based, so HTML isn't an ideal output format. I see that I could go through TT, via LaTex to PDF or Postscript, but I ideally wanted to be able to hand over the letter for less techy people to amend, and LaTex didn't seem ideal for that. (The users are used to software like MS Word and Adobe Acrobat ...)

So I then wondered if I could get a PDF template knocked up, perhaps embedding Template-Toolkit code on the page, and then I could use with PDF::API2 to extract the text, parse with TT, replace the text and render a new PDF. However, extracting the text that exists in a PDF seems to be difficult - I can't find any example code anywhere.

So this is where I've got. Does anyone have any pointers to finish off any of my lines of enquiry, or alternatively any completely different solutions that may meet my needs? (I have no desperate desire to write this myself if someone's already done it for me! :))

Many thanks for any advice, Neil.


In reply to Pointers on an XML mail merge solution? by SmugX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.