2.5. Java code samples

Overview

Starting with version 2.14, SWING PDF Converter provides a set of Java API utilities which allow customers to create solutions in either Lotus Notes or Java environments. You can now use Eclipse, NetBeans or any other Java IDE to manage the ways in which your Notes documents and collections are converted to PDF format. 

SWING PDF Converter Java API was made to resemble our existing LotusScript API so existing users will have no trouble while moving from LotusScript to Java if needed. The same classes and functions used in LotusScript can be found in Java in almost identical form, with identical names of classes and methods.

This new feature makes SWING PDF Converter an ideal solution for converting Lotus Notes documents to PDF format outside Lotus Notes environment (in addition to its existing functions for converting documents directly in Notes). 

Requirements

To be able to use the Java API you need to have the following components on your system:
  • JDK 1.4 or higher (or Lotus Notes R7 and higher if you will be coding inside Lotus Notes),
  • Set of JAR file dependencies
  • License Key (you will be required to put it in your code)
Additionally, you will also need to specify some Lotus Notes core classes such as Document, Session and DocumentCollection in some methods or classes of the Java API. This should be no problem if you have Lotus Notes already installed on the same machine where conversions will be run or if you will be coding inside Lotus Notes.

The JAR file dependencies include several Java files that you will need to place in your CLASSPATH so that the Java API can work correctly and so that you can use it normally inside various development environments or when the application is deployed. Here is the list of required libraries:
  • htmlcleaner2_1.jar
  • iText-2.1.7-sw.jar
  • flying-saucer-sw.jar
  • swlmbcs.jar
  • bcmail-jdk13-145.jar
  • bctsp-jdk13-145.jar
  • bcprov-jdk13-145.jar
  • swpdfc-2.0.0.jar

These files are available within the PDF Converter .nsf database, on the SwExternalResources form (you will need Domino Designer to access this form). In addition, they are also used during the deployment of SWING PDF Converter in a Lotus Notes environment and are usually copied to the "Data\SwPDFc\java\" folder upon installing the product.

If you have any problems with getting these files you can send an email to info@swingsoftware.com and we will send them to you. 

Documentation

Once you have set the required libraries to the CLASSPATH you will need some documentation on how to proceed with coding. The entire API is located in the swpdfc-2.0.0.jar, which in turn is located in the com.swsoftware.pdfc.api package. This is the only package you will need to import.

For complete details about the SWING PDF Converter Java class library, click below to view the javadoc-style API reference:

Examples

To help you get a quick head start, we created several examples of using the APIs. Feel free to analyze, use or change them as you require.
For your convenience, all of the examples have been put into a single JAR archive which can be downloaded here.

Known issues and restrictions

  • Office file attachments (e.g. doc, xls, odt, ods) can only be attached in their native format
  • Other issues that may apply to SWING PDF Converter for Lotus Notes

ċ
swpdfc-2-API.jar
(6k)
Mario Pavić,
Sep 10, 2010, 7:18 AM
Comments