ghenry has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I am looking for examples to make this a perfect match. I know there are some docs on this using the latex(outputType) Template Filter, but I was wondering if anyone has used any other techniques with TT that they would kindly share?

Walking the road to enlightenment... I found a penguin and a camel on the way.....
Fancy a Just ask!!!

Replies are listed 'Best First'.
Re: PDF creation with Template Toolkit
by pboin (Deacon) on Oct 12, 2005 at 13:39 UTC


    I'm just about to start coding, but I'm excited enough about where I'm going that I figured I'd mention it.

    I've decided to use a template toolkit (Happens to be HTML::Template, but that doesn't really matter.) to generate my dynamic data. Then, to get the static side of my reports ready to merge with my dynamic data, I'm looking at PDF::Reuse. That seems really good for my particular purposes, 'cause I can off-load the form generation to any third party who's willing to help. I convert their output (from any app) to PDF, plop my template-generated data on top using XY co-ordinates, and it's off to the races...

    Don't know much about your details, but maybe this approach will be at least worth checking out.


      Have you seen PDF::Template?
      "PDF::Template is a PDF layout system that uses the same data structures as HTML::Template."

      It may be of some use to you.

      Hope this helps.


        I had, and PDF::Template looks really nice, especially for the reason you indicated: it plays nice with HTML::Template. The difference for me (and I should have been more clear) is that PDF::Reuse takes an already existing PDF in. I have a very complex form with shading, boxes, logos, addresses, etc. That I just need to fill-in-the-blanks. Since that's all static, I can just punch it out in a desktop publishing package instead of having to code the pieces.

        I do appreciate the suggestion though. I kinda forgot that PDF::Template was out there...

      PDF::Reuse was my second idea after looking at PDF::API2. I was really successful with PDF::Reuse, but thought I'd find out about others using TT. PDF::API2 is cool for having absolute control over everything, but I think it's a bit much for my application.

      I found PDF::Reuse to be a very good idea, because anyone can create the PDF Templates via any app, which means you don't have to. It also takes the strain out of doing the whole PDF generation via Perl, although caching would probably play a big part in saving on that overhead. And like you said, get the data you need via any method and slap it on the existing PDF with PDF::Reuse.

      Lastly, another cool thing about PDF::Reuse it is SOOO fast!!!

      Have you played with it much? It seems to fit everything I need, but just wanted to check out TT, like I said, before I go with PDF::Reuse.


      Walking the road to enlightenment... I found a penguin and a camel on the way.....
      Fancy a Just ask!!!
        Note also, the brand new PDF::APIx::Layout for PDF::API2.

        This implements markup in XML, perfect for processing with #preferred_templating_system#.

        It has only just been uploaded to cpan as a developer release, but is one to watch!