Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

PDF::API2 Examples

by demerphq (Chancellor)
on Feb 01, 2004 at 13:54 UTC ( #325697=perlmeditation: print w/ replies, xml ) Need Help??

If you have to create PDF's then youll probably eventually end up looking at PDF::API2 which by all apearances and tests ive done is a worthy piece of code. However, the documentation is utterly excreble. Finding your way around the module and its children is painful indeed.

However after hours of searching I finally found these example bundles which go a long way to redressing the pitiful documentation included with the code. I post it here to save others the trouble of searching for it. And if someone should happen to decide its worth their time to do a comprehensive PDF::API2 tutorial, well lets just say that you'll be my hero of the week. :-)

BTW, if anyone has documented PDF::API2 code thats postable here, it would be welcome as well.


---
demerphq

    First they ignore you, then they laugh at you, then they fight you, then you win.
    -- Gandhi


Comment on PDF::API2 Examples
Download Code
Re: PDF::API2 Examples
by rob_au (Abbot) on Feb 01, 2004 at 22:35 UTC
    If you have to create PDF's then youll probably eventually end up looking at PDF::API2 which by all apearances and tests ive done is a worthy piece of code. However, the documentation is utterly excreble. Finding your way around the module and its children is painful indeed

    This too is something which I found when I was last working with PDF::API2 - The result of my last tinker with this module can be found here. Whilst not a complex example, it may help you in what you are doing.

     

    perl -le "print unpack'N', pack'B32', '00000000000000000000001010111100'"

Re: PDF::API2 Examples
by BigLug (Chaplain) on Feb 02, 2004 at 10:13 UTC
    I'll volunteer. I use PDF::API2 all the time at work and am currently writing an add-on module for the next release which is putting me right in the thick of things. The docs are woeful which is a pity because the module is so powerful. I guess it's just that fredo is a coder not a writer :)

    Update: I currently have the developer release installed and so can't execute the examples. Once I'm back on the production box tomorrow I'll start writing.

    Update 2004-08-05: I still haven't done this sorry. I'll put together a quick tutorial based on some simple operations soon. Promise.

    Update 2004-08-17: I've started on it .. details here

      I have serious reservations about the changes between the latest stable and the dev release. Hes completely changed the object model. Classes which used to exist dont anymore. And it wont run under 5.6. I suspect that the module will fork with a large number of users using the old stuff. Sad really.

      But definately a proper tutorial/documentation on the project would be really good.


      ---
      demerphq

        First they ignore you, then they laugh at you, then they fight you, then you win.
        -- Gandhi


        I wrote about careless version dependencies in my http://use.perl.org journal some time back (here), a post which was specifically motivated by issues with PDF::API2.

        This post came about whilst performing some work with PDF::API2 for a previous employer. It was found that in it's standard installation, the module required at least Perl 5.6 to run - This presented an issue given that the production platform for this employer was 5.005.03. Upon closer examination however, it was found that the only Perl features being employed that necessitated Perl 5.6 was the use of our - Fifteen minutes later a patch was written which allowed PDF::API2 to be deployed without issue under 5.005.03.

         

        perl -le "print unpack'N', pack'B32', '00000000000000000000001010111110'"

Re: PDF::API2 Examples
by nite_man (Deacon) on Feb 02, 2004 at 10:31 UTC

    If you have to create PDF's then youll probably eventually end up looking at PDF::API2

    There are many ways to produce PDF file:

    • HTMLDOC - tool for convert HTML pages to the PDF or PS. It's very useful if you need produce print view of some documents using template which should be filled by real data (invoice or receipt, for example)
    • FOP - Formatting Objects Processor: print formatter driven by XSL formatting objects (XSL-FO) and output independent formatter, supported include PDF, PCL, PS, SVG, XML, Print, AWT, MIF and TXT.

    In my opinion, FOP is good base to develop solution for converting documents. I planning to use FOP for build document module of billing system to produce billing documents, reports etc. Currently, I use HTMLDOC as temporary solution.

    -- Michael Stepanov

Re: PDF::API2 Examples
by dragonchild (Archbishop) on Feb 03, 2004 at 21:04 UTC
    Another PDF creation method is PDF::Template, which requires the use of PDFLib (which is both paid and free, depending on the version you grab). Unlike PDF::API2, PDF::Template behaves just like HTML::Template in free-standing, CGI, and ModPerl modes.

    That said, I've been thinking about have PDF::Template use PDF::API2 as a rendering engine instead of being tied to PDFLib. These examples will go a long way in helping me figure it out. Thanks!

    ------
    We are the carpenters and bricklayers of the Information Age.

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

      The primary reason I didnt use PDF::Template was because it didnt use PDF::API2 and as such I had problems getting it working. The other thing is that I found the documentation a little bit overwhelming, and since it required obtaining external binaries I decided not to bother investigating deeper. But if it had worked with API2 and as such not required the external libs then I would have probably used it.

      Im assuming from your language that PDF::Template is your baby. If so then a tutorial here showing how to generate a simple document book with an outline would be very much appreciated by me and no doubt others as well.


      ---
      demerphq

        First they ignore you, then they laugh at you, then they fight you, then you win.
        -- Gandhi


        Anybody use PDF::Reuse and have any opinions about this versus the packages talked about in this meditation?

        See Perl Advent on PDF::Reuse and PDF::Reuse on CPAN.

        metadoktor

        "The doktor is in."

Re: PDF::API2 Examples
by Solo (Deacon) on Aug 17, 2006 at 01:47 UTC
    I finally found these example bundles which go a long way

    It appears this link is unavailable now, at least to me. If someone has these examples (or access to them) please mirror them or allow me to--/msg me, please. Thanks!

    --Solo

    --
    You said you wanted to be around when I made a mistake; well, this could be it, sweetheart.
      http://web.archive.org/web/20040728161635/http://penguin.at0.net/~fredo/files/PDF/
        Latest URL posted is not working :(

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2014-08-29 21:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (289 votes), past polls