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.
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
The new attachment icon should allow us to open the just generated PDF version
of the document.
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. We constantly work on improving it. Please request PD4ML support
for the most recent and feature-rich version of DXL converting XSL stylesheet.
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
5. The following needs to be done to set the Java properties for Domino on
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.
7. For some document types, producing broken PDF layout, (especially if generated PDFs contain snippets of LotusScript code) it helps after String xml = dxl.exportDxl(tmp); >Java agent code line is substituted with String xml = dxl.exportDxl(doc);.