OK, I've read the existing nodes, and tried some of the suggested solutions. Unfortunately, I can't seem to get quite what I need from them. The two ares I'm having difficulty with are line height and pagination.

HTMLDOC, is simple to use, allows us to leverage the current HTML-generating code, and allows pretty good control over pagination, but appears to only allow a constant line height. We're representing fractions using the vertically aligned format. In HTML, 1<br><img src="line.gif"><br>2 generates the desired effect. The generated PDF, unfortunately, appears to maintain a constant line-height, causing excess space between the numbers and the line, like so. I've tried several variations on the HTML; I can move the line around within the space, but I can't seem to get rid of it.

As for pagination, we need to be able to say "This chunk of information should stay together unless it is longer than a page". PDF::API2 appears to allow a fair amount of low level control over text formatting, and might address the previous issue, but I don't see method which would help implement this sort of logic. (For instance, a method to determine how much empty page is left, or how much space a chunk of data will take up.) Nor does it allow us to reuse as much existing code.

Does anyone know HTMLDOC tricks I'm missing? PDF::API2 tips? Other modules to investigate?


In reply to Dynamically generated HTML to PDF by menolly

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.