Direct PDF Printing

OrderFlow supports direct printing of PDF documents, typically produced by third party systems. For example, OrderFlow integrates with MetaPack’s Delivery Manager, which produces shipment labels on behalf of multiple carriers.

In order to perform direct printing of PDF documents from OrderFlow without any manual intervention, you will need to install Adobe Reader.

Installation and Setup

Adobe Reader can be downloaded from Adobe’s web site: http://www.adobe.com/uk/products/reader.html. Follow the instructions on this site to install Adobe Reader.

Once Adobe Reader has been installed, there are two further setup steps to follow to enable direct PDF printing.

  • ensure the Firefox content file association is correct
  • install the JavaScript printing function support

PDF Content Association

Installing Adobe Reader will also result in the installation of the Firefox Adobe Acrobat plugin.

Ensure that there is a content association made between this plugin and PDF files. The screen below shows an example of this.

_images/pdf-content-association-new.png

Making the PDF to plugin association in this way helps to ensure that PDF content displays seamlessly within the embedded PDF viewer.

Do not use a content association to Adobe Reader directly, as each time a PDF document is accessed, it will result in a separate window Adobe Reader window being opened.

Installing JavaScript Printing

The OrderFlow mechansism for the direct printing of PDF documents inserts a JavaScript function into each PDF document being be printed. In order to allow this to be performed, the JavaScript executing the printing operation needs to be trusted. This is accomplished by installing a avaScript snippet the Reader/JavaScripts directory.

For example, in the case of Adobe Reader 11.x, this directory may for example be found in C:/Program Files/Adobe/Reader 11.0/Reader/JavaScripts, as shown below. If you upgrade Adobe Reader, you will need to do this again for the new version.

Note that you should restart Firefox and close down any existing PDF documents, before the changes will take effect.

_images/pdf-javascripts.png

The snippet of JavaScript which needs to be installed is shown below:

function doPrint(printerName, shouldAlert) {
    var doc = this;
    var pp = this.getPrintParams();

    var doAlert = (shouldAlert == 'true');

    if (doAlert == true) {
        app.alert('Printing via trusted function: trustedDoPrint');
    }

    trustedDoPrint(doc, pp, printerName, doAlert);
}

var trustedDoPrint = app.trustedFunction(function(doc, pp, printerName, doAlert) {
    app.beginPriv();

    try{
        pp.interactive = pp.constants.handling.none;
        pp.pageHandling = pp.constants.interactionLevel.silent;
    }
    catch(err){
        app.alert("Error setting up printing parameters.\n\n" + err);
    }

    if (printerName != undefined) {
        pp.printerName = printerName;
    }

    if (doAlert == true) {
        app.alert('Printing to printer: ' + printerName);
    }

    try{
        doc.print(pp);
    }
    catch(err){
        app.alert("Error printing document.\n\n" + err);
    }

    app.endPriv();
});

Note the use of the trusted function to run the print job.

Verifying PDF Printing

OrderFlow includes a number of tests which can be performed to verify that PDF printing is set up properly.

The main PDF workstation page is accessible from the Setup -> Workstation -> PDF menu. Simply follow the on screen instructions to test various aspects of PDF printing and display.

From this page, you can also navigate via the ‘Diagnostics page’ link to a form which can be used for further testing. This screen is shown below.

_images/pdf-diagnostics.png

Using this screen, you should be able to perform operations to verify that the JavaScript snippet has been successfully installed into Adobe Reader.