Creating a PDF Document Using Data from Database

Date:7 August 2012
Product/Release:LANSA Integrator - All Versions
Abstract:Using data from a Database to create a PDF.
Submitted By:LANSA Technical Support


How do you generate a PDF using data from a database? For example, if you have employee details, which includes all their header information and other detail related information like skills, multiple addresses, etc. and you want to put all of this into a PDF document.

What are the solutions worth considering and what is the complexity of each one?


What is required is to create PDF's dynamically. There are various options when it comes to creating dynamic PDF’s. These include:

  • PDFDocument service: This uses the shipped LANSA Integrator service to design and build dynamic PDF documents. This is good for creating basic and complex PDF’s but requires knowledge of LANSA Integrator, as well as some expertise with XML when designing the layout (since the layout in XML will need to be hand-cranked).
  • CodeStart XSL-FO: This method has a developer UI element which enables the PDF layout to be designed using WAMS or Microsoft Word, along with a custom LANSA Integrator service (FOPService) to generate the dynamic PDF. The advantage of this approach is that it makes it easy to design rich PDF layouts using a WISYWIG editor (e.g. WAM XSL Editor). It does require some expertise with WAM development to create the layouts at design time. Note that this is a custom and chargeable service offered through LANSA Professional Services that can be used either through a CodeStart offering or as part of a larger Services solution. See CodeStart – XSL-FOP PDF Service for the CodeStart details.