Generating formetted documents in Perl

Discussion in 'Perl Misc' started by Russel Dalenberg, Jun 3, 2005.

  1. 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!

    --
    Russel Dalenberg
    Russel Dalenberg, Jun 3, 2005
    #1
    1. Advertising

  2. Russel Dalenberg

    Guest

    Russel Dalenberg wrote:
    > 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
    , Jun 3, 2005
    #2
    1. Advertising

  3. wrote:

    > Russel Dalenberg wrote:
    >
    >>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.

    >
    > 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.

    --
    Russel Dalenberg
    Russel Dalenberg, Jun 3, 2005
    #3
  4. Russel Dalenberg <> wrote:

    > 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...


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Jun 3, 2005
    #4
  5. Russel Dalenberg

    Scott Bryce Guest

    Russel Dalenberg wrote:
    > 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.
    Scott Bryce, Jun 4, 2005
    #5
  6. Re: Generating formatted documents in Perl

    Tad McClellan wrote:

    > Russel Dalenberg <> wrote:
    >
    >>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.


    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.

    >>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...


    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.

    --
    Russel Dalenberg
    Russel Dalenberg, Jun 7, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Zak Chababe

    convert word documents using Perl

    Zak Chababe, Jul 12, 2003, in forum: Perl
    Replies:
    0
    Views:
    1,352
    Zak Chababe
    Jul 12, 2003
  2. =?Utf-8?B?bmV0Y29tbWFuZGVy?=

    Generating XML comment documents from ASP.NET C# code-behind

    =?Utf-8?B?bmV0Y29tbWFuZGVy?=, Jan 25, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    781
    Rick Strahl [MVP]
    Jan 25, 2006
  3. Ruchi Dayal
    Replies:
    1
    Views:
    692
    Peter Gerstbach
    Sep 7, 2004
  4. Replies:
    1
    Views:
    478
    Juan T. Llibre
    Oct 18, 2006
  5. Tony
    Replies:
    2
    Views:
    384
Loading...

Share This Page