Here is example code to demonstrate how to convert a Notes Document Collection to PDF package.
/** SWING Software 2010 * http://www.swingsoftware.com * * This sample demonstrates how you can use SWING PDF Converter JAVA API * to convert a Lotus Notes Document collection to a single PDF file called PDF Package or PDF portfolio. */
package com.swsoftware.pdfc.api.samples;
import com.swsoftware.pdfc.api.*; import lotus.domino.*;
public class DocCollectionConvert {
public static void main(String[] args) {
Session s; String server, dbPath, viewName ; DocumentCollection ndc = null;
try { NotesThread.sinitThread(); // Your notes ID password so a session can be created s = NotesFactory.createSessionWithFullAccess("<YOUR PASSWORD>"); server = "sw01" ; dbPath = "Project\\PDF Converter\\Ver 2\\PDFConverter.nsf" ; viewName = "Samples" ;
SwPDFCreator pdfc = new SwPDFCreator(s); SwPDFDocument pdfDoc ; if (pdfc.init("<LICENCE KEY>")) { // if the license key is valid
ndc = s.getDatabase(server, dbPath).getView(viewName).getAllDocumentsByKey("");
if (ndc != null && ndc.getCount()> 1){
pdfDoc = pdfc.processDocCollection(ndc, viewName); System.out.println("File saved to: " + pdfDoc.SaveToFile("C:\\result.pdf")); } }
//Cleanup if (ndc != null) ndc.recycle(); ndc = null; if (s != null) s.recycle(); s = null; pdfc = null; pdfDoc = null;
} catch (NotesException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } finally{ NotesThread.stermThread(); } } }
|