Here is a sample that shows how to create separate PDF files from a document collection and save the to a folder. Each PDF represents a single notes document from the collection.
/** SWING Software * http:// www.swingsoftware.com * * This example demonstrates how you can convert a notes document collection, using SWING PDF Converter JAVA API, * to a set of single PDF documents. Each generated PDF file represents a conversion of a notes document from collection */ package com.swsoftware.pdfc.api.samples;
import java.io.File;
import com.swsoftware.pdfc.api.*; import lotus.domino.*;
public class DocCollectionConvertToFolder { 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" ; File folderPath = new File("C:\\temp");
SwPDFCreator pdfc = new SwPDFCreator(s);
ndc = s.getDatabase(server, dbPath).getView(viewName).getAllDocumentsByKey("");
if (pdfc.init("<LICENSE KEY>")) { // if the license key is valid
pdfc.processDocCollection(ndc, folderPath); System.out.println("Files saved to: " + folderPath.getPath() ); }
//Cleanup if (ndc != null) ndc.recycle(); ndc = null;
if (s != null) s.recycle(); s = null; pdfc = null;
} catch (NotesException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } finally{ NotesThread.stermThread(); }
} }
|