Silent Print and View Documents and Reports from Web Browser

100% pure Java API for Document Printing, Viewing, Convertion from web browser. Convert existing documents such as TIFF, Post Script and images such as PNG, BMP, GIF, JPEG/JPG and more from one format to another format.


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

  • About
  • Does it require any other third-party software?
  • Download Silent Print Document from Browser WAR file
  • INSTALL WAR (Estimated time: 30 minutes)
  • Typing the URL of your existing document
  • My document is generated dynamically from calling an URL
  • Password protected document
  • View document in browser window
  • Silent print document from browser window
  • Secure silent printing
  • Job tracking
  • DEMO Samples in this archive

  • About

    This tutorial is aimed for "silent printing and viewing of documents from web browser" without the need of any software and installation. Visit out website for other editions for Server/J2EE and desktop applications. This is a web application archive ready for deployment in a web container. This archive is aimed at silent printing and viewing of documents (existing or dynamically generated from a server program) located anywhere in the world.

    Back to Top
    Does this software require any other third-party software?

    No.
    This web application is a self sufficient WAR archive and does not require any other third-party software. Simply deploy it and access the start page.

    Back to Top
    Download Silent Print From Browser WAR (Web Application Archive) File

    Visit our web site and download "silent print XXX from browser" archive. When you click on the download link your browser might prompt to "Save As..." a ".zip" extension which you must change to ".war". Alternatively, you can save first and later rename to change the extension to ".war" file.

    Back to Top
    Installing WAR sample

    This WAR archive is a self sufficient web application archive ready to be deployed under any web container.

    [NOTE: - Let us say the downloaded WAR file is saved as (renamed to): silent_print_XXX_from_browser.war]

    Here are some examples of how to deploy Silent Print XXX From Browser WAR (Web Application Archive) archive:

    These are not the only web servers to deploy. You can deploy it to any other web server of your choice. These are just examples.
    JBoss: Copy to installation/server/default/deploy directory.
    Tomcat: Copy it to the installation/webapps/ directory.
    BEA WebLogic/IBM WebSphere: Logon to admin console and choose to deploy an existing WAR file which will let you select this WAR file located in any folder.

    When web server deploy it will create a directory (called context path) that is the name of the WAR file (excluding the .war part).

    Steps: in installing and running silent printing and viewing XXX document from browser application

    1. Install the WEB (WAR) application
    Download this WAR (web application archive), rename it to "silent_print_XXX_from_browser.war", and deploy it under your J2EE web container. Therefore your web context path to the start page is "silent_print_XXX_from_browser".

    2. TEST: if your installation is OK.
    To test if your installation is ok try to print a sample XXX document by simply typing this URL on the location filed on your browser and pressing ENTER key (NOTE: replace PROTOCOL, HOST, and PORT). Examples next to them might also help you.

    Print XXX Document
    PROTOCOL://HOST:PORT/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]
    If your server not JSP enabled may try ASP or PHP
    PROTOCOL://HOST:PORT/silent_print_XXX_from_browser/silent_print_XXX.asp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]
    Or PHP
    PROTOCOL://HOST:PORT/silent_print_XXX_from_browser/silent_print_XXX.php?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]

    Example (Print XXX Document):
    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]
    Or (ASP)
    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.asp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]
    Or (PHP)
    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.php?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]

    View XXX Document
    PROTOCOL://HOST:PORT/silent_print_XXX_from_browser/view_XXX.jsp?DOCUMENT=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]
    Or (ASP)
    PROTOCOL://HOST:PORT/silent_print_XXX_from_browser/view_XXX.asp?DOCUMENT=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]
    Or (PHP)
    PROTOCOL://HOST:PORT/silent_print_XXX_from_browser/view_XXX.php?DOCUMENT=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]

    Example (View XXX Document):
    http://www.activetree.com/silent_print_XXX_from_browser/view_XXX.jsp?DOCUMENT=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]

    3. Try DEMO Samples
    Run demo samples and view the tutorial from your installation. This web application has few demo samples and the link to each of them is in the start page. Sample scripts (e.g. JSP files) are part of the WAR installation in the "demo" directory. Go to your installation and find the "demo" directory under which you will find JSP sample programs.

    Now run the demo start page (NOTE: replace PROTOCOL, HOST and PORT)
    PROTOCOL://HOST:PORT/silent_print_XXX_from_browser/

    Tutorial
    Start page also has a link to the tutorial to learn more about the application.

    Back to Top
    Typing the URL of your existing XXX 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/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
    My XXX Document is generated dynamically from calling an URL

    It is just like any other URL. Here is an example of a JSP report generation URL generates a report and converts it to a XXX Document format. The output form this URL is therefore a XXX document and can be viewed or silent printed like any other URL pointing to an existing XXX format Document.

    http://www.activetree.com/silent_print_report_from_browser/doc_generator.jsp

    Back to Top
    Password protected XXX format document

    It lets you specify a password for those password protected documents. See parameter table next to know more about how to provide password for the XXX format document URL.

    Back to Top
    View XXX format document in browser window

    Calling the XXX format document viewer URL with a XXX document as argument will display it in the browser window. There are JSP and PHP script files to call for printing or viewing. In this tutorial we will use the JSP script in our examples.

    XXX format document viewer URL to call

    Downloaded archive silent_print_XXX_from_browser.war has few JSP and PHP scripts to call. For viewing a XXX format document use the viewer view_XXX.jsp or XXX_viewer.jsp. It requires a minimum of one parameter is the XXX format document.

    Here is how the XXX format document viewer URL looks like: http://host:port/silent_print_XXX_from_browser/view_XXX.jsp

    Here is an example: http://www.activetree.com/silent_print_XXX_from_browser/view_XXX.jsp?DOCUMENT=[DocURL]

    Back to Top
    Parameters to the XXX format document viewer URL

    Pass one or more of these parameters to the view_XXX.jsp or XXX_viewer.jsp.

    Parameter name Possible values Details
    DOCUMENT String A string pointing to an existing XXX format document or an URL that can dynamically generate a XXX format document for viewing.
    Example: [http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX] or a server program produce a XXX format document dynamically.

    [http://www.activetree.com/silent_print_report_from_browser/doc_generator.jsp]

    If the XXX format document is generated dynamically from a server program may require parameters. This is how one can add the parameters and values using the standard URL systax.

    [http://www.myhost.com/silent_print_report_from_browser/dynamic_XXX.jsp?param1=value1&param2=value2...&paramN=valueN]

    This is how a XXX format document viewer URL for such parameterized XXX format document generator program may be constructed.

    http://www.activetree.com/silent_print_XXX_from_browser/view_XXX.jsp?DOCUMENT=[http://www.myhost.com/silent_print_report_from_browser/dynamic_XXX.jsp?param1=value1&param2=value2...&paramN=valueN]

    PASSWORD String Only applicable for those password protected documents. You may or may not pass a value for this parameter. If the document is NOT a password protected a value passed for it will be ignored.

    Back to Top
    XXX format document viewing examples

    These examples are pointing to an existing deployment.
    DetailsURL
    Existing XXX format documenthttp://www.activetree.com/silent_print_XXX_from_browser/view_XXX.jsp?DOCUMENT=http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX
    URL that generates a XXX format document dynamicallyhttp://www.activetree.com/silent_print_XXX_from_browser/view_XXX.jsp?DOCUMENT=http://www.activetree.com/silent_print_report_from_browser/doc_generator.jsp
    Password protected XXX format documenthttp://www.activetree.com/silent_print_XXX_from_browser/view_XXX.jsp?DOCUMENT=http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX&PASSWORD=myDocPassword

    Back to Top
    Silent print XXX format document from browser window

    This web archive lets you 'silent print' an existing XXX format document or dynamically generated from an URL to a printer. Learn more next about the parameters with examples about how you can control "silent print" XXX format document.

    Back to Top
    Silent print URL to call

    You call silent_print_XXX.jsp script from this web application with one or more parameters to it.

    Back to Top
    Silent print examples

    For understanding this web application we'll use silent_print_XXX.jsp script from a deployment in our website. We'll pass one or more parameters to this URL in order to control silent printing. At least one parameter is required for silent printing is a XXX format document (static or dynamically generated from an URL).

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp

    Here is what it looks like when typing the URL for silent printing.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[doc1][doc2][docN]

    See the examples next. Back to Top
    Silent print single XXX format document

    DOC_LIST is the parameter to use for specifying the DOCs to print. This parameter is always enclosed with a leading "[" and a trailing "]" character. This example is going to silent print an existing XXX format docs http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX from a remote web site.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]

    Back to Top
    Silent print multiple XXX format files

    DOC_LIST is still is the parameter name for printing multiple XXX format files. Each XXX format file must be separated by "[" and "]" characters. In this example URL we are printing two XXX format files:
    http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX and http://www.activetree.com/silent_print_report_from_browser/doc_generator.jsp

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX][http://www.activetree.com/silent_print_report_from_browser/doc_generator.jsp]

    Back to Top
    Job name

    Job name is controlled using JOB_NAME name parameter. This example is using "DCPrintJob" is the job name for this parameter.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]&JOB_NAME=DCPrintJob

    Back to Top
    Page Scaling

    This is controlled by PAGE_SCALING parameter. Each page area may be different than the media printable area. Therefore it is important to set this flag in order to get the desired output. Following are the accepted values:
    - NONE if applied page content is not scaled to fit to the media size and orientation.
    - FIT_TO_PRINTABLE_AREA is used for page content to always get scaled to fit to the media printable area. If the printable area is smaller than the page content it will shrink the page content to fit to the printable area. On the other hand if the media printable area is larger than the page content it will expand the content to fit to the printable area.
    - SHRINK_TO_PRINTABLE_AREA is same as FIT_TO_PRINTABLE_AREA except that if the media printable area is larger than the page content it will not expand the page content to fit to the printable area. Otherwise it will shrink the page content to fit to the media printable area.

    Default value is set to FIT_TO_PRINTABLE_AREA.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]&JOB_NAME=DCPrintJob&PAGE_SCALING=FIT_TO_PRINTABLE_AREA&AUTO_ROTATE_AND_CENTER=true

    Back to Top
    Auto Rotate and Center

    This is a boolean "true" or "false" flag used to indicate whether or not to automatically rotate and center the document page content to the media printable area. A media printable area may not be of exact match with the document page size. Even if the size of the media is same but the orientation may be different. This flag therefore ensures you to automatically re-orient and center the content to the media printable area if this flag is set to "true". This flag works with the PAGE_SCALING parameter. Value "false" for this flag only effective if the value of PAGE_SCALING parameter is NONE. All other value of page scaling will have no effect on this flag and a value "true" will be used (even if you have set it to "false").

    Default value is set to true.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]&JOB_NAME=DCPrintJob&PAGE_SCALING=NONE&AUTO_ROTATE_AND_CENTER=false

    Back to Top
    Paper selection

    PAPER - parameter is used with a paper size value for which should look like "(widthInPixel, heightInPixel)". For an NA_LETTER paper it will be PAPER=(612,792) where paper width is 612 pixels and height is 792 pixels.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]&JOB_NAME=DCPrintJob&PAGE_SCALING=FIT_TO_PRINTABLE_AREA&AUTO_ROTATE_AND_CENTER=true&PAPER=(612,792)

    Back to Top
    Automatic paper matching (Choose paper size by document page size)

    AUTO_MATCH_PAPER can be set to true or false. If set to true it will take each document page size and find a matched paper size looking into ISO paper size list. If found it will use that paper size, otherwise, it will use the paper size you specify with the PAPER flag. If document page size is not matched for auto-paper size match and you have not specified a PAPER size it will use a default paper size. We suggest you provide a default paper size using the PAPER parameter.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]&JOB_NAME=DCPrintJob&PAGE_SCALING=FIT_TO_PRINTABLE_AREA&AUTO_ROTATE_AND_CENTER=true&PAPER=(612,792)&AUTO_MATCH_PAPER=true

    Back to Top
    Password protected documents

    PASSWORD parameter is used for setting the password for those documents such as PDFs. Only one password is supported even when you are printing multiple XXX format files. We therefore suggest, if you are printing multiple XXX format files where more than one XXX format document is password protected print one document at a time.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]&JOB_NAME=DCPrintJob&PAGE_SCALING=FIT_TO_PRINTABLE_AREA&AUTO_ROTATE_AND_CENTER=true&PAPER=(612,792)&AUTO_MATCH_PAPER=true&PASSWORD=myDocPassword

    Back to Top
    Password protected URL

    The document URL (or the URL dynamically producing the document) might be password protected in the web server. Web server therefore requires a access USER NAME and PASSWORD (Note: this is different from document PASSWORD).

    Following parameters are used for accessing the password protected URL:
    URL_AUTH_ID - user name (or ID) for the protected URL.
    URL_AUTH_PASSWORD - user password for the protected URL.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]&JOB_NAME=DCPrintJob&PAGE_SCALING=FIT_TO_PRINTABLE_AREA&AUTO_ROTATE_AND_CENTER=true&PAPER=(612,792)&AUTO_MATCH_PAPER=true&PASSWORD=myDocPassword&URL_AUTH_ID=urlAuthId&URL_AUTH_PASSWORD=urlAuthPassword

    Back to Top
    Print to default printer

    There are no flag to print to a default printer. However, if you want to print to a named printer look for PRINTER_NAME and PRINTER_NAME_SUBSTRING_MATCH parameters next.

    Back to Top
    Print to a particular printer

    PRINTER_NAME and PRINTER_NAME_SUBSTRING_MATCH parameters are used in combination to print to a particular printer identified by a name. PRINTER_NAME value is either full name of the printer or a substring of it. On the other hand PRINTER_NAME_SUBSTRING_MATCH tells whether or not API should look for a printer that is of exact match (value if false) with the string in PRINTER_NAME or API should try to find a printer taking the PRINTER_NAME value and do a substring match (value if true) with all the available printers. If it do not find a matched printer using these two parameters it will print to default printer.

    In this example PRINTER_NAME=HP LaserJet 4200 PCL&PRINTER_NAME_SUBSTRING_MATCH=false used to indicate that an exact match should be performed for finding a printer named "HP LaserJet 4200 PCL". When PRINTER_NAME_SUBSTRING_MATCH=true the first printer found using a substring match will be used even there are other printer name might match this substring.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]&JOB_NAME=DCPrintJob&PAGE_SCALING=FIT_TO_PRINTABLE_AREA&PAPER=(612,792)&AUTO_MATCH_PAPER=true&PASSWORD=myDocPassword&PRINT_QUALITY=High&PRINTER_NAME=HP LaserJet 4200 PCL&PRINTER_NAME_SUBSTRING_MATCH=false

    Back to Top
    Print quality

    PRINT_QUALITY parameter is used for setting the printout quality. Possible values are High, Normal and Draft. For laser printers this parameter may not make any difference in output quality. It is important for other kinds of printer such as a thermal printer.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]&JOB_NAME=DCPrintJob&PAGE_SCALING=FIT_TO_PRINTABLE_AREA&PAPER=(612,792)&AUTO_MATCH_PAPER=true&PASSWORD=myDocPassword&PRINT_QUALITY=High

    Back to Top
    Media side to print (e.g. One Side, Duplex)

    SIDE_TO_PRINT parameter is used for this purpose. Possible values are ONE_SIDED, DUPLEX, TUMBLE, TWO_SIDED_LONG_EDGE, or TWO_SIDED_SHORT_EDGE. Actual outcome for this parameter will depend on whether or not the printer supports it. In this example a value of DUPLEX is used with the expectation that the output be printed on both sides of the pages. Duplex mode saves paper and is recommended if your printer support it.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]&JOB_NAME=DCPrintJob&PAGE_SCALING=FIT_TO_PRINTABLE_AREA&PAPER=(612,792)&AUTO_MATCH_PAPER=true&PASSWORD=myDocPassword&PRINT_QUALITY=High&SIDE_TO_PRINT=DUPLEX

    Back to Top
    Use printer margins

    IS_USE_PRINTER_MARGINS parameter is used for validating the paper size with the printer. A printer might be configured to keep certain amount of margins around the page. XXX format document content if printed ignoring this margins it might produce the content near the boundary of the paper is cut off. Set this flag to true if you want to use the printer margins, otherwise, set this flag to false. Default value is true.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]&JOB_NAME=DCPrintJob&PAGE_SCALING=FIT_TO_PRINTABLE_AREA&PAPER=(612,792)&AUTO_MATCH_PAPER=true&IS_USE_PRINTER_MARGINS=true

    Back to Top
    Copies

    COPIES parameter takes an integer number as the number of copies to be printed. Default value is 1 copy. This example is using COPIES=2 for printing 2 copies.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]&JOB_NAME=DCPrintJob&PAGE_SCALING=FIT_TO_PRINTABLE_AREA&PAPER=(612,792)&AUTO_MATCH_PAPER=true&IS_USE_PRINTER_MARGINS=true&COPIES=2

    Back to Top
    Collate copies

    COLLATE_COPIES parameter takes boolean true if you want the copies to be collated false otherwise. This is used when printing multiple copies. Default value for this parameter is true.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]&JOB_NAME=DCPrintJob&PAGE_SCALING=FIT_TO_PRINTABLE_AREA&PAPER=(612,792)&AUTO_MATCH_PAPER=true&IS_USE_PRINTER_MARGINS=true&COPIES=2&COLLATE_COPIES=true

    Back to Top
    Single print job (applicable when printing multiple XXX format documents)

    SINGLE_PRINT_JOB parameter takes boolean true if you want all the DOC_LIST documents be printed as one print job, false otherwise. This is used when printing multiple XXX format documents. One print job will cause the API to put together pages from all of the XXX format documents and print them together as one document. If this flag it set to false it will print each XXX format document as one print job post fixed with a number.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX][http://www.activetree.com/silent_print_report_from_browser/doc_generator.jsp]&SINGLE_PRINT_JOB=true

    Back to Top
    Show print setup dialog (non silent mode)

    SHOW_PRINT_DIALOG parameter can be set to true if you want to select all of these printing parameters from a dialog window, false otherwise. This flag makes the printing non-silent since it will wait for user input before printing. Moreover it will ignore all the parameter values and will use what user select from this dialog. Only parameter API will use from the URL parameters is the PASSWORD value.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]&PASSWORD=myDocPassword&SHOW_PRINT_DIALOG=true

    Back to Top
    Showing print error message dialog (if error occurs)

    SHOW_PRINT_ERROR_DIALOG parameter if true shows a dialog displaying any kind of printing error if any, false otherwise. Error dialog is shown only if there are printing errors. Default value is true. This example set this flag to false so no dialogs are shown. (See DEBUG parameter later in this tutorial to trace the printing debug messages).

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]&JOB_NAME=DCPrintJob&PAGE_SCALING=FIT_TO_PRINTABLE_AREA&PAPER=(612,792)&AUTO_MATCH_PAPER=true&IS_USE_PRINTER_MARGINS=true&SHOW_PRINT_ERROR_DIALOG=false

    Back to Top
    Enable print status message

    STATUS_UPDATE_ENABLED parameter if true it shows messages in the browser window while printing is happening. Messages such as documents to print, total number of pages, printer it is printing to etc. are displayed when printing is in progress. Default value is true. When you run without this parameter it will display messages in the browser window. Set this to false if do not want to see any messages in the browser window.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]&JOB_NAME=DCPrintJob&PAGE_SCALING=FIT_TO_PRINTABLE_AREA&PAPER=(612,792)&AUTO_MATCH_PAPER=true&IS_USE_PRINTER_MARGINS=true&SHOW_PRINT_ERROR_DIALOG=false&STATUS_UPDATE_ENABLED=false

    Back to Top
    Debug (Output messages to Java console)

    DEBUG parameter if true it shows API debug messages in the Java console window while printing is in progress. This is helpful for the end user as well as developers when trying to print and report a problem if any. This example is using a value false for not recording any debug messages. Default value is set to true.

    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample1.XXX]&JOB_NAME=DCPrintJob&PAGE_SCALING=FIT_TO_PRINTABLE_AREA&PAPER=(612,792)&AUTO_MATCH_PAPER=true&IS_USE_PRINTER_MARGINS=true&SHOW_PRINT_ERROR_DIALOG=false&STATUS_UPDATE_ENABLED=false&DEBUG=false

    Back to Top
    Secure silent print from browser

    Processing a web document may involve crossing many different security parameters before any success to print, view or other processing may take place. While maintaining security of the data is essential, processing them is a requirement. This product has established a framework that enables one not to disclose the access security parameters in advance. They may be provided when the document is attempted to access at run time using a callback server program of your choice.

    If the user is accessing a secured document the callback server program may set them and reply back to the browser client. Security information such as document security password, URL protection ID and password are some of the document authorization parameters may be set through the callback server program.

    In addition to providing document access parameters one may not disclose the actual document location and its identity in advance. Instead, the real document location URL (file etc) may be kept hidden and a ID may be set as the document. Callback server program of choice may set the actual document URL or the byte[] content of the document in the browser client reply map.

    Once a document is silent printed (and/or done viewing) a success page may be shown to the end user. Similarly, a failure page may be shown in case of a failure has happened.

    In summary, one can have complete control over internet document processing by way of:

  • not disclosing the real document in advance,
  • ability to provide the document access information at runtime through the callback server program of choice, and
  • tracking the user access on a document and allowing or denying access to it.
  • How it works?

    Everything start on user hitting a URL on a browser page resulting a call to the callback server program along with all the URL parameters and values submitted to the server. Callback server program has to read the required parameters including the DOCUMENT or DOCL_LIST parameter that identifies the document.

    Next steps are things like:
    - in the server program check if the user is allowed for such access
    - set the document access parameter values such as PASSWORD, URL_AUTH_ID, URL_AUTH_PASSWORD etc.
    - set the DOCUMENT or DOC_LIST parameter value if an ID was used in the browser URL. Content may be set as byte[] after reading it from a source such as database, URL, or other source
    - send the reply back to client for processing it

    You may cancel the job from the server program by simply setting JOB_STATUS to "CANCELED" or "FAILED". Client will read the reply status and process it accordingly.

    A page may be displayed depending on success or failure and if URLs for such action is specified in the URL parameter.

    If one choose to hide the documents real location or its content from the user, may choose to use an ID as the document (e.g. DOC_LIST=[docid-123456]) and set the real content byte[] or document URL during a callback to the server program.

    Demo - there is a demo in the downloaded WAR archive or may run the online silent secure print demo.

    Specifying a callback server program

    SERVER_CALL_BACK_URL - A HREF value (i.e. URL) may be provided for this parameter that will be called at run time. All parameters is going to be made available to the server URL for knowing the document and allow access to it by way of providing all security and other information it might need for its opening. Callback program may simply deny access to this program by not providing the access information or simply setting an empty DOCUMENT or DOC_LIST content to the attribute map it replies back for client.

    Examples:
    SERVER_CALL_BACK_URL=http://www.activetree.com/silent_print_XXX_from_browser/demo/server.jsp

    Complete example:
    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample2.XXX]&SERVER_CALL_BACK_URL=http://www.activetree.com/silent_print_XXX_from_browser/demo/server.jsp

    Showing success page

    - ON_SUCCESS_SHOW_PAGE - parameter may be set to an URL for opening it on successful completion of the task.
    - ON_SUCCESS_PAGE_TARGET - parameter is for setting target; e.g. in a new blank window "_blank", in a new titled window (e.g. a title "Job success window") etc.

    Examples:
    ON_SUCCESS_SHOW_PAGE=http://www.activetree.com/silent_print_XXX_from_browser/demo/success.jsp&ON_SUCCESS_PAGE_TARGET=_blank

    Complete example:
    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample2.XXX]&SERVER_CALL_BACK_URL=http://www.activetree.com/silent_print_XXX_from_browser/demo/server.jsp&ON_SUCCESS_SHOW_PAGE=http://www.activetree.com/silent_print_XXX_from_browser/demo/success.jsp&ON_SUCCESS_PAGE_TARGET=_blank

    Showing a failure/error page

    - ON_FAILURE_SHOW_PAGE - parameter may be set to an URL for opening it on failure in processing document.
    - ON_FAILURE_PAGE_TARGET - parameter is for setting target window where the failure page will be opened.

    Examples:
    ON_FAILURE_SHOW_PAGE=http://www.activetree.com/silent_print_XXX_from_browser/demo/failure.jsp&ON_FAILURE_PAGE_TARGET=_blank

    Complete example:
    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample2.XXX]&SERVER_CALL_BACK_URL=http://www.activetree.com/silent_print_XXX_from_browser/demo/server.jsp&ON_FAILURE_SHOW_PAGE=http://www.activetree.com/silent_print_XXX_from_browser/demo/failure.jsp&ON_FAILURE_PAGE_TARGET=_blank

    End user preview before printing

    You may provide a preview option for user to read and review the document before accepting it for processing. Following parameters used for a preview before processing:
    - IS_SHOW_PRINT_PREVIEW - value is true or false.
    - VIEWER_PAGE - view page; e.g. view_XXX.jsp (or XXX_viewer.jsp) - name of the viewer page relative to the location of "silent_print_XXX.jsp" page.
    - VIEWER_CONTROLS - The controls one wants the viewer to show during the preview operation. For example, user may want to browse the pages, want to see number of pages and do a silent print it.

    Examples:

    IS_SHOW_PRINT_PREVIEW=true&VIEWER_PAGE=view_XXX.jsp&VIEWER_CONTROLS=SILENT_PRINT_BUTTON, SILENT_PRINT_BUTTON, FIRST_PAGE_BUTTON, NEXT_PAGE_BUTTON, PREVIOUS_PAGE_BUTTON, LAST_PAGE_BUTTON, GO_TO_A_PAGE_FIELD, TOTAL_PAGE_LABEL

    Complete example:
    http://www.activetree.com/silent_print_XXX_from_browser/silent_print_XXX.jsp?DOC_LIST=[http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample2.XXX]&SERVER_CALL_BACK_URL=http://www.activetree.com/silent_print_XXX_from_browser/demo/server.jsp&ON_SUCCESS_SHOW_PAGE=http://www.activetree.com/silent_print_XXX_from_browser/demo/success.jsp&ON_SUCCESS_PAGE_TARGET=_blank&ON_FAILURE_SHOW_PAGE=http://www.activetree.com/silent_print_XXX_from_browser/demo/failure.jsp&ON_FAILURE_PAGE_TARGET=_blank&IS_SHOW_PRINT_PREVIEW=true&VIEWER_PAGE=view_XXX.jsp&VIEWER_CONTROLS=SILENT_PRINT_BUTTON, SILENT_PRINT_BUTTON, FIRST_PAGE_BUTTON, NEXT_PAGE_BUTTON, PREVIOUS_PAGE_BUTTON, LAST_PAGE_BUTTON, GO_TO_A_PAGE_FIELD, TOTAL_PAGE_LABEL

    Hiding actual document from an user

    DOCUMENT or DOC_LIST parameter values may be IDs generated at run time from server during constructing these browser URLs. User may not be able to download document by typing the document URL in the browser location field just because the ID is not a physical document exists any where but access to it established by using this framework.

    For example, DOC_LIST=[docid-123456] may be used as part of the URL where the document "docid-123456" is not a real document. On user click to this URL server callback program may access this DOC_LIST and establish the real identify of the actual document and set it. Therefore, real document URL is revealed by replacing the DOCUMENT or DOC_LIST param values this way before returning the reply. If the actual content belong to a database and not from a file or URL, read such content as byte[] and set against the DOCUMENT or DOC_LIST params value.

    Tracking document access

    Typical example may be that a web site has established where it works based on pay per print basis. Provider therefore need to track number of copies printed so far by the user and may reject or deny further printing request based on account balance. For denying a job callback server program can set the JOB_STATUS to CANCELED. On the other hand server program may increase the copies printed counter to number of copies printed this time and this may be done in the on success callback page when called.

    Once can control things such as:

  • number of times the document was opened for reading or printing,
  • copies printed,
  • printer printed to, paper size, orientation, and more.

    Back to Top
    Job/Process tracking

    Several jobs may be processed concurrently from a browser page and each job may include multiple documents (or data source) associated with it. For example, using a java script one may fire a series of call to the "silent print" script. Each URL may have DOC_LIST consists of multiple data source. Each call to the silent print script will launch the job with a unique JOB_ID aimed at monitoring or logging the status.

    Ways to track running jobs

    While the process continues it updates the job status by calling the context message handler posting the message as parameter. Typically a java script in browser page and the server callback URL (if any) is used for tracking. If a server URL is set, it will call it before and after each job. Java script method is also called for posting a message. One may or may not have defined java script to call and also may not specify a server call back URL. One or both of these two may be used to properly control all aspects of the job processing.

    Java Script (client) based job tracking

    In the browser page following java script may be declared to receive messages posted by the on going process. Process will call this default java script method with message as the argument.

         function showMessage(msg) {
           //todo - process the message here; e.g. may show in a pane or track to persist in a server once done.
         }
    
    One can specify another method name instead of default showMessage(msg) method using ON_MESSAGE_JS_NAME parameter. For example, if you may want to use a java script method name myJavaScriptMethod using following as part of the job URL.

          .../silent_print_XXX.jsp?...&ON_MESSAGE_JS_NAME=myJavaScriptMethod&...
        

    Format of the input message
    Input message is formatted with minimum of three parameters which one has to parse and extract the content.

  • Param-1: JOB ID - enclosed by '[' and ']'; example: "[6d12a9]"
  • Param-2: STATUS COMMAND - separated by one or more white spaces; e.g. START
  • Param-3: VALUE - for the STATUS COMMAND; e.g. JOB_STATUS [SUCCESS] - where JOB_STATUS is a command and the value is enclosed next to it using '[' and ']'
  • Here are some messages received while running demo samples and they are simply displayed in a pane; where JOB_ID=6d12a9 and START, DOC_LIST, DOC_COUNT, PAGE_COUNT, PRINTER_NAME, JOB_STATUS, DURATION, END are commands. Third argument next to the command is the value for the command. All time related values are in milliseconds.

      [6d12a9] START []
      [6d12a9] DOC_LIST [http://www.activetree.com/silent_print_XXX_from_browser/demo/sample_XXX/sample2.XXX]
      [6d12a9] DOC_COUNT [1]
      [6d12a9] PAGE_COUNT [4]
      [6d12a9] PRINTER_NAME [PDF995]
      [6d12a9] JOB_STATUS [SUCCESS]
      [6d12a9] DURATION [1375]
      [6d12a9] END []
    

    JOB_STATUS: Typically the job status will be one of these; PROGRESS, SUCCESS, FAILED, CANCELED.

    Server based job tracking

    If there is a SERVER_CALL_BACK_URL is specified in the job URL (shown next) it will call the server page before job starts and after each job ends. Status may be captured at the end of the job.

          .../silent_print_XXX.jsp?...&SERVER_CALL_BACK_URL=/demo/server.jsp&...
        

    There is an example in the downloaded archive demo/server.jsp may be used as a demo server call back URL. Parameters passed to the server URL as a query string consists of key=value pairs separated by & character just like the way an URL is formed. Server will parse these parameters using the query string.

    Back to Top
    DEMO Samples in this archive

    This WAR archive contains few demo samples built using the view_XXX.jsp and silent_print_XXX.jsp explained earlier in this tutorial. These demo script files are located under demo directory. In the demo directory there is this demo_main.jsp works as a common page with links to both the demo samples.

    Back to Top
    DEMO-1 (Parameter values embedded with the URL)

    This demo is located under demo directory. Calling demo1.jsp from this directory location will show content of this demo. Alternatively, you can open the demo_main.jsp in the demo directory which has a link pointing to this demo1.jsp.

    You'll see:
    - A clickable link pointing to an existing XXX format documents. Click on the Silent Print to print the document silently. Click on the View link to open the document in a new browser window.
    - A user enterable field that lets you enter a document URL of your choice for print or view.

    In this sample (demo1.jsp) all parameters are embedded as part of the "silent print" (silent_print_XXX.jsp) or "view" (view_rtf.jsp) URL explained earlier. With the help of javascript in this page parameters are accessed and an URL is constructed and submitted to silent_print_XXX.jsp or view_XXX.jsp.

    When you "silent print" a document using this demo, it will display some messages to the "Printing Status" pane at the bottom of this page (if the STATUS_UPDATE_ENABLED is enabled in this script file).

    Back to Top
    DEMO-2 (User select parameter values)

    This demo is located under demo directory. Calling demo2.jsp from this directory location will show content of this demo. Alternatively, you can open the demo_main.jsp in the demo directory that has a link pointing to demo2.jsp.

    You'll see:
    - A user enterable field for you to enter a document URL of your choice.
    - A multiple selection list box with some document URL links. Select one or more documents from here.
    - "Printing Options" pane contains many of the printing parameters mentioned earlier in this tutorial. Select, enter or change one or more of these parameters to change the printing behavior.
    - Hit the "Print Selected Documents" button for printing.

    Specialty with this sample is that user can select the printing parameters instead you embed (hard code) them in the "silent print" (silent_print.jsp) or "view" (view_XXX.jsp) URL.

    When you "silent print" a document using this demo, it will display some messages to the "Printing Status" pane at the bottom of this page (if the STATUS_UPDATE_ENABLED is enabled in this script file).

    Back to Top
    DEMO-3 (Silent print or View document byte[] content)

    This demo shows how to silent print and view dynamically generated document from browser - e.g. InputStream, Database or byte[] content from other source which can not be referred as an URL directly from the browser. Instead they can be accessed through a server program (i.e. an URL) in order to access those kind of DOCs.

    This requires you to write a server program to dynamically generated the document content and write it back to the browser. This still is no different than above two examples just because it is indeed an URL and an URL is all that the API needs.

    Examples: Typical example may be that you have a FORM requires data to be feed to it and then generate a document. Document content may be stored in a database which you can refer as an existing document but you need a server program like this one to retrieve the content and write back to browser. The same is true for every other case when your document is NOT an already existing one.

    Back to Top
    Contact Us

    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