Standalone Edition - Java API to silent print and convert existing documents from standalone server applications

Silent Print document and Convert to TIFF, PostScript documents and images such as PNG, BMP, GIF, JPG/JPEG and more.

NOTE: You DO NOT need any other software to Print, View and Convert your documents.


  • About Server API
  • What archive to download?
  • Typing the URL of your document
  • Run samples
  • Jar Files
  • Silent print Document
  • Silent printing Parameters
  • Convert documents - between formats such as PDF, TIFF, PostScript, PNG, BMP, GIF, JPEG/JPG and more
  • Conversion - Examples

  • About Server API

    Standalone edition supports:

  • Printing - of exiting documents
  • Conversion - of documents from one file format to other file formats
  • Standalone edition lets you silent print of an existing documents. It lets you convert your document to other file formats such as TIFF and Post Script (PS). You can convert your files to image formats such as PNG, GIF, JPG, JPEG, BMP, and more. When converting the documents to image formats the output images may be produced with a different resolution (smaller or larger than the actul page size) ones. For example, to show a thumbnail image of a page you can create a small image of a page. For clear view of the page, you can create an enlarged picture of a page.

    Your document can be a local file, a remote URL or a web server page that dynamically generates a document.

    Back to Top
    What archive to download?

    Visit our website and download appropriate standalone edition of the document file format archive. After downloading unzip the ZIP archive to a local folder (let us say c:/XXX/).

    Back to Top
    Typing the URL of your document

    Input 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:

  • Window: file:///c:/XXX/sample.XXX or file:/c:/XXX/sample.XXX
  • Mac OS: file:Macintosh HD/XXX/sample.XXX
  • Unix/Linux: file:///tmp/XXX/sample.XXX
  • Examples of typing remote URL:

  • HTTP: http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX
  • HTTPS: https://www.paypal.com/en_US/XXX/PP_Sandbox_UserGuide.XXX
  • FTP: ftp://ftp.eia.doe.gov/pub/oiaf/1605/cdrom/XXX/ggrpt/057306.XXX
  • Back to Top
    Run samples

    There are executable script files (.bat and .sh) for each of the demo JAVA sample in the "examples" directory. For *2ResizedPngDemo.java sample there is a *2ResizedPngDemo.bat (for Windows) and a *2ResizedPngDemo.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 are some sample documents sampleN.xxx in the "installation/ProductDirectory/bin" directory.

    Back to Top
    Jar Files

    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
    Silent printing documents

    SilentPrintXXX - is the class you use for silent printing of a document.

    Creating a silent printing instance

    /////File: SilentPrintDemo.java//////////////
    
    public class SilentPrintDemo {
      public static void main(String[] args) {
        //...
        //Silent print instance
        SilentPrint silentPrint = new SilentPrintXXX();
        //...
      }
    }
    //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, "DCSilentPrint");
        //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.xxx.*DocListener");  //xxx=pdfprint, tiff etc. and *=Tiff, Pdf etc. Look for the Java class in the particular product
        //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 document 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.

    Back to Top
    Silent printing parameters

    Details of the parameter name and its possible values are listed here.

    Back to Top
    Silent printing code samples

    There 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 Top
    Convert documents - between formats such as PDF, TIFF, PostScript, PNG, BMP, GIF, JPEG/JPG and more

    Your document can be converted to these formats:

    Document formats

  • PDF
  • RTF
  • TIFF with compressions (NONE|PACKBITS|GROUP4|JPEG_TTN2|DEFLATE)
  • PostScript (PS)
  • Image formats

  • PNG
  • GIF
  • BMP
  • JPEG/JPG
  • Back to Top
    Conversion - Examples

    There are some document samples 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