Sending output to a printer

This Quick Start describes how to use the Output service to merge a form design with one or more records and send the output to a printer.

Using the Output service, the records can be merged with a form design to create filled forms that can be sent to a printer. The form design must have corresponding field names for each field to merge with the record. For example, when a purchase order process completes at an organization, a record that contains the contents of the purchase order is created and saved as an XML file. The contents of the XML file are merged with a form design. Each record that is merged with the form design creates a filled purchase order form. The filled purchase order is sent to a printer named myprinter1 on a print server named myprintserver1. (The printing environment is configured by using Microsoft server networking.)

An application named poPrintApp implements this service for the organization. When a purchase order is completed, its contents are saved as a record in an XML file named poData.xml. The poData.xml file is sent at various time intervals to invoke the poProcessPrint service. These assets are in the poPrintApp application:

  • A form design named PurchaseOrder.xdp that is used for merging with the XML data.

  • A process named poPrintProcess that includes the following items:

    • An input document variable named inputXML that passes the XML data for purchases into the process.

    • An output document variable named outputPS that stores the merged PostScript® output.

    • A generatePrintedOutput operation (Output service), which merges a form design with records in an XML file. The resulting output is a document value that represents the output for printing.

  • A sendToPrinter operation (Output service) that sends the document value to a printer. You can choose from various printer protocols, depending on how your printer settings are configured with the LiveCycle Server.

The process diagram for the poPrintPrint process looks like the following illustration:

generatePrintedOutput and sendtoPrinter operations.

The following XML file is generated from a purchase order request. The XML file can have one or more records in it. To determine where a record starts and begins, knowledge of which node or level the record starts at is required. In the following XML file, <batch> is the first node (or root node) and is therefore at level 1. The batch element contains three records. Each record is delimited by the <PurchaseOrder> node. Therefore, in the following example, each record starts at level 2.

<?xml version="1.0" encoding="UTF-8"?> 
<batch> 
    <PurchaseOrder> 
        <lastName>Blue</lastName> 
        <firstName>Tony</firstName> 
        <OrderNo>555666777</OrderNo> 
        <Item> 
            <Description>Widget S</Description> 
            <Price>100</Price> 
            <Quantity>2</Quantity> 
        </Item> 
        <Item> 
            <Description>Widget B</Description> 
            <Price>5.00</Price> 
            <Quantity>4</Quantity> 
        </Item> 
        <PurchaseAmount>40.00</PurchaseAmount> 
    </PurchaseOrder> 
    <PurchaseOrder> 
        <lastName>White</lastName> 
        <firstName>Sam</firstName> 
        <OrderNo>555666222</OrderNo> 
        <Item> 
            <Description>Widget ABC</Description> 
            <Price>2200.00</Price> 
            <Quantity>10</Quantity> 
        </Item> 
        <PurchaseAmount>22000.00</PurchaseAmount> 
    </PurchaseOrder> 
    <PurchaseOrder> 
        <lastName>Green</lastName> 
        <firstName>Steve</firstName> 
        <OrderNo>55566688</OrderNo> 
        <Item> 
            <Description>Widget G</Description> 
            <Price>700000</Price> 
            <Quantity>1</Quantity> 
        </Item> 
        <PurchaseAmount>700000</PurchaseAmount> 
    </PurchaseOrder> 
</batch>

Configuration

For the generatePrintedOutput operation, the following properties are configured to generate PostScript output:

Input

  • Form: poPrintApp > poPrintApp/1.0 > purchaseOrder.xdp. Use the Select Asset dialog box to specify the literal value.

  • Input Data: inputXML variable. The inputXML variable is an input document variable. The contents of the document value are from the poData.xml file.

  • Print Format: Generic Postscript Level 3 because PostScript output is required. Depending on the print format, different default device profiles (XDC files) are used. Because Generic Postscript Level 3 is selected, the XDC URI property changes to ps_plain_level3.xdc. XDC files are printer description files in XML format that describe the capabilities of printers. You can modify XDC files. (See Creating Device Profiles Using Workbench .)

Batch Options

  • Record Level: 2, because each record begins at the second XML node in the XML file.

Output

  • Printed Output: The output generated by the operation. Save to the variable outputPS, which is document variable.

    For the sendToPrinter operation, the following properties are configured to send to a printer (Microsoft network) that the LiveCycle Server can access:

Input

  • Input Document: The document variable outputPS, which contains the PostScript output that was created from the generatePrintedOutput operation.

  • Printer Protocol: SharedPrinter, because the printer is connected to the LiveCycle Server by using Microsoft server networking. The printer protocol to use depends on how printers are configured in the network.

  • Server URI: \\myprintserver1, which is the name of the print server.

  • Printer Name: \\printserver1\myprinter1, which is the name of the printer. The complete name of the printer name must include the printer server.

Other considerations

This Quick Start does not show you how to create the XML that contains the collection of records or how to create a form design that can be used with XML data. For information about creating form designs, see Designer Help. For information about creating XML data and considerations for creating form designs for the Output service, see Designer Help.

The LiveCycle Server must be configured to access the printer, which requires you to set permissions on the application server. For more information about the configuration settings required to send output to print, see "Sending documents to printer" in the Output Service chapter in Services Reference for Adobe LiveCycle ES4.

To use the generatePrintedOutput operation, these items must be available to the process at run time:

  • An XML file that contains the records to merge with the form design. An understanding of the XML structure is required in order to set the record level.

  • An understanding of the type of output to generate. The type of output to generate depends on the print formats that the printer supports.

  • The printer protocol to use, the name of the print server, and network name of the printer.