2.4.2. Notes Document Collection Conversion

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 {


                  // Your notes ID password so a session can be created

                  s = NotesFactory.createSessionWithFullAccess("<YOUR PASSWORD>");
                  // the name of the server at which the database that contains the document collection being converted resides

                  server = "sw01"
                  //database path to notes database that contains document collection

                  dbPath = "Project\\PDF Converter\\Ver 2\\PDFConverter.nsf" ;
                  // Name of the Notes view that we will use to build a document collection    

                  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){

// Convert Notes document collection to PDF from a view specified by viewName

                           pdfDoc =  pdfc.processDocCollection(ndc, viewName);

                           System.out.println("File saved to: " + pdfDoc.SaveToFile("C:\\result.pdf"));





                  if (ndc != null) ndc.recycle();

                  ndc = null;

                  if (s != null) s.recycle();

                  s = null;

                  pdfc = null;

                  pdfDoc = null;


            } catch (NotesException e) {


            } catch (Exception e) {


            } finally{