NOTE: You DO NOT need any other software to Print, View and Convert your PDF documents.
SmartJPrint server edition supports:
Your PDF can be a local file or a remote file or a server page that dynamically generates a PDF.
Back to TopVisit our website and download server version of the PDF archive. After downloading unzip this ZIP archive to a local folder (let us say c:/pdf/).
Back to TopInput an URL and does not matter if the document is located in local file system, in a remote web server or a server program that dynamically generate one. An URL with appropriate URL syntax is all that required for printing or viewing it.
Examples of typing a local file URL:
file:///c:/pdf/sample.pdf or file:/c:/pdf/sample.pdf
file:Macintosh HD/pdf/sample.pdf
file:///tmp/pdf/sample.pdf
Examples of typing remote URL:
http://www.activetree.com/jprint/demo/sample_pdf/sample1.pdf
https://www.paypal.com/en_US/pdf/PP_Sandbox_UserGuide.pdf
ftp://ftp.eia.doe.gov/pub/oiaf/1605/cdrom/pdf/ggrpt/057306.pdf
There is an executable script file (.bat
and .sh
) for each of the demo JAVA sample in the "examples"
directory. For Pdf2ResizedPngDemo.java
sample there is a Pdf2ResizedPngDemo.bat
(for Windows) and a Pdf2ResizedPngDemo.sh
(for Unix/Linux)
in the installation/ProductDirectory/bin/converter/
directory.
For running these *.bat
or *.sh
script files open a command shell, go to the
directory where this script are located, then simply type one of the script file name and press enter.
It will show you the "Usage" help for further trying the same but with the command line arguments.
There is a sample PDF file sample1.pdf
in the
"installation/ProductDirectory/bin"
directory.
Include all jar files except the demo jars in your classpath if you are running your own code sample. Otherwise, include all jars including the demo jars in the classpath.
Back to Top
SilentPrintPdf
- is the class you use for silent printing of a PDF document.
Creating a silent printing instance
/////File: SilentPrintDemo.java////////////// import com.activetree.common.print.SilentPrint; import com.activetree.pdfprint.SilentPrintPdf; public class SilentPrintDemo { public static void main(String[] args) { //... //Silent print instance SilentPrint silentPrint = new SilentPrintPdf(); //... } } //End of file
Setting parameters
Silent print parameters are set by calling
setAttribute(String param, Object paramValue)
on the printer class.
Examples of setting parameters
//default media size String paperSize = "(0, 0, 0, 0, 612, 792)"; silentPrint.setAttribute(SilentPrint.PAPER, paperSize); //printer to print PrintService defaultPrintService = PrintServiceLookup.lookupDefaultPrintService(); String printerName = defaultPrintService.getName(); silentPrint.setAttribute(SilentPrint.PRINTER_NAME, printerName); //auto rotate and center silentPrint.setAttribute(SilentPrint.AUTO_ROTATE_AND_CENTER, Boolean.TRUE); //page scaling silentPrint.setAttribute(SilentPrint.PAGE_SCALING, SilentPrint.FIT_TO_PRINTABLE_AREA); //collate silentPrint.setAttribute(SilentPrint.COLLATE_COPIES, Boolean.TRUE); //copies defaut 1; can make it to N copies silentPrint.setAttribute(SilentPrint.COPIES, new Integer(1)); //debug it //silentPrint.setAttribute(SilentPrint.DEBUG, Boolean.TRUE); //job name silentPrint.setAttribute(SilentPrint.JOB_NAME, "PDFSilentPrint"); //document silentPrint.setAttribute(SilentPrint.DOC_LIST, docList); //Add a docListener //must have a default constructor for this class. silentPrint.setAttribute(SilentPrint.DOC_LISTENER, "demo.activetree.pdfprint.PdfDocListener"); //doc password protected if any silentPrint.setAttribute(SilentPrint.PASSWORD, docPassword); //url protection if any silentPrint.setAttribute(SilentPrint.URL_AUTH_ID, urlAuthId); silentPrint.setAttribute(SilentPrint.URL_AUTH_PASSWORD, urlAuthPassword); //Now start the process try { silentPrint.start(); }catch(Throwable t) { t.printStackTrace(); }
Demo Java source files
Look at the demo source files under installation/bin/print/
for printing
and installation/bin/converter/
for conversion demo samples.
Silent print PDF bytes[] content
DOC_LIST parameter is always used for for setting content to be printed. Create a
java.util.List
object with each element the byte[]
content of the document. Follow the examples in the downloaded archive.
Details of the parameter name and its possible values are listed here.
Back to TopThere are several working code samples in the downloaded server archive in the "examples" directory. In the "bin" directory, for each of the code sample there is a Windows batch file (.bat) and an equivalent UNIX/LINUX shell scrip file (.sh) for running it.
Back to TopYour PDF can be converted to these formats:
Document formats
Image formats
There are some PDF server examples in the downloaded server archive in its "examples"
directory. We suggest you to take a look in these Java sample files and if necessary create your own
custom server programs.
All conversion sample code has a corresponding BAT and SH script file in the "bin/converter" directory.
Back to Top
Copyright © Activetree, Inc. All rights reserved.
Web: http://www.activetree.com
Email: sales@activetree.com
Tel: +1 408-791-8036 Fax: +1 408-716-8450