HTML to PDF converter for Java™

HOME   FEATURES   PRODUCTS   DOWNLOADS   BUY NOW!   SUPPORT

Creating PDF documents from Lotus Notes with PD4ML

(updated January 16, 2008)

Most of the online scenarios of PDF generation on Lotus Domino platform can be implemented with minimal effort using PD4ML JSP custom tag library.

This article describes how to automate PDFs generation for documents located not only in online (Lotus Domino), but as well as in offline (Lotus Notes) databases.

As a starting point we recommend to look through "Leverage DXL to Overcome Web Browser Rich Text Limitations" Lance Spellman Workflow Studios. The document describes the concept of DXL (Domino XML) language and XSL transformations needed to convert DXL to HTML.

The example Lotus agent, we are going to introduce, extracts selected document(s) in DXL form from database, performs XSL transformation of the DXL to HTML, converts the HTML to PDF and stores the resulting PDFs as attachments to the original document(s). The agent code can be easily adjusted to your particular needs: sending of emails with PDF attachments, external archiving of documents in PDF form etc.

We start with a blank database creation in Lotus Domino Designer.

(If you do not want to follow all the steps, download a copy of preconfigured NSF R6 database, R7-R8 remark)

After the database is produced, create an agent.



The type of the agent should be set to "Java":


Copy-paste the agent code (R7 agent code) to the agent editor. An attempt to save would cause an error: there are still missing libraries there.


In order to add the missing resources press "Edit Project" button and add pd4ml.jar (or pd4ml_demo.jar) from PD4ML distribution, ss_css2.jar and dxl4pd4ml.xsl.


There is also optional fonts.jar contains TTF fonts, for a case it is not possible to refer to a local font directory like "c:\windows\fonts".

The sample fonts.jar directory structure:

More about TTF embedding is here.

Now it is time to create a document form



 

save it, switch to Lotus Notes and create a document instance:



 

Now we can activate the agent with Actions->Create PDF menu item. Close the document and open it again (No idea how to refresh the document view from Java code).

The new attachment icon should allow us to open the just generated PDF version of the document.



 

Remarks:

1. The XSL we use in the example does the basic transformation to HTML, handles images, attachments and page breaks, but it is still far away from the full DXL features support. Please contact us if you need some features to be urgently added.

2. The example is tested with Lotus Notes/Domino 6.5.4. Older versions do not allow to load resources via Java ClassLoader, so it is needed to store the XSL to the database as a "normal" document and to read it from there by usual for Lotus Notes way.

3. A smooth support of DXL features required some changes in PD4ML functionality. For the described scenario it is recommended to use PD4ML v3.2.1b3 and above.

4. The agent debug output can be seen under File->Tools->Show Java Debug Console

5. The following needs to be done to set the Java properties for Domino on the iSeries:

  • Create an entry in the notes.ini pointing to custom Java user settings file (JavaUserOptionsFile=/notes/wdomino1/javaOptions.txt)
  • Create the file using the ASCII character set and add the following entry or any other properties that need to be set...
            java.awt.headless=true
     

6. Starting with Lotus Notes R7 the way of XSL transformation has been changed for Lotus platform. Here is an updated NSF demo database, compatible with the changes.

Note: sometimes Lotus Notes fails to start the PDF generation agent of the demo database and hangs. Actually Lotus does not trust the fake agent signature and for some reason it fails to show its security alert dialog. Try to restart Lotus and to reopen the database.

Copyright ©2004-08 zefer|org. All rights reserved.