RE: Producing documents using Perl
by BigJoe (Curate) on Aug 15, 2000 at 23:29 UTC
|
I would probably take a look at txt2pdf. They used perl to create a PDF file from a text file. It has the options of colors and stuff to.
--BigJoe
Learn patience, you must. Young PerlMonk, craves Not these things. Use the source Luke. | [reply] |
(jeffa) Re: Producing documents using Perl
by jeffa (Bishop) on Aug 15, 2000 at 22:10 UTC
|
One approach could be to use HTML formatting. Just produce
an HTML document which could then be easily converted to
PostScript. Tables with borders make decent boxes and HR
and FONT tags are at
your disposal.
Hope this helps,
Jeff | [reply] |
RE: Producing documents using Perl
by gumpu (Friar) on Aug 16, 2000 at 11:33 UTC
|
You could try and generate LaTeX documents. LaTeX command
are all in plain ASCII, and you get nice results. I've
been using it to autogenerate documentation from programs.
It also has commands to make lines and boxes around text.
Have fun,
Frans.
| [reply] |
Re: Producing documents using Perl
by ferrency (Deacon) on Aug 16, 2000 at 01:14 UTC
|
I'll tell you what I would Not recommend... that would be,
generating troff/groff/nroff code directly
from your Perl script, and using groff to turn it into
postscript. Yikes, what a PITA that was! I guess I'm just
not old-school enough.
Better would be to check out some of the many PDF modules
in CPAN.
Update: My output wasn't simple enough. It had
multiple tables, with word-wrapping within a single column in the
table, embedded postscript, different font sizes and styles, etc.
I figured it all out and it worked in the end; but by now I'm
Sure there's an easier way.
Alan | [reply] [d/l] |
|
|
Bah. It's trivially easy if your output is simple enough.
For plain text, just use blank lines to
separate paragraphs, and put the following line
at the beginning of your output:
.LP
Then, run your output through the following program:
(By default, it will output PostScript in 10-point
Times Roman font. Of course, fonts and sizes can also
be easily changed.)
groff -ms
Was that so hard? But wait, there's more...
If you're interested in putting a box around a paragraph:
.B1
paragraph text
.B2
And in general, lines and boxes are easily created using the pic
preprocessor. It's automatically invoked by providing the
-p option to groff.
A simple example:
.PS
box "boxed text"; arrow; circle "circled text"
.PE
Don't be afraid.
buckaduck | [reply] [d/l] [select] |
Re: Producing documents using Perl
by Anonymous Monk on Aug 16, 2000 at 15:53 UTC
|
You don't state your platform so ignore the bits that don't apply.
If these are form letters then you should consider generating a data file and using a word processor to perform mail merge for you. On Windoze OLE automation could be used to achieve this with minimal intervention. In Unix land a few well place system() calls might do the trick for you.
Alternatively, on Windoze, the entire document could be authored by OLE automation.
If you use the txt2pdf approach outlined above, perhaps one of the Text::Template style modules could be of assistance to get the bulk of the content sorted. | [reply] |
Re: Producing documents using Perl
by bliz (Acolyte) on Aug 16, 2000 at 20:04 UTC
|
I would recommend opening up a copy of StarOffice, and
creating a TEMPLATE of what you are wanting... then export
the thing to postscript (print to file). From there, you
can just open the postscript document that was generated,
and replace the template values you put in ther with the
actual values.. now you have a dynamic template postscript
file... joy.. :)
"thank you, drive through please..."
| [reply] |
RE: Producing documents using Perl
by t0mas (Priest) on Aug 17, 2000 at 14:30 UTC
|
You can use RTF::Document to create Rich Text Format
documents readable by most word-processors. It's still in
alpha though...
RTF documents are easy to create "by-hand" if you would like to.
You'll find some RTF specs over at The Programmer's File Format Collection
(among lots of others).
/brother t0mas
| [reply] |
Re: Producing documents using Perl
by Anonymous Monk on Aug 16, 2000 at 20:13 UTC
|
Depending on the nature and scope of the project, I have had a good deal of success using, for instance, a MySQL database, Perl, and QuarkXpress on a Mac to do business cards for a 150+ person company.
And while this doesn't really sound like what you want, I thought I would mention it just in case as it's a poorly-documented solution of which many are completely unaware.
Essentially you play to Perl's strengths, using it to parse the text/db output/HTML/whatever and perform basic markup functions/regexps using Quark's style-sheet markup language (see deep in the Quark Appendices). Quark allows you to import with style sheets and there is *nothing* that you would ordinarily do to text in Quark that you can't do using the markup language, and you can then add images, etc., to your final product (not a bad thing for long documentation, business cards...).
If anyone is interested I'd be happy to explain some of the strengths and weaknesses of this approach off-list.
Otherwise, if open/free is the criteria, LaTex is definitely worth a look.
| [reply] |