This chapter provides an overview of Oracle's XML Publisher and XML Publisher classes, and discusses the following topics:
XML Publisher terms.
XML Publisher flow diagram.
Error handling.
Data type and scope of XML Publisher objects.
Instantiating XML Publisher objects.
Search operator values.
XML Publisher classes reference.
XML Publisher classes example.
See Also
Getting Started with XML Publisher
Oracle's XML Publisher enables you to separate the data, layout, and translation layers of a report from each other. This can improve flexibility, as well as reduce maintenance. You need to create report definitions, define templates, and so on, using the XML publisher. The XML Publisher classes enable you to access the runtime portions of the XML publishing process programmatically—that is, after the templates and reports have been created.
The XML Publisher classes are divided into the following categories:
Report manager definition classes
Report manager search classes
Engine classes
XML Publisher Report Manager Definition Classes
To create a report with XML Publisher, you first create a report definition using the Report Definition page. The report definition includes report properties, output formats, templates to be used, report security, and so on. At run time, the ReportDefn class uses these attributes to process the report. The ReportDefn class itself can be invoked from a batch process or a page PeopleCode. For example, the report can be scheduled from the Query Report Scheduler page, or viewed from Query Report Viewer page.
See ReportDefn Class.
XML Publisher Report Manager Search Classes
After you've published a report, it is stored in the report repository. Using the report manager search classes, you can search for a report based on defined search keys, or even add additional search keys for searching.
See Report Class.
See ReportManager Class.
Use the XML Publisher engine classes to combine PDF files into a single PDF file, and to specify page numbers and watermarks on merged PDF reports.
See PageNumber Class.
See PDFMerger Class.
See Properties Class.
See Watermark Class.
The following is a list of general XML publisher terms and their definitions.
EFT |
Electronic Funds Transfer, a format used by the banking industry. |
eText |
Electronic text, specifically, files in ASCII text format. |
FO |
Formatting objects, an XML markup language for document formatting. |
HTML |
Hyper Text Markup Language, a markup language designed for the creation of web pages. |
|
Portable Document Format, a file format developed by Adobe Systems for representing documents in an independent format. |
RTF |
Rich Text Format, a document file format used for cross-platform document interchange. |
XML |
Extendable Markup Language, a general purpose markup language for many types of data. |
SMS |
Short messaging service, a short alphanumeric (160 characters) that is generally sent to a mobile device, such as a mobile phone. |
The following is the general flow of an XML report showing how and when certain XML Publisher classes are used in the publishing process.
XML Publisher prepares the report data from the data source: a PS Query, a connected query, or an XML file. Then, XML Publisher uses the PSXP_RPTDEFNMANAGER report definition classes to generate and route the report. Optionally, XML Publisher uses the PSXP_REPORTMGR search classes to search for a report in the reports repository.
XML Publisher flow diagram
Different XML Publisher classes handle errors differently.
Use of report manager definition and report manager search classes should be wrapped in a try-catch statement to handle any errors. The XML Publisher engine class methods typically contain an error parameter as part of their signature that you can check for any errors. Other XML Publisher classes generally return a populated object that can be checked for a null value to determine any errors.
See Also
Each XML Publisher class is its own data type—that is, report definitions are declared as the ReportDefn data type, a report manager is declared as the ReportManager type, and so on.
An XML Publisher object can be declared of type local, component, or global and instantiated from PeopleCode only.
The XML Publisher classes are not built-in classes, like Rowset, Field, Record, and so on. They are application classes. Before you can use these classes in your PeopleCode program, you must import them into your program.
Your import statements should look similar to the following:
import PSXP_RPTDEFNMANAGER:*;
Note. Using the asterisks after the package name makes all the application classes directly contained in the named package available. Application classes contained in subpackages of the named package are not made available.
After you've imported the appropriate XML Publisher classes, you instantiate an object of one of those classes using the constructor for the class and the create method.
The following example declares the variable &rptDefn and creates a new instance of the ReportDefn class:
Local PSXP_RPTDEFNMANAGER:ReportDefn &rptDefn = create PSXP_RPTDEFNMANAGER:Report⇒ Defn(&rptDefnId);
See Also
Methods in the report manager definition and report search manager classes enable you to search for existing definitions. Many of the parameters for these methods should be specified in pairs, that is, a value specified with a search operator. All the search operator parameters use the same values.
The following lists the search operator values that can be used with the XML Publisher classes:
Value |
Description |
%PSXP_SrchBegins |
The name to search for begins with the specified value. |
%PSXP_SrchContains |
The name to search for contains the specified value. |
%PSXP_SrchEquals |
The name to search for equals the specified value. |
%PSXP_SrchNotEquals |
The name to search for does not equal the specified value. |
%PSXP_SrchLessThan |
The name to search for is less than the specified value. |
%PSXP_SrchLessEquals |
The name to search for is less than or equal to the specified value. |
%PSXP_SrchGreaterThan |
The name to search for is greater than the specified value. |
%PSXP_SrchGreaterEquals |
The name to search for is greater than or equal to the specified value. |
%PSXP_SrchBetween |
The name to search for is between two values. Separate the values by a comma. Do not use quotation marks. For example, ACCT1,ACCT9. |
%PSXP_SrchIn |
The name to search for is in the specified list. Separate the values with commas. Do not use quotation marks. For example, ACCT1, ACCT2, ACCT3. |
The XML Publisher classes reference includes the public subset of XML Publisher classes divided into the following sections:
XML Publisher report manager definition classes.
XML Publisher report manager search classes.
XML Publisher engine classes.
The following report manager definition classes are described in this chapter: ReportDefn class.
This section provides an overview of the ReportDefn class and discusses:
ReportDefn class constructor
ReportDefn class methods
ReportDefn class properties
Use the ReportDefn class to process a report definition created through the Report Definition component Use this class to generate and publish report output.
This section describes the constructor for the ReportDefn class.
Syntax
ReportDefn(ReportId)
Description
Use the ReportDefn constructor to instantiate a ReportDefn object. You must then use the Get method to initialize the object.
Parameters
ReportId |
Specify a unique ID to be associated with the report definition. |
Returns
A reference to a ReportDefn object.
Example
import PSXP_RPTDEFNMANAGER:ReportDefn; Local PSXP_RPTDEFNMANAGER:ReportDefn &rptDefn = create PSXP_RPTDEFNMANAGER:Report⇒ Defn(&rptDefnId); &rptDefn.Get();
In this section, the ReportDefn class methods are presented in alphabetical order.
Syntax
Close()
Description
Use this method when there is an exception or error calling the ProcessReport method or any other output method (Publish, PrintOutout or DisplayOutput) of the ReportDefn class. Calling this method cleans up all temporary files, folders, and resources.
Parameters
None.
Returns
None.
See Also
DisplayOutput, PrintOutput, ProcessReport, Publish.
Syntax
DisplayOutput()
Description
Use the DisplayOutput method to display the report generated by the ProcessReport method in a separate browser window.
You must successfully call the ProcessReport method prior to calling this method.
This method displays a single report. Therefore, the report definition must not be set for bursting.
Parameters
None.
Returns
None.
See Also
Syntax
Get()
Description
Use the Get method to return a reference to the existing ReportDefn object.
Parameters
None.
Returns
A reference to the newly instantiated and populated ReportDefn object.
Syntax
GetOutDestFormatString(OutDestFormat)
Description
Use the GetOutDestFormatString method to convert the output format returned from system variable %OutDestFormat to an XML Publisher output format string that can be passed to the output type parameter of the ProcessReport method. This method is useful when processing reports generated by application engine programs that are run process scheduler.
Parameters
OutDestFormat |
Specify the output destination format as a number. If you specify something other than a valid value, the method throws an exception. Valid values are: |
Value |
Description |
2 |
PDF format |
5 |
HTM format |
8 |
XLS format |
12 |
RTF format |
Returns
A string if successful. Valid values are:
HTM
XLS
RTF
See Also
Syntax
GetPSQueryPromptRecord()
Description
Use the GetPSQueryPromptRecord method to return the runtime prompts of a query as a record object. This method should only be used when the data source type associated with the report definition is a PeopleSoft query. This method returns a null when the data source type isn't a PeopleSoft Query.
Parameters
None.
Returns
A record object populated with the query prompts if the data source definition is a PeopleSoft query, null otherwise.
See Also
Syntax
PrintOutput(DestPrinter)
Description
Use the PrintOutput method to print the report definition object executing the method. The ProcessReport method must be called successfully before you use this method.
Parameters
DestPrinter |
Specify the printer you want to use for printing the report, as a string. |
Returns
None.
See Also
Syntax
ProcessReport(TemplateId, LanguageCD, AsOfDate, OutputFormat)
Description
Use the ProcessReport method to generate a report and store the information.
Before you generate the report, you must:
Set the report output destination with the OutDestination property if the output type is a file.
Specify the data source using the SetRuntimeDataXMLFile method if you are using a data source other than a PeopleSoft query.
After you use the ProcessReport method, you can use the Publish method to post the report, the DisplayOutput method to display the report in a browser window, or the PrintOutput method to print the report.
Parameters
TemplateId |
Specify the template to be used for processing this report, as a string. You can specify a null value for this parameter, that is, (""). When you specify a null value, the default template associated with the report definition is used. |
LanguageCD |
Specify the three-letter language code for the report definition, such as ENG, FRA, ESP and so on. This parameter controls both the translation and the language specific output details such as font selection and right-to-left page orientation for Arabic/Hebrew. You can specify a null value for this parameter, that is, (""). If you specify a null value, the current language of the session is used. |
AsOfDate |
Specify the as of date for the report, as a date. |
OutputFormat |
Specify the output format, as a string. See ReportDefn class: GetOutDestFormatString method. You can specify a null value for this parameter, that is, (""). When you specify a null value, the default output format associated with the report definition is used. |
Returns
None.
See Also
Close, DisplayOutput, PrintOutput, SetPSQueryPromptRecord, SetRuntimeDataXMLFile, SetRuntimeProperties.
Syntax
Publish(ServerName, ReportPath, FolderName, ProcessInstanceId)
Description
Use the Publish method to publish the current report definition
You must have successfully completed a call to the ProcessReport method before you can use this method.
Parameters
ServerName |
Specify the server to use for publishing the report, as a string. You can specify a null value for this parameter—that is, (""). |
ReportPath |
Always specify a null value only for this parameter—that is, (""). |
FolderName |
Specify the name of the report folder that the report should be posted to. You can specify a null value for this parameter—that is, (""). If you do not provide a value for this parameter, the default folder is used to post reports. |
ProcessInstanceId |
Specify the process instance of the calling process, such as the calling application engine program. If you specify a 0, a new process instance is generated to track the report posting process. |
Returns
None.
See Also
Syntax
SetPSQueryPromptRecord(&Record)
Description
Use the SetPSQueryPromptRecord method to specify an already instantiated record object that contains the prompt values for the query to be used to populate the report.
This method can only be used with reports that have a PeopleSoft query defined as the data source.
You must use this method before using the ProcessReport method.
Parameters
&Record |
Specify an already instantiated and populated record object that contains the values for the query to be used to populate the report. |
Returns
None.
See Also
ProcessReport, GetPSQueryPromptRecord.
Syntax
SetRuntimeDataXMLFile(FilePath)
Description
Use the SetRuntimeDataXMLFile method to specify an existing XML file as the data source for the report.
Note. Because the SetRuntimeDataRowset and SetRuntimeDataXMLDoc methods have been deprecated, use this SetRuntimeDataXMLFile method instead.
Report definitions that use a data source other than a PeopleSoft query must set that data source before generating the report using the ProcessReport method.
Forward or back slashes are used in the path according to the operating system of the application server or process scheduler server—that is, on Unix servers, the directory separator is a forward slash, while Windows servers use back slashes.
Parameters
FilePath |
Specify an absolute path to the file that you want to use. You must include the file name and file extension in the parameter. Forward or back slashes are used in the path according to the operating system of the application server or process scheduler server. That is, on Unix servers, the directory separator is a forward slash, while a Windows server use a path with back slashes. |
Returns
None.
See Also
Syntax
SetRuntimeProperties(&NameArray, &ValueArray)
Description
Use the SetRuntimeProperties method to set additional runtime values and properties required for generating this report.
Note. XML Publisher's properties are defined at three different levels. Global properties are defined on the Global Properties page, and system properties are defined in the xdo.cfg file. At the report definition level, properties are defined on the Report Definition - Properties page. The runtime properties defined using this method override both global and report definition properties. However, system properties defined in the xdo.cfg file cannot be overridden using this method.
Parameters
&NameArray |
Specify an already instantiated and populated array of string containing the names of the additional properties or variables that you need for this report. |
&ValueArray |
Specify an already instantiated and populated array of string containing the values of the additional properties or variables that you need for this report. The values should be in the same order as the names listed in &NameArray. |
Returns
None.
Example
The following example sets extra parameters for securing a document.
&asPropName = CreateArrayRept("", 0); &asPropValue = CreateArrayRept("", 0); &asPropName.Push("pdf-compression"); &asPropValue.Push("false"); &asPropName.Push("pdf-hide-menubar"); &asPropValue.Push("true"); &oRptDefn.SetRuntimeProperties(&asPropName, &asPropValue);
Setting Custom Runtime Parameters
The SetRuntimeProperties method can also be used to set custom runtime parameters. When setting custom runtime parameters with the SetRuntimeProperties method, the parameter names need to be prefixed with xslt, and the values need to be surrounded by single quotes (for example, 'xyz'). For example, the following code creates a custom runtime parameter named xslt.ReportOwner:
&asPropName = CreateArrayRept("", 0); &asPropValue = CreateArrayRept("", 0); &asPropName.Push("xslt.ReportOwner"); /* Note the single quotes around the parameter value */ &asPropValue.Push(" 'John Smith' "); &oRptDefn.SetRuntimeProperties(&asPropName, &asPropValue);
The custom parameter may now be used in the template via the tag <?$ReportOwner?>. Before using it, it does need to be declared in a form field on the report template using the following tag:
<xsl:param name="ReportOwner" xdofo:ctx="begin"/>
See Also
Defining Global Properties, Creating Report Definitions, Defining System Properties and Fonts, Passing Parameters.
In this section, the ReportDefn class properties are presented in alphabetical order.
Description
Use the Description property to return a description for the report definition.
This property is effectively read-only.
Description
Use the DestinationPrinter property to specify a printer for the generated report.
This property is read-write.
Description
Use the FolderName property to specify a folder name for the generated report to be posted to.
This property is read-write.
Description
This property sets the report output destination as a string. This property must be set before calling the ProcessReport method. When ProcessReport is called, it places the generated report files in the directory specified by this property.
If this property is not set prior to calling the ProcessReport method, the report processing directory and the value returned by the OutDestination property depends on the setting of the psxp_usedefaultoutdestination property. The psxp_usedefaultoutdestination property, which is set on the Report Definition - Properties page, is used to set a compatibility mode with pre-8.50 PeopleTools versions.
See Setting Report Properties.
This property is effectively write-only.
Important! While this property is read-write, your PeopleCode program should read this property only if the program set the property first. Reading the property before it has been explicitly set produces unexpected results.
See Also
Description
This property returns the type of device specified for the output of the report definition, as a string.
This property returns the output destination value set on the Report Definition-Output page; it is not used internally to determine the output type. It can be used in a PeopleCode program to determine how to process and produce report output (for example, whether to call Publish, how to set OutDestination).
This property is effectively read-only.
Description
Use this property to specify a number representing a process instance for running the report.
In certain circumstances—for example, when running report using a Process Scheduler server—a process instance number is required for setting drilling URLs in the report output. In these cases, you must set the ProcessInstance property prior to calling the ProcessReport method.
This property is read-write.
Example
&ProcessInstance=PSXPQRYRPT_AET.PROCESS_INSTANCE; &oRptDefn.ProcessInstance = &ProcessInstance; &oRptDefn.ProcessReport("", "", %Date, "");
Description
This property returns the status of the report definition as a string. Valid values are:
Value |
Description |
A |
The report definition is active and can be run. |
I |
The report definition is inactive and cannot be run. |
P |
The report definition is in progress and cannot be run. This is the default value. |
This property is read-only.
Description
Use the UseBurstValueAsOutputFileName property to specify different names for all the files that result from bursting. This property takes a Boolean value: true, the report output files are named BurstValue.Extention. False is the default value.
This property is read-write.
The following report manager search classes are described in this chapter:
Report class
ReportManager class
SearchAttribute class
This section provides an overview of the Report class and discusses:
Report class constructor
Report class properties
The Report class is one of the report manager search classes. Use the Report class to access individual reports that have already been published to the report repository.
This section describes the constructor for the Report class.
Syntax
Report(RptId, Prcsinstance, Contentid, Dbname, RptName, RptDescr, RptURL, RptCreateDttm, RptExpireDt, FldrName)
Description
Use the Report constructor to instantiate and populate a Report object with the data of an already published report.
Parameters
RptId |
Specify the report ID of the report you want to access, as a string. |
Prcsinstance |
Specify the process instance of the report you want to access, as a number. |
Contentid |
Specify the content ID number of the report you want to access, as a number. |
Dbname |
Specify the data base name, as a string. |
RptName |
Specify the name of the report you want to access, as a string. |
RptDescr |
Specify the description of the report you want to access, as a string. |
RptURL |
Specify the URL to the report details page, as a string. |
RptCreateDttm |
Specify the date and time of the report you want to access, as a date time value. |
RptExpireDt |
Specify the date when the report will be archived, and no longer considered active, as a date. |
FldName |
Specify the name of the folder the report was published to, as a string. You must specify an absolute path name, using forward and back slashes as required by the operating system of the application server or process scheduler. |
Returns
A reference to a Report object.
Example
import PSXP_REPORTMGR:Report; Local PSXP_REPORTMGR:Report &oRpt = create PSXP_REPORTMGR:Report(String(&nRptId),⇒ &prcsinstance, &contentid, &sdbname, &sRptName, &sRptDescr, &sRptURL, &sFile⇒ URL, &dRptCreateDttm, &dRptExpireDt, &sFldrName);
In this section, the Report class properties are presented in alphabetical order.
Description
This property returns the content ID of the report, as a number.
This property is read-only.
Description
This property returns the date time when the report was created, as a date time.
This property is read-only.
Description
This property returns the data base name associated with the report, as a string.
This property is read-only.
Description
This property returns the description of the report definition, as a string.
This property is read-only.
Description
This property returns the date when the report will be archived, as a date value.
This property is read-only.
Description
This property returns a URL to the actual report file in the report repository.
Use the ReportURL property to access the report detail page instead.
This property is read-only.
See Also
Description
This property returns the full path name of the folder where the report is stored, as a string.
This property is read-only.
Description
This property returns the process instance ID associated with the report when it was posted, as a number.
This property is read-only.
See Also
Description
This property returns the report instance ID, that was populated when the report was run, as a number.
This property is read-only.
See Also
Description
This property returns the name of the report, as a string.
This property is read-only.
Description
This property returns a URL as a string, that points to the report detail page.
Use the FileURL to access a URL to the actual file containing the report in the report repository.
This property is read-only.
See Also
This section provides an overview of the ReportManager class and discusses:
ReportManager class constructor
ReportManager class methods
The ReportManager class is one of the report manager search classes. Use the ReportManager class to set the search criteria for reports that have already been published to the report repository.
This section describes the constructor for the ReportManager class.
Syntax
ReportManager()
Description
Use the ReportManager constructor to instantiate an instance of the ReportManager class.
Parameters
None.
Returns
A ReportManager object.
Example
import PSXP_REPORTMGR:ReportManager; Local REPORTMGR:ReportManager &rptMgr = create REPORTMGR:ReportManager();
In this section, the ReportManager class methods are presented in alphabetical order.
Syntax
AddSearchFieldCriteria(&SearchAttribute)
Description
Use the AddSearchFieldCriteria method to add an already instantiated and populated SearchAttribute object to the search.
Parameters
&SearchAttribute |
Specify an already instantiated and populated SearchAttribute object. |
Returns
A Boolean, true if the criteria was added successfully, false otherwise.
Example
Local PSXP_REPORTMGR:SearchAttribute &oSearch; Local integer &compOpSrch; &CompOpSrch = oRptMgr.PSXP_SrchBegins; &oSearch = create PSXP_REPORTMGR:SearchAttribute(&sAttrname, &sAttrVal, ⇒ &compOpSrch); &bResult = &oRptMgr.addSearchFieldCriteria(&oSearch);
See Also
Syntax
GetReportList()
Description
Use the GetReportList method to return a list of the report definition objects that satisfy all the criteria you specified with the other methods associated with the ReportManager object.
Parameters
None.
Returns
An array of ReportDefn objects.
See Also
Syntax
SetBurstFieldCriteria(BurstFld, BurstOp, BurstValue)
Description
Use the SetBurstFieldCriteria method to specify the burst criteria to be used with searching report definitions.
Parameters
BurstField |
Specify the name of the burst field used to generate the report, as a string. |
BusrtOp |
Specify the search operator to be used BurstField, as a string. |
BurstValue |
Specify the pattern string to be matched with burst field value using BurstOp. |
Returns
A Boolean value, true if the method completes successfully, false otherwise.
Syntax
SetCaseSensitive(IsCaseSensitive)
Description
Use the SetCaseSensitive method to specify the case sensitivity flag applicable to search field and bursting criteria for searching reports.
Parameters
IsCaseSensitive |
Specify a Boolean value: true to make the search case sensitive, false to make it case insensitive. |
Returns
None.
Syntax
SetDateCriteria(createdDate, createdLastVal, createdUnit)
Description
Use the SetDateCriteria method to specify the creation date criteria for searching reports.
Parameters
createdDate |
Specify a date used to search for reports generated on and after this date. You should specify a null value (" ") for this parameter if using createdLastVal and createdUnit. |
createdLastVal |
Specify a value to be used n conjunction with createdUnit, as a number. If you specify a value, it is used and any value given for createdDateis ignored. If you are not using this search criteria, you should specify a null value (" ") for this parameter. |
createdUnit |
Specify a value to be used for reports generated during last n number of periodic units. This value is used with createdLasVal. For example, if createdLastVal is set to 10, and createdUnit is set to 1, the reports generated in the last ten days are returned. Valid values are: |
Value |
Description |
1 |
Days |
2 |
Hours |
3 |
Minutes |
Returns
None.
Syntax
SetFolderCriteria(FolderName)
Description
Use the SetFolderCriteria method to specify the folder criteria for searching reports.
Parameters
FolderName |
Specify the name of the folder the report is posted in, as a string. |
Returns
A Boolean value, true if the search criteria is added successfully, false otherwise.
Syntax
SetProcessInstanceCriteria(FromPID, ToPID)
Description
Use the SetProcessInstanceCriteria method to specify the process instance range criteria for searching reports.
Parameters
FromPID |
Specify a process instance ID to be used as the starting range from which to search, as a number. This value must be less than or equal to ToPID. You can specify a null value for this parameter, that is, (" "). |
ToPID |
Specify a process instance ID to be used as the ending range from which to search, as a number. This value must be greater than or equal to FromPID. You can specify a null value for this parameter, that is, (" "). |
Returns
A Boolean value: true if the search criteria is added successfully, false otherwise.
Syntax
SetReportIDCriteria(ReportId)
Description
Use the SetReportIDCriteria method to specify a report ID for searching reports.
Parameters
ReportId |
Specify a report ID to be used for searching for report definitions. |
Returns
A Boolean value: true if the search criteria was set successfully, false otherwise.
Syntax
SetUserIdCriteria(UserId)
Description
Use the SetUserIdCriteria method to specify a user ID to be used for searching reports intended to be accessed by that recipient.
Parameters
UserId |
Specify the user ID to be matched with the intended recipient of the report. |
Returns
A Boolean: true if the search criteria is set successfully, false otherwise.
This section provides an overview of the SearchAttribute class and discusses:
SearchAttribute class constructor
SearchAttribute class properties
The SearchAttribute class is one of the report manager search classes. Use the SearchAttribute class to discover name-value pairs for the search criteria for reports that have already been published to the report repository. In addition, you can also specify a comparison operator to be used with the name-value pairs.
This section describes the constructor for the SearchAttribute class.
Syntax
SearchAttribute(AttrName, AttrValue, CompareOperator)
Description
Use the SearchAttribute constructor to instantiate an instance of a SearchAttribute object.
Parameters
AttrName |
Specify the attribute name, as a string. |
AttrValue |
Specify the attribute value, as a string. |
CompareOperator |
Specify a comparison operator. |
Returns
A SearchAttribute object.
Example
import PSXP_REPORTMGR:SearchAttribute; Local PSXP_REPORTMGR:SearchAttribute &oSearch = create PSXP_REPORTMGR:Search⇒ Attribute(&sAttrname, &sAttrVal, &compOpSrch);
In this section, the SearchAttribute class properties are presented in alphabetical order.
Description
This property returns the attribute name used with search.
This property is read-only.
Description
This property returns the attribute value used with search???
This property is read-only.
Description
This property returns the comparison operator used with search.
This property is read-only.
The following engine classes are described in this chapter:
PageNumber class
PDFMerger class
Properties class
Watermark class
This section provides an overview of the PageNumber class and discusses:
PageNumber class constructor
PageNumber class properties
Use the PageNumber class to set the page number for a merged PDF file. Objects in this class are used with the PageNumber property of the PDFMerger class.
See Also
This section describes the constructor for the PageNumber class.
Syntax
PageNumber()
Description
Use the PageNumber constructor to instantiate a PageNumber object.
Parameters
None.
Returns
A PageNumber object.
Example
import PSXP_ENGINE:PageNumber; Local PSXP_ENGINE:PageNumber &pNum = create PSXP_ENGINE:PageNumber();
In this section, the PageNumber class properties are presented in alphabetical order.
Description
Use the BackgroundFile property to specify a file to be used for the page number, as a string.
You must specify an absolute file name.
This property is read-write.
Considerations Using the BackgroundFile Property
You should either use the BackgroundFile property, or you should use the other properties associated with this class, like position or font. You cannot use both.
The file you specify must be a PDF file. The page size of the background PDF must be the same as the target PDF document, otherwise the page numbering doesn't work properly. All page numbering starts on the first page of the target document.
Description
Use the FontName property to specify the name of the font to be used for the page number, as a string. Valid values are:
Courier
Courier-Bold
Courier-BoldOblique
Helvetica (this is the default value)
Helvetica-Bold
Helvetica-BoldOblique
Helvetica-Oblique
Symbol
Times-Bold
Time-BoldItalic
Time-Italic
Time-Roman
ZapfDingbats
If you specify an invalid font name, the default (Helvetica) is used.
This property is read-write.
See Also
Description
Use the FontSize property to specify the size of the page number, as a number.
The default value is 8.
This property is read-write.
See Also
Description
Use the PositionX property to specify the X axis position of the text page number in the merged document.
This property is read-write.
See Also
Description
Use the PositionY property to specify the Yaxis position of the text page number in the merged document.
This property is read-write.
See Also
Description
Use the StartFromPageNum property to specify the page index from which you'd like to start the page numbering.
For example, if you have a PDF document which has two cover pages, and you want to start printing page numbers on the document from the third page, specify a three for this property.
This property is read-write.
See Also
Description
Use the StartNum property to specify the page number to use as the first page number in the merged document. If you don't specify a starting number, the pages are numbered starting from 1.
This property is read-write.
See Also
This section provides an overview of the PDFMerger class and discusses:
PDFMerger class constructor
PDFMerger class method
PDFMerger class properties
Use the PDFMerger class to combine two or more PDF files into a single PDF file.
This section describes the constructor for the PDFMerger class.
Syntax
PDFMerger()
Description
Use the PDFMerger constructor to instantiate a PDFMerger object.
Parameters
None.
Returns
A reference to a PDFMerger object.
Example
import PSXP_ENGINE:PDFMerger; Local PSXP_ENGINE:PDFMerger &oMerger = create PSXP_ENGINE:PDFMerger();
In this section, the PDFMerger class method is presented.
Syntax
MergePDFs(PDFFileArray, PDFOutputFile, Error)
Description
Use the MergePDFs method to merge the specified PDF files into a single output file.
The order of the files specified in the array are the order in which the files are merged.
Parameters
PDFFileArray |
Specify an already instantiated and populated array of string containing the names of the PDF files that you want to merge together. |
PDFOutputFile |
Specify the full path name of the file you want populated with the merged PDF file. Forward or back slashes are used in the path according to the operating system of the application server or process scheduler server. That is, on Unix servers, the directory separator is a forward slash, while a Windows server returns a path with back slashes. |
Error |
If any errors occur during processing, this parameter is populated with the text of the error message after processing. |
Returns
A Boolean: true if the method completed successfully, false otherwise. If this method returns false, the Error parameter is populated with the text of the error message that occurred.
Example
Local PSXP_ENGINE:PDFMerger &oMerger; &sErr = ""; &asNames = CreateArray(&sPdfFile1); &asNames.Push(&sPdfFile2); &bResult = &oMerger.mergePDFs(&asNames, &sOutputPdfFile, &sErr);
In this section, the PDFMerger class properties are presented in alphabetical order.
Description
Use the ConfProp property to specify an already instantiated and populated Properties object that contains the configuration to be used for processing the document. This property enables you to accommodate different system configurations.
See Also
Description
Use the Locale property to specify the locale for the processing. If no value is specified for this property, the default system locale will be used.
The locale is specified using a two character ISO language code and a two character ISO country code (LC-CC). When you don't need to reflect country specific formatting, the locale code is made up of just the language code.
This property is read-write.
Description
Use this property to specify an already instantiated and populated PageNumber object to be used with the merged document.
This property is read-write.
Example
Local PSXP_ENGINE:PDFMerger &oMerger; Local PSXP_ENGINE:PageNumber &oPageNumber; &oMerger = create PSXP_ENGINE:PDFMerger(); &oPageNumber = create PSXP_ENGINE:PageNumber(); &oPageNumber.FontName = "Symbol"; &oPageNumber.FontSize = 16; &oPageNumber.PositionX = 300; &oPageNumber.PositionY = 20; &oMerger.oPageNumber = &oPageNumber; &sErr = ""; &asNames = CreateArray(&sPdfFile1); &asNames.Push(&sPdfFile2); &bResult = &oMerger.mergePDFs(&asNames, &sOutputPdfFile, &sErr);
See Also
Description
Use this property to specify an already instantiated and populated Watermark object to be used with the merged object.
This property is read-write.
Example
Local PSXP_ENGINE:PDFMerger &oMerger; Local PSXP_ENGINE:Watermark &oWatermark; &oMerger = create PSXP_ENGINE:PDFMerger(); &oWatermark = create PSXP_ENGINE:Watermark(); &oWatermark.Text = "DEMO"; &oWatermark.TextStartPosX = 200; &oWatermark.TextStartPosY = 400; &oMerger.oWatermark = &oWatermark; &sErr = ""; &asNames = CreateArray(&sPdfFile1); &bResult = &oMerger.mergePDFs(&asNames, &sOutputPdfFile, &sErr);
See Also
This section provides an overview of the Properties class and discusses:
Properties class constructor
Properties class methods
Use the Properties class to specify the properties for setting up the processor configuration. This class is used with the PDFMerger class.
See Also
This section describes the constructor for the Properties class.
Syntax
Properties()
Description
Use the Properties constructor to instantiate a Properties object.
Parameters
None.
Returns
A Properties object.
Example
import PSXP_ENGINE:Properties; Local PSXP_ENGINE:Properties &rProps = create PSXP_ENGINE:Properties();
In this section, the Properties class methods are presented in alphabetical order.
Syntax
GetProperty(Name, OutValue)
Description
Use the GetProperty method to return the value of the specified property.
Parameters
Name |
Specify the name of the property that you want to access the value. |
OutValue |
Specify a string to contain the value of the property you want to access. |
Returns
A Boolean: true if the method completed successfully, false otherwise. If this method returns false, the Error parameter is populated with the text of the error message that occurred.
Example
Local PSXP_ENGINE:Properties &oProp; &oProp = create PSXP_ENGINE:Properties(); %sValue = ""; &bResult = &oProp.getProperty("pdf-security", %sValue);
Syntax
SetProperty(Name, Value)
Description
Use the SetProperty method to specify the value of the specified property.
Parameters
Name |
Specify the name of the property that you want to set. |
Value |
Specify the value of the property that you want to set. |
Returns
A Boolean: true if the method completed successfully, false otherwise. If this method returns false, the Error parameter is populated with the text of the error message that occurred.
Example
Local PSXP_ENGINE:Properties &oProp; &oProp = create PSXP_ENGINE:Properties(); &bResult = &oProp.setProperty("pdf-security", "true");
This section provides an overview of the Watermark class and discusses:
Watermark class constructor
Watermark class properties
Use the Watermark class to specify a watermark for a merged PDF file. Objects in this class are used with the Watermark property of the PDFMerger class. You can generate a watermark either using text or an image. You can either use the text properties or the image properties. You cannot use both.
The following are the image properties of the Watermark class:
ImageFile
ImageLowerLeftX
ImageLowerLeftY
ImageUpperRightX
ImageUpperRightY
The following are the text properties of the Watermark class:
Text
TextAngle
TextFontName
TextFontSize
TextStartPosX
TextStartPosY
See Also
This section describes the constructor for the Watermark class.
Syntax
Watermark()
Description
Use the Watermark constructor to instantiate a Watermark object.
Parameters
None.
Returns
A Watermark object.
Example
import PSXP_ENGINE:Watermark; Local PSXP_ENGINE:Watermark &rProps = create PSXP_ENGINE:Watermark();
In this section, the Watermark class properties are presented in alphabetical order.
Description
Use the ImageFile property to specify the full path name of an image file to be used for the watermark.
Forward or back slashes are used in the path according to the operating system of the application server or process scheduler server. That is, on Unix servers, the directory separator is a forward slash, while a Windows server returns a path with back slashes.
This property is read-write.
Description
Use the ImageFileLowerLeftX property to specify the lower left, X-axis position for the watermark, as a number.
This property is read-write.
Description
Use the ImageFileLowerLeftY property to specify the lower left, Y-axis position for the watermark, as a number.
This property is read-write.
Description
Use the ImageFileUpperRightX property to specify the upper right, X-axis position for the watermark, as a number.
This property is read-write.
Description
Use the ImageFileUpperRightY property to specify the upper right, Y-axis position for the watermark, as a number.
This property is read-write.
Description
Use the PageIndex property to specify the page where the watermark begins. For example, you might not want a watermark to display on a cover page. The default value is 0, which sets the watermark on all pages (page index starts at 1.)
This property is read-write.
Description
Use the Text property to specify the text for the watermark, as a string.
This property is read-write.
Description
Use the TextAngle property to specify the angle of the watermark text across the page. You must specify a number between 1 and 360.
This property is read-write.
Description
Use the TextFontName property to specify the name of the font to be used for the text for the watermark.
This property is read-write.
Description
Use the TextFontSize property to specify the size of the text font. The default value is 8.
This property is read-write.
Description
Use the TextStartPosX property to specify the starting position, X-axis location for the text to be used as the watermark.
This property is read-write.
Description
Use the TextStartPosY property to specify the starting position, Y-axis location for the text to be used as the watermark.
This property is read-write.
The following example provides a complete example of the code first, then goes through the program line by line.
In the following example, a report is created from an existing report definition. It is populated with an already instantiated and populated XmlDoc object, then published.
The following is the complete code sample: the steps explain each line.
import PSXP_RPTDEFNMANAGER:ReportDefn; Local string &sFileName = "c:\path\filename.xml"; Local string &rptDefnId = "Financial"; Local string &LanguageCode = "ENG"; Local date &effdt = Date(20090821); Local string &outputfmt = "HTM"; Local string &folderName = "General"; Local string &serverName = "PSNT"; Local PSXP_RPTDEFNMANAGER:ReportDefn &rptDefn; &rptDefn = create PSXP_RPTDEFNMANAGER:ReportDefn(&rptDefnId); &rptDefn.Get(); &rptDefn.SetRuntimeDataXMLFile(&sFileName); &rptDefn.ProcessReport("", &languageCd, &effdt, &outputfmt); &rptDefn.Publish(&serverName, "", &folderName, &PID);
To generate and publish a report:
Import the appropriate application class.
Because this program generates and publishes a report, you need to import the report manager definition class.
import PSXP_RPTDEFNMANAGER:ReportDefn;
Initialize variables.
The variable declaration strings not only specify values for the variables, but give them type and scope as well. This can be very useful when debugging.
Local string &sFileName = "c:\path\filename.xml"; Local string &rptDefnId = "Financial"; Local string &LanguageCode = "ENG"; Local date &effdt = Date(20090821); Local string &outputfmt = "HTM"; Local string &folderName = "General"; Local string &serverName = "PSNT"; Local PSXP_RPTDEFNMANAGER:ReportDefn &rptDefn;
Instantiate the report definition object and initialize it.
After you instantiate a report definition object, you must initialize it and populate it using the Get method.
&rptDefn = create PSXP_RPTDEFNMANAGER:ReportDefn(&rptDefnId); &rptDefn.Get();
Specify the data for the report.
This report uses an XML file as the data source, so you must specify the runtime data source for the report before you process it.
&rptDefn.SetRuntimeDataXMLFile(&sFileName);
Process the report.
You must process the report, generate a version of it for the report repository, before you can distribute the report.
&rptDefn.ProcessReport("", &languageCd, &effdt, &outputfmt);
Publish the report.
After you've generated the report, you may want to publish it to another location.
&rptDefn.Publish(&serverName, "", &folderName, &PID);