Instead of directly writing PDFs, you also might want consider to write a TeX/LaTeX file, which easily can be converted to a pdf with LaTeX. If you're on gn*x, I would check out the tetex package (find it on freshmeat.net).

The advantage of such an approach is, that you can have quite high-level control (ie, just write your text). However, learning about all the handy packages can take quite a while. A sample perl script might be something like this:

#get the data first $a = <DATA>; chomp $a; $b = <DATA>; chomp $b; open TEX, ">file.tex" or die "Could not open file.tex"; print TEX <<'_END'; \documentclass{article} \begin{document} \title{TeX-report} \author{Me} \maketitle \section{Some data} _END print TEX "I have $a and $b. That's all for now.\n"; print TEX <<'_END'; \section{Some table} \begin{table} \caption{A table} \begin[|l|c|c|]{tabular} \hline _END while(<DATA>){ chomp; print TEX join('&', split ).'\\ \hline'."\n"; } print TEX <<'_END'; \end{tabular} \end{table} \end{document} _END system("latex file.tex"); system("latex file.tex"); system("dvipdf file") if -e "file.dvi"; __DATA__ 129873 12315 1 8 2 1 3 100 8 3 4

Here I'm also using the dvipdf package, (freshmeat.net), but you could use 'dvips file -o' and 'ps2pdf file.ps' as well. Perl code is checked. I'm using TeX daily, so you always can /msg me with further questions.

Hope this helps,

Jeroen
"We are not alone"(FZ)


In reply to Re: Generating PDF by jeroenes
in thread Generating PDF 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.