I have written a module that produces PDF reports using just Perl only (no libs). About 4 weeks ago, I was tasked with automating a research report that pulled information from Sybase and MSSQL databases. A requirement was that the report had to look the same as the existing report which was being produced by cutting and pasting data in Excel and MSWord. The data had to be scrubbed by hand, and the customer wanted rules automated as well.

None of the Perl PDF modules did everything I needed, and I didn't want to hack the existing modules, so, I sat down and read the first 500 pages of the Adobe PDF Reference Manual and wrote my own special implementation of the module (I knew PostScript already, so it wasn't so scary). I took a different approach than the existing modules and decided to developed a pdf object with methods for each of the things I needed to do. So I have built a graph method(it draws scaleable stacked bar charts with a legend - font,size,color,linewidth, autoscale, etc), a table method(header,footer, rows, cols, font, fontsize, color, padx,pady, linewidth, linepattern, alignment), an image method ( file, height, width, x, y (only does jpgs currently)), text method(x,y,align,font, size, color), and methods to draw ...

I have about 75% of module finished (only need to add the methods to produce an index automatically from the content, and a rule set to split the content stream across pages. (This is one area that lead me to writing my own module in the first place... PDF doesn't have any mechanisms ( or restrictions!) as to how to wrap or when to do a page break. As a result, you have to keep track of the content height yourself or it just runs off the page.

Three weeks ago, my customer decided that he would rather have the project completed in Java because they were worried about the long term maintenance of the report ... (sigh) and so, I had to stop working on the Perl implementation and start developing the report using iText.

I am going to complete this module in my spare time on the weekends just to show the customer just how powerful Perl is.

I plan on implementing a simple write method that mimics Perl's format so that users didn't have to learn anything new to send their output directly to PDF's.

I have run into a few technical difficulties concerning encoding fonts, doing hyphenation, auto-pagination, multi-column control and layout and a few other items... ie... I need some help!) Anyway, if you would like to know more see a sample report, or if you want to help me, send me an e-mail: jmoosmann@earthlink.net

James NC

In reply to Re: PDF generation by JamesNC
in thread PDF generation by michellem

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.