OT: writing pdf from perl

D

Dave

I currently have a perl program with which I read an xml file (of dictionary
entries), sort and format the entries and print them out (as html). I then
read the html into openoffice manually add columns and page numbers and
export as pdf.

I would like to automate these last steps and also add individual page
headers based on the first entry on each page. This is beyond what a
word-processor can easily do so I am looking at writing directly to the
printer (or pdf).

I can see how I could so this from C# using the printer classes (and
MeasureString and DrawString etc methods from System.Drawing), but I would
prefer to do it from perl. Any ideas as to any modules that might make this
possible? Ideally I would like something cross platform Windows/Linux. I
have googled and looked at CPAN but not found anything promissing.

Dave
 
A

A. Sinan Unur

I currently have a perl program with which I read an xml file (of
dictionary entries), sort and format the entries and print them out
(as html). I then read the html into openoffice manually add columns
and page numbers and export as pdf.

I would like to automate these last steps and also add individual page
headers based on the first entry on each page. This is beyond what a
word-processor can easily do so I am looking at writing directly to
the printer (or pdf).

I am of limited intelligence: I do not really understand any of the PDF
modules on CPAN. So, I take the easy way out. I use one a template
(Template Toolkit or HTML::Template) written in LaTeX, fill in the values,
then run process the output with pdflatex to get the pdf.

Sinan
 
D

Dave

A. Sinan Unur said:
I am of limited intelligence: I do not really understand any of the PDF
modules on CPAN. So, I take the easy way out. I use one a template
(Template Toolkit or HTML::Template) written in LaTeX, fill in the values,
then run process the output with pdflatex to get the pdf.

Sinan

Thanks, I'll look into that. There are a couple of issues I'll need to bear
in mind. One is that my text is Unicode which doesn't always work well with
older Unix tools - can I assume LaTeX can cope with this? The second is that
the font I need to use does not have a real Bold. I'm not sure how this
works with these tools. With Windows.Forms (I'm using Mono rather than
Microsoft's .NET framework) this is emulated so maybe that is the way to go.
 
B

Ben Morrow

Quoth "Dave said:
Thanks, I'll look into that. There are a couple of issues I'll need to bear
in mind. One is that my text is Unicode which doesn't always work well with
older Unix tools - can I assume LaTeX can cope with this?

Nope :). TeX (in which LaTeX is written) is *veeeeeeery* old.

There is a version of TeX called Omega, and a corresponding version of
LaTeX called Lambda, which are supposed to handle Unicode. I've never
used them, though.
The second is that the font I need to use does not have a real Bold.
I'm not sure how this works with these tools. With Windows.Forms (I'm
using Mono rather than Microsoft's .NET framework) this is emulated so
maybe that is the way to go.

LaTeX will fake a bold for you if you ask it nicely. Setting up fonts
that there aren't packages for is *seriously* difficult, though.

You may want to take some of these questions over to comp.text.tex.

Ben
 
S

Sherm Pendley

Dave said:
Thanks, I'll look into that. There are a couple of issues I'll need to bear
in mind. One is that my text is Unicode which doesn't always work well with
older Unix tools

Then you might want to consider a Unicode-savvy toolchain, maybe outputting
XML that's been transformed via XSLT into XSL:FO, and feeding that to a
formatter like the Apache Group's "Fop" to produce PDF output.

sherm--
 
G

Guest

: Nope :). TeX (in which LaTeX is written) is *veeeeeeery* old.

: There is a version of TeX called Omega, and a corresponding version of
: LaTeX called Lambda, which are supposed to handle Unicode. I've never
: used them, though.

While this is of little relevance to clpm, even though TeX is very old,
and LaTeX only comparably younger, there is very modern support for Unicode
in the form of the ucs package and the utf8x extension to inputenc. There
is no need to worry whether you have problems with that. That said, this
discussion is best continued in comp.text.tex.

Oliver.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top