You may have read that I recently asked a question on PDF generation. My requirements are different from yours, in that I need precise placement of lots of graphics, where as you want mostly text, but we can probably share some of the same solutions.

I would agree with you that the PDF modules are not easy to use. I also found them buggy, but then my needs are complex.

After asking the question and reading the responses, I have decided to take the route of generating SVG using a template, and then converting the template to PDF using inkscape's svg2pdf tool. I think that solution might suit you as well.

You can 'draw' your invoice in inkscape or suchlike, and get the layout just right complete with your company logo. You put random place holder text for where the invoice text will be. Once you have finished, you save the SVG, which will be easy to understand XML, and replace the place holder text with template tags. From there it should be fairly easy to feed the template into your favourite templating library, and convert the resultant SVG to PDF.


In reply to Re: PDF vs. HTML for invoice generation by chrestomanci
in thread PDF vs. HTML for invoice generation by Anonymous Monk

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.