in reply to PDF::Template redesign - I want your ideas!


Hokay...I have a potential use case for myself, but first, a comment:

I don't want to have to write XML.

I have a structured document that I produce. Presently, I use a C program I inherited with the job that produces custom PostScript. Unfortunately, the full document has some front and back matter (including a table of contents) that have to be generated by hand and merged together.

The Preview tool in MacOS X will convert my PostScript into PDF and leave me with a PDF with searchable and selectable text. What I'd like to be able to do (and did some preliminary poking around toward) is to directly generate a PDF, ideally with a real ToC that links to the appropriate places.

The current C program treats the body of the document as having a nested structure of bits as it sets the type. The bits of stuff are:

I'm doing this off the top of my head, so I may have left out a level of detail here. Words are the smallest unit of stuff to set, being nominally indivisible strings.

The input data gets grouped into Section chunks. When a Section is fully populated with the text and its formatting, the Section is poured into the Column, leaving a rump Section when it doesn't all fit. Keep pouring into Columns as necessary. When a Page fills up, the PostScript gets generated and sent to the output filehandle. Sections that break across a Column have a continuation header on subsequent columns, and Pages have headers in the manner of dictionaries.

Typeface stuff is applied at the Word level. Each level includes positioning data that is relative to its container, and the higher-level elements have margins and sizes (being nested rectangles).

I have a multi-tiered template in mind -- and I suspect that it could be expressed in CSS terms as well, just to confuse matters. At one point, I had worked up an XML-ish representation of the document but didn't go far with it before my attention span ran out.