From: Justin C on 21 Jan 2010 11:46 I want to produce a PDF containing two tables side by side. Each 51 rows (including a header) by three columns. Columns 1 and 2 in each table are to contain centred text, and column three is to be left-aligned. I've been experimenting with PDF::API2, and PDF::Table, but PDF::Table doesn't appear to do centred text, and PDF::API2 is hard work - the documentation leaves a lot to be desired, for example, surfing the web for hints on using PDF::API2 I find references to methods not mentioned in the PDF::API2 documentation. Does anyone have any suggestions on how I might proceed? TeX looks like it might be the best way forward now, I have Lamport's LaTeX book here so can pull together the relevant TeX/LaTeX commands. I suppose that, if I can knock up what I want in TeX to start with I won't even need a TeX module, I can just use some templating. I'll probably still need Latex::Driver to get my PDF. Thank you for any suggestions. Justin. -- Justin C, by the sea.
From: RedGrittyBrick on 21 Jan 2010 13:54 Justin C wrote: > I want to produce a PDF containing two tables side by side. Each 51 > rows (including a header) by three columns. Columns 1 and 2 in each > table are to contain centred text, and column three is to be > left-aligned. > > I've been experimenting with PDF::API2, and PDF::Table, but PDF::Table > doesn't appear to do centred text, and PDF::API2 is hard work - the > documentation leaves a lot to be desired, for example, surfing the web > for hints on using PDF::API2 I find references to methods not mentioned > in the PDF::API2 documentation. > > Does anyone have any suggestions on how I might proceed? TeX looks like > it might be the best way forward now, I have Lamport's LaTeX book here > so can pull together the relevant TeX/LaTeX commands. I suppose that, if > I can knock up what I want in TeX to start with I won't even need a TeX > module, I can just use some templating. > Since I know PS better than Tex, I'd just print PS statements directly and use GS to convert that to PDF. --------------8<---------------- #!/usr/bin/perl use strict; use warnings; print <<EndPS; %!PS /Times-Roman 12 selectfont 100 700 moveto (Hello) show showpage EndPS --------------8<---------------- Untested - caveat emptor. I have PS boilerplate for centering text etc. -- RGB
From: John Bokma on 21 Jan 2010 13:57 Justin C <justin.0911(a)purestblue.com> writes: > I want to produce a PDF containing two tables side by side. Each 51 > rows (including a header) by three columns. Columns 1 and 2 in each > table are to contain centred text, and column three is to be > left-aligned. > > I've been experimenting with PDF::API2, and PDF::Table, but PDF::Table > doesn't appear to do centred text, and PDF::API2 is hard work - the > documentation leaves a lot to be desired, for example, surfing the web > for hints on using PDF::API2 I find references to methods not mentioned > in the PDF::API2 documentation. > > Does anyone have any suggestions on how I might proceed? TeX looks like > it might be the best way forward now, I have Lamport's LaTeX book here > so can pull together the relevant TeX/LaTeX commands. I suppose that, if > I can knock up what I want in TeX to start with I won't even need a TeX > module, I can just use some templating. For a project that required XML invoices to be turned into PDF or TIFF I used two external (to the Perl program this was part of) programs: AltovaXML (free, closed source) and Apache FOP. The former because it was the only free software (albeit closed) I could find that supports XSLT 2, and Apache FOP to convert XSL-FO to PDF (or TIFF, or several other formats) Tables are supported that way (and quite easy IMO). -- John Bokma j3b Hacking & Hiking in Mexico - http://johnbokma.com/ http://castleamber.com/ - Perl & Python Development
From: Ilya Zakharevich on 21 Jan 2010 17:18 On 2010-01-21, Justin C <justin.0911(a)purestblue.com> wrote: > Does anyone have any suggestions on how I might proceed? TeX looks like > it might be the best way forward now, I have Lamport's LaTeX book here > so can pull together the relevant TeX/LaTeX commands. I suppose that, if > I can knock up what I want in TeX to start with I won't even need a TeX > module, I can just use some templating. [I did not try direct pdflatex, but] keep in mind that relying on latex+dvips+ps2pdf (needed since sometimes one needs to add pstops to the mix) turns out to be prohibitive for deployment. See documentation of typeset_audio_dir (on CPAN) for workarounds needed for misconfigured machines (in my experience, much more than half of them are misconfigured). And a week ago I found a problem after an upgrade I just have no clue how to workaround... Hope this helps, Ilya
From: Ben Morrow on 21 Jan 2010 18:41
Quoth Justin C <justin.0911(a)purestblue.com>: > I want to produce a PDF containing two tables side by side. Each 51 > rows (including a header) by three columns. Columns 1 and 2 in each > table are to contain centred text, and column three is to be > left-aligned. > > I've been experimenting with PDF::API2, and PDF::Table, but PDF::Table > doesn't appear to do centred text, and PDF::API2 is hard work - the > documentation leaves a lot to be desired, for example, surfing the web > for hints on using PDF::API2 I find references to methods not mentioned > in the PDF::API2 documentation. > > Does anyone have any suggestions on how I might proceed? TeX looks like > it might be the best way forward now, I have Lamport's LaTeX book here > so can pull together the relevant TeX/LaTeX commands. I suppose that, if > I can knock up what I want in TeX to start with I won't even need a TeX > module, I can just use some templating. I've done this sort of thing with pdflatex in the past, with good results. (This is clpm not ctt, but do you know about xetex that knows Unicode and can find your system's OpenType fonts without needing to be told?) For templating I'd start with Template::Simple and move to TT if it proved necessary. > I'll probably still need Latex::Driver to get my PDF. I just used system, with the usual bit of logic to rerun the appropriate four and a half thousand times until the formatting stabilised, but L::D looks like a decent encapsulation of that. (L::D can run makeindex bibtex/etc. of course, which is rather more than is needed for a situation like this.) Ben |