in reply to Pointers on an XML mail merge solution?

From the docs:

use PDF::API2; $pdf = PDF::API2->open('existing.pdf'); $string = $pdf->stringify;

Update: Original code was bad (it truncated the file). Removed rather than <strike>'d because no one had followed up yet. For posterity, I had stupidly used the new method instead of open.


If anyone needs me I'll be in the Angry Dome.

Replies are listed 'Best First'.
Re: Re: Pointers on an XML mail merge solution?
by SmugX (Beadle) on May 12, 2004 at 15:38 UTC
    Thanks for this - but doesn't $pdf->stringify just return the raw PDF data, so I've still got to parse it? Apologies if I'm being dim and missing the point here.

    In other words, doesn't this code have the same effect? :

    my $string; open(PDF,"<existing.pdf"); binmode PDF; while (<PDF>) { $string .= $_; } close(PDF);

      You are quite correct. I'm going to go get coffee, as I am obviously still asleep. My googling finds this as an actually intelligent discussion. Sadly, no one appears to have picked this task up since '99.

      OTOH, PDF::Reuse seems to address exactly the issue of bulding up PDFs from a template, so you might look there. OTOOH, what's wrong with using plain text the whole way through?


      If anyone needs me I'll be in the Angry Dome.
        No worries!

        I had forgotten PDF::Reuse - I looked at it a while back, but without much success. I may revisit it.

        As for plain text, you know what these sales people are like ... logos here, fonts there ... ;-)

        Thanks!
        Neil