Hi Gary, Apache PDFBox is a rather low-level PDF library that doesn't offer too much in terms of creating complex layouted documents. If you need two-channel output with more or less the same layout for HTML and PDF, I suggest you take a look in the direction of XSL-FO, i.e. Apache FOP [1], for the PDF part.
The ASF has tools that support both directions with not too much coding. Apache Cocoon [2] is a web framework which can generate various output formats including HTML and PDF (via XSLT and Apache FOP). And it can take data from a database. Apache Forrest [3] is based on Cocoon and does about the same you want to do: generate HTML and PDF from the same XML-based content format. Well, maybe the latter will not exactly match your requirements if you have special layout desires. But even if you don't pick Cocoon or something based on Cocoon, Apache FOP can help you on the PDF requirement. I assume your content in the DB is XML-based. In that case, create an XSLT stylesheet for HTML output and one for XSL-FO output. The XSL-FO can then be converted to PDF by Apache FOP. Not too much programming involved but you have to know your XSLT, HTML and XSL-FO. At any rate, it will be much less work than trying to build a layout tool on top of PDFBox and maintaining the Java code across layout changes. That's where XSLT is very good at. That said, Apache PDFBox is very good when it comes to post-processing PDFs. But for creating complex PDFs I think there are more suitable tools. I hope noone bites my head off for saying this. ;-) HTH [1] http://xmlgraphics.apache.org/fop/ [2] http://cocoon.apache.org/ [3] http://forrest.apache.org/ On 25.01.2011 23:22:37 Gary Wong wrote: > Hi, > > Not sure if this is the right place to post. But I couldn't find a features > list on the web page. I wanted to see if PDFBox could do this: > > I want so store images and text in a database (and possibly PDFs). Then have > a Java servlet to access the DB and build a both a webpage and a PDF file? > The PDF file will be for downloading and web page for viewing. Both should > have the same layout. > > Would this be hard to do? Any sample code? > > Thanks! > > g Jeremias Maerki

