in reply to Web-based PDF export

PDF::API2 can read in a pdf template and write stuff on top of it..

as for the db part, DBI is the way to go -- see the Tutorials for a good starting place