Prerequisites Oracle Fusion Middleware Online Documentation Library

7-4 Developers Guide for Oracle Business Intelligence Publisher

7.4 PDF Form Processing Engine

This section discusses how to use the RTP Processor Engine, and includes the following topics: ■ Section 7.4.1, Overview of the PDF Form Processing Engine ■ Section 7.4.2, Merging a PDF Template with XML Data ■ Section 7.4.3, Merging XML Data with a PDF Template Using InputOutput File Name ■ Section 7.4.4, Merging XML Data with a PDF Template Using InputOutput Streams ■ Section 7.4.5, Merging an XML Data String with a PDF Template ■ Section 7.4.6, Retrieving a List of Field Names

7.4.1 Overview of the PDF Form Processing Engine

The PDF Form Processing Engine creates a PDF document by merging a PDF template with an XML data file. This can be done using file names, streams, or an XML data string. As input to the PDF Processing Engine you can optionally include an XML-based Template MetaInfo .xtm file. This is a supplemental template to define the placement of overflow data. The FO Processing Engine also includes utilities to provide information about your PDF template. You can: ■ Retrieve a list of field names from a PDF template ■ Convert XML data into XFDF using XSLT

7.4.2 Merging a PDF Template with XML Data

XML data can be merged with a PDF template to produce a PDF output document in three ways: ■ Using inputoutput file names ■ Using inputoutput streams ■ Using an input XML data string

7.4.3 Merging XML Data with a PDF Template Using InputOutput File Name

Input: ■ Template file name String ■ XML file name String Output: ■ PDF file name String Example 7–1 Sample Code for Merging XML Data with PDF Templates Using InputOutput File Names import oracle.xdo.template.FormProcessor; . . Using the BI Publisher Java APIs 7-5 FormProcessor fProcessor = new FormProcessor; fProcessor.setTemplateargs[0]; Input File PDF name fProcessor.setDataargs[1]; Input XML data file name fProcessor.setOutputargs[2]; Output File PDF name fProcessor.process;

7.4.4 Merging XML Data with a PDF Template Using InputOutput Streams

Input: ■ PDF Template Input Stream ■ XML Data Input Stream Output: ■ PDF Output Stream Example 7–2 Sample Code for Merging XML Data with PDF Templates Using InputOutput Streams import java.io.; import oracle.xdo.template.FormProcessor; . . . FormProcessor fProcessor = new FormProcessor; FileInputStream fIs = new FileInputStreamoriginalFilePath; Input File FileInputStream fIs2 = new FileInputStreamdataFilePath; Input Data FileInputStream fIs3 = new FileInputStreammetaData; Metadata XML Data FileOutputStream fOs = new FileOutputStreamnewFilePath; Output File fProcessor.setTemplatefIs; fProcessor.setDatafIs2; Input Data fProcessor.setOutputfOs; fProcessor.process; fIs.close; fOs.close;

7.4.5 Merging an XML Data String with a PDF Template

Input: ■ Template file name String ■ XML data String Output: ■ PDF file name String Example 7–3 Sample Code for Merging XML Data Strings with PDF Templates import oracle.xdo.template.FormProcessor; . .