Note: Updated documentation is coming soon. Below is slightly outdated version for PD4ML v3
The example Notes agent 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.
See the main page for a general Notes-to-PDF conversion info.
We start with a blank database creation in IBM Domino Designer.
The following description/screenshots correspond to R6 version of Domino Designer; with the most recent versions of the Designer application the flow differs only in minor details.
(If you do not want to follow all the steps, download a copy of preconfigured NSF R9 database)
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 (TODO).
Now it is time to create a document form
save it, switch to IBM 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.
Note: sometimes Notes fails to start the PDF generation agent of the demo database and hangs. Actually Notes does not trust the fake agent signature and for some reason it fails to show its security alert dialog. Try to restart Notes and to reopen the database.
String xml = dxl.exportDxl(doc);
<rawitemdata type="1">object, often it is a sign of DXL export failure: Notes cannot represent a particular document in DXL form, so it base64-encodes the original Notes binary document object and sends it back. (
<rawitemdata type="1">is also returned for XPage documents, but it is another story)If you have a control over the document, a tactics to debug is as follows. Open the database in Domino Designer and start to delete document input fields one by one (and test every step in Notes) until it produces a correct DXL. After a problematic input field is found, return it back to the document and start to clean its properties one by one (again with DXL testing). According to our experience, usually it is a single property value makes DXL exporter to give up. For example, any value in "Field Hint" property make IBM Notes 9.0.1 to fail with a DXL export. Hopefully someone from IBM works on the issue.