Generating formetted documents in Perl

  • Thread starter Russel Dalenberg
  • Start date
R

Russel Dalenberg

I'm trying to write a Perl program that will output a simple catalog. I'd
like to produce something nicer than raw text output.

I have entries with three fields, and I want to be able to display the
fields in columns. I'd like to provide headers and footers with page
numbers (in alternating corners for even/odd pages, if possible). It would
also be really nice if I could include a horizontal line between some of
the entries. I don't need much in the way of fonts, just a couple of
sizes, and maybe bold and italic.

I want the program to be portable between systems (Windows and Linux
presently, Mac OSX eventually), and the output format as well. Ideally,
I'd like to create an output file that the user can bring to his local
print shop to get printed.

I looked through CPAN some, and found RTF::Writer and PDF::Create, but
neither seems to be easy to use, or able to give me the type of output I'm
looking for. This seems strange since I think the page format I'm trying
to produce is pretty simple.

Am I just missing something with the RTF and PDF packages, or is there some
other way that I should use to generate formatted output. I'm about ready
to say "heck with it" and see if I can generate troff files. :)

Any pointers to documentation that might help, or examples that help me
figure out how to do the formatting would be greatly appreciated!
 
I

ioneabu

Russel said:
I'm trying to write a Perl program that will output a simple catalog. I'd
like to produce something nicer than raw text output.

I have entries with three fields, and I want to be able to display the
fields in columns. I'd like to provide headers and footers with page
numbers (in alternating corners for even/odd pages, if possible). It would
also be really nice if I could include a horizontal line between some of
the entries. I don't need much in the way of fonts, just a couple of
sizes, and maybe bold and italic.

I want the program to be portable between systems (Windows and Linux
presently, Mac OSX eventually), and the output format as well. Ideally,
I'd like to create an output file that the user can bring to his local
print shop to get printed.


Would generating html tables be adequate? Your users can print them
from their browsers.

Look at CGI.pm if you want to do it in Perl.

wana
 
R

Russel Dalenberg

Would generating html tables be adequate? Your users can print them
from their browsers.

Look at CGI.pm if you want to do it in Perl.

The final catalog would be 100+ pages in length, which is why I wanted to
generate a platform-independant output file that could be printed at a
local print shop.
 
T

Tad McClellan

Russel Dalenberg said:
I'm trying to write a Perl program that will output a simple catalog. I'd
like to produce something nicer than raw text output.
fields in columns. I'd like to provide headers and footers with page
numbers (in alternating corners for even/odd pages, if possible).
or is there some
other way that I should use to generate formatted output.


I'd generate *structured* output from your Perl (or other) program,
and have some other program format that for me.

and see if I can generate troff files. :)


I'd generate XML, perhaps in a catalog-specific schema or even
in DocBook, and let one of the bazillion XML processors turn it
into PDF, or troff or HTML or...
 
S

Scott Bryce

Russel said:
I'm trying to write a Perl program that will output a simple catalog.
I'd like to produce something nicer than raw text output.

It sounds like PDF would be the way to go. You can do what you want to
do in perl, but you will either need a basic understanding of the PDF
spec, or PDF creation software. Ask your question in comp.text.pdf and
see what answers you get there.

RTF will not necessarily give you the same look across platforms, since
RTF relies on fonts available on the system. PDF has enough standard
fonts to meet your needs.
 
R

Russel Dalenberg

Tad said:
I'd generate *structured* output from your Perl (or other) program,
and have some other program format that for me.

Humm ... the first part is pretty easy; the input is already pretty
structured to begin with. But I was really hoping not to have to depend on
any other software to generate the final document. Maybe that's not as
easy as I had hoped.
I'd generate XML, perhaps in a catalog-specific schema or even
in DocBook, and let one of the bazillion XML processors turn it
into PDF, or troff or HTML or...

I don't know much about XML. From what I can see, generating simple XML
from my input data would be easy, but how does that give me paginated
output? I only mentioned troff because long ago and far away I used to
generate documents by hand that way, and I know it can handle pages with
headers and footers.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top