Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > Adobe Acrobat and PDF

  • Print
  • + Share This
This chapter is from the book Rendering and Reader Extending

Rendering and Reader Extending

Rendering and Reader extending a PDF form at runtime is a common LiveCycle task. Rendering a form often includes merging data so the user will have a PDF with relevant data. After the form is rendered at runtime, it will usually need to be Reader extended for form fillers using the Reader program.

Using the renderPDFForm Operation

The renderPDFForm operation is located in the Forms node of the Services view in Workbench. Follow these steps to add this operation to your process diagram:

  1. Drag and drop this operation to your process diagram. The renderPDFForm icon appears.
  2. Click this icon and select the Properties view to set various properties at design time to control the behavior of this service at runtime (Figure 10.5).

Figure 10.5 A truncated Properties view for the renderPDFForm operation, showing the standard properties to render a form.

As you can see, there are many properties in the renderPDFForm operation to explore. The following are the standard properties to set to render a PDF form from an XDP template and an XML data file:

  • Input > Form to Render: This option can be set to a template, a process variable, a literal value, or an XPath expression. In Figure 10.5, it is set to a process variable called formTemplate. Either a process variable or an XPath expression will enable you to use different forms at runtime.
  • Input > Form Data: This option can be set to a process variable, a literal value, or an XPath expression. In Figure 10.5, it is set to a process variable called formData so you can also choose the data at runtime.
  • Input > PDF Form Render Options: These properties are not fully pictured here but you can see them in Workbench. Many of these properties have default settings.
  • Input > URL Options > Content Root URI: If your process uses a template from the LiveCycle repository, you must add repository:// to this property. If you are using ES2, this value is the default setting for the property.
  • Output > Rendered Form: This option can be set to a process variable or an XPath expression. In Figure 10.5, it is set to a process variable called renderedPDF.

Using the applyUsageRights Operation

You were introduced to the benefits of Reader Extensions in Chapter 2. You also saw the design time interface for LiveCycle Reader Extensions ES. In this chapter, you will learn to call Reader Extensions ES at runtime. One way is by adding the applyUsageRights operation to your process. The operation is located in the Reader Extensions node of the Services view. Follow these steps to add this operation to your process diagram:

  1. Drag and drop the applyUsageRights operation to your process diagram. The applyUsageRights icon appears.
  2. Click this icon and select the Properties view to set various properties at design time to control the behavior of this service at runtime (Figure 10.6).

Figure 10.6 The Properties view for the applyUsageRights operation, showing many of the same extended features you read about in Chapter 2.

The following are the standard properties to set to Reader extend a file with the applyUsageRights operation:

  • Input > Input PDF Document: This option can be set to a template, a process variable, a literal value, or an XPath expression. In Figure 10.6, it is set to a process variable called renderedPDF.
  • Input > Credential Alias: In Figure 10.6, this is set to the literal value of SMARTDOC because that is the credential alias we use on one of our internal development servers. You will need a credential file from Adobe to use Reader Extensions ES.
  • Output > Output PDF Document: This option can be set to a process variable or an XPath expression. In Figure 10.6, it is set to a process variable called readerExtendedPDF.

The renderPDFForm and the applyUsageRights operations can be combined in your process diagrams any time you need to generate a PDF document from an XDP template. In the next example, you will see how these operations can be used to generate an XFA PDF with traditional PDF attachments.

Rendering a Form with Attachments

An interactive XFA PDF can also include file attachments. The file attachments can be traditional PDF files or files from Microsoft Office and other applications. This capability is useful in health care and other fields because it enables a form filler to attach supporting documentation to an interactive form (Figure 10.7).

Figure 10.7 Acrobat/Reader’s Attachments panel showing two file attachments: document1.pdf and document2.pdf.

You can render a PDF form with attachments at runtime using the renderPDFForm operation. In this case, the renderPDFForm operation also requires a map type variable of document values for the Attachments property. You can set a map type variable with the Execute operation of the Set Value service that you learned about in Chapter 7. After the form is rendered, you can call the applyUsageRights operation to Reader extend the file (Figure 10.8).

Figure 10.8 This process diagram shows the Set Value service, the renderPDFForm operation, and the applyUsageRights operation working together to create a Reader extended XFA PDF with file attachments.

The Set Map Variable activity in Figure 10.8 includes the mappings detailed in Figure 10.9.

Figure 10.9 The mappings of the Set Map Variable activity.

These mappings will map the two document attachments (attachment_1 and attachment_2) to the map type variable (attachments). This new map type variable will be referenced in the Attachments property of the renderPDF activity (Figure 10.10).

Figure 10.10 The Attachments property uses an XPath expression to reference the attachments map type variable.

You can also Reader extend a file by calling Reader Extensions ES from your Java or .NET program. For instruction, download the PDF “Calling Reader Extensions from a Java or .NET Application” from http://www.paperlessbook.info.

  • + Share This
  • 🔖 Save To Your Account