[thelist] create PDF "template" and insert vars

Sam Beam sbeam at onsetcorps.net
Wed Jan 5 08:08:11 CST 2005


We have what seems like a fairly simple and common requirement - create 
a PDF template that has some tokens in it, replace those tokens on the 
fly with values from a DB and return a new file. This is for a shipping 
label - so the template looks something like this, only nicer:
+-------------------------------------------------+
| <LOGO>          <BAR_CODE>       <SENDER_NAME>  |
|                                  <SENDER_ADDR>  |
| <USPS_NOTICE>                                   |
|                 <RECIP_NAME>                    |
|                 <RECIP_ADDR>                    |
| <SHIPPING_INFO>                                 |
+-------------------------------------------------+
The formatting of the label is actually pretty complex so we can't use a 
braindead html->pdf converter like HTMLdoc and it is only 1 page so we 
don't need to worry about page breaks, bookmarks, table of contents, 
etc.

All of the stuff like TeX or jPDF or PDFlib or XSL-FOP seems like such 
overkill - the template is already made using Acrobat, all we need to 
do is get that user data in there. Unfortunately all these solutions 
seem to bring you back to that low level of "render a horizontal black 
line starting at coordinate 10,10..." which is a waste of time.

So does anyone know of the best way to go about this? Ideally it would 
be similar to how you would use Smarty or Velocity templates but just 
with Postscript output instead of HTML...

-- 

# S Beam - Web App Dev Servs
# http://www.onsetcorps.net/


More information about the thelist mailing list