com.adobe.livecycle.generatepdf.client
Class GeneratePdfServiceClient

java.lang.Object
  extended by com.adobe.livecycle.generatepdf.client.GeneratePdfServiceClient

public class GeneratePdfServiceClient
extends java.lang.Object

Provides methods for creating PDF documents from other file types, for converting PDF documents to other file types, and for optimizing PDF documents. To see how this class is used to generate PDF documents, see Converting Between File Formats and PDF in Programming with Forms.


Constructor Summary
GeneratePdfServiceClient(ServiceClientFactory factory)
          This is the constructor for creating a Generate PDF client instance.
 
Method Summary
 CreatePDFResult createPDF(Document inDoc, java.lang.String inputFileName, java.lang.String fileTypeSettings, java.lang.String pdfSettings, java.lang.String securitySettings, Document inSettingsDoc, Document inXMPDoc)
          Converts different file formats into PDF documents.
 CreatePDFResult createPDF2(Document inDoc, java.lang.String inputFileExtension, java.lang.String fileTypeSettings, java.lang.String pdfSettings, java.lang.String securitySettings, Document inSettingsDoc, Document inXMPDoc)
          Converts different file formats into PDF documents.
 CreatePDFResult createPDF3(java.util.Map inputDocuments, java.lang.String primaryFileToConvertFilter, java.lang.String inputFileExtension, java.lang.String fileTypeSettings, java.lang.String pdfSettings, java.lang.String securitySettings, Document inSettingsDoc, Document inXMPDoc)
          Converts different file formats into PDF documents.
 ExportPDFResult exportPDF(Document inputDocument, java.lang.String inputFileName, ConvertPDFFormatType formatType, Document inSettingsDoc)
          Converts a PDF document to the specified file type.
 ExportPDFResult exportPDF2(Document inputDocument, java.lang.String inputFileExtension, ConvertPDFFormatType formatType, Document inSettingsDoc)
          Converts a PDF document to the specified different file type.
 HtmlToPdfResult htmlFileToPDF(Document inputDocument, java.lang.String fileTypeSettingsName, java.lang.String securitySettingsName, Document inSettingsDoc, Document inXMPDoc)
          Creates a PDF document from an input HTML file, Txt file or a ZIP file containing HTML files and/or Image files.
 HtmlToPdfResult htmlToPDF(java.lang.String inputUrl, java.lang.String fileTypeSettingsName, java.lang.String securitySettingsName, Document inSettingsDoc, Document inXMPDoc)
          Creates a PDF document from an HTML file located at a given URL.
 HtmlToPdfResult htmlToPDF2(java.lang.String inputUrl, java.lang.String fileTypeSettingsName, java.lang.String securitySettingsName, Document inSettingsDoc, Document inXMPDoc)
          Creates a PDF document from an HTML file located at a given URL.
 OptimizePDFResult optimizePDF(Document inputDocument, java.lang.String fileTypeSettings, Document inSettingsDoc)
          Optimizes the input PDF document by reducing its size.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneratePdfServiceClient

public GeneratePdfServiceClient(ServiceClientFactory factory)
This is the constructor for creating a Generate PDF client instance.

Parameters:
factory - A ServiceClientFactory instance with valid credentials of the server where the service is deployed.
Method Detail

createPDF

public CreatePDFResult createPDF(Document inDoc,
                                 java.lang.String inputFileName,
                                 java.lang.String fileTypeSettings,
                                 java.lang.String pdfSettings,
                                 java.lang.String securitySettings,
                                 Document inSettingsDoc,
                                 Document inXMPDoc)
                          throws InvalidParameterException,
                                 ConversionException,
                                 FileFormatNotSupportedException
Converts different file formats into PDF documents. The supported file formats are Microsoft (MS) Word, MS Powerpoint, MS Excel, MS Project, MS Visio, MS Publisher, and Autocad. In addition to these, any third party generic application type for which you have a PDF generating application can be plugged into your application using this method.

Some of the parameters are optional, which means that null values may be provided if they are not needed. Security permissions, PDF Output Settings and metadata information can optionally be applied to the resultant PDF document.

Parameters:
inDoc - This mandatory parameter contains an instance of the Document whose content is to be converted. For this object, it is recommended that you either use the appropriate Document constructor if you have access to the file, or that you use the com.adobe.idp.Document.setAttribute() method if you only have access to the stream.
inputFileName - This optional parameter contains the file name, with the appropriate extension, of the document to be converted.
fileTypeSettings - Name of a file type settings instance that is defined on the Forms server. The Forms Administration Console window for Generate PDF lets you view the currently defined file type settings. It also lets you create custom file type settings. If the inSettingsDoc parameter specifies a non-NULL value, this parameter is ignored. If this parameter and the inSettingsDoc parameter are both null, this method uses the default file type settings instance that is defined on the Forms server.
pdfSettings - Name of the Adobe PDF Settings to apply. Forms installs the following settings, although the exact names differ depending on locale:
  • "High Quality Print"
  • "Oversized Pages"
  • "PDFA1b 2005 CMYK"
  • "PDFA1b 2005 RGB"
  • "PDFX1a 2001"
  • "PDFX3 2002"
  • "Press Quality"
  • "Smallest File Size"
  • "Standard"
To determine the names of Adobe PDF Settings on your system, check the Forms Administration Console web pages for PDF Generator. To determine the default Adobe PDF Settings, check the Forms Administration Console web pages for PDF Generator.
securitySettings - Name of a security settings instance that is defined on the Forms server. These settings can be viewed by using the Forms Administration Console window for Generate PDF. You can also use this same window to create custom settings. The default security setting is "No Security", although the exact name differs depending on locale. If the inSettingsDoc parameter specifies a non-NULL value, this parameter is ignored. If this parameter and the inSettingsDoc parameter are both null, this method uses the default security settings defined on the Forms server.
inSettingsDoc - file2pdf-settings XML file that contains file type settings to use for optimization, including the file type settings PDF settings, and security settings used by this method. For information about this file, see the description for the createPDF2() method.
inXMPDoc - This optional parameter contains the file containing metadata information to be applied to the generated PDF document. Only UTF-8 encoded XMP metadata is supported.
Returns:
The result of the operation. It contains the created PDF document and the log document, if any.
Throws:
InvalidParameterException
ConversionException
FileFormatNotSupportedException

htmlToPDF

public HtmlToPdfResult htmlToPDF(java.lang.String inputUrl,
                                 java.lang.String fileTypeSettingsName,
                                 java.lang.String securitySettingsName,
                                 Document inSettingsDoc,
                                 Document inXMPDoc)
                          throws InvalidParameterException,
                                 ConversionException,
                                 FileFormatNotSupportedException
Creates a PDF document from an HTML file located at a given URL.

Parameters:
inputUrl - The URL for the HTML file.
fileTypeSettingsName - Name of a file type settings instance that is defined on the Forms server. The Forms Administration Console window for Generate PDF lets you view the currently defined file type settings. It also lets you create custom file type settings. If the inSettingsDoc parameter specifies a non-NULL value, this parameter is ignored. If this parameter and the inSettingsDoc parameter are both null, this method uses the default file type settings instance that is defined on the Forms server.
securitySettingsName - Name of a security settings instance that is defined on the Forms server. These settings can be viewed by using the Forms Administration Console window for Generate PDF. You can also use this same window to create custom settings. The default security setting is "No Security", although the exact name differs depending on locale. If the inSettingsDoc parameter specifies a non-NULL value, this parameter is ignored. If this parameter and the inSettingsDoc parameter are both null, this method uses the default security settings defined on the Forms server.
inSettingsDoc - file2pdf-settings XML file that contains file type settings to use for optimization, including the file type settings and security settings used by this method. For information about this file, see the description for the createPDF2() method.
inXMPDoc - This optional parameter contains the file containing metadata information to be applied to the generated PDF document. Only UTF-8 encoded XMP metadata is supported.
Returns:
The result of the operation. The PDF document generated from the URL can be obtained from this result.
Throws:
InvalidParameterException
ConversionException
FileFormatNotSupportedException

htmlFileToPDF

public HtmlToPdfResult htmlFileToPDF(Document inputDocument,
                                     java.lang.String fileTypeSettingsName,
                                     java.lang.String securitySettingsName,
                                     Document inSettingsDoc,
                                     Document inXMPDoc)
                              throws InvalidParameterException,
                                     ConversionException,
                                     FileFormatNotSupportedException
Creates a PDF document from an input HTML file, Txt file or a ZIP file containing HTML files and/or Image files. For ZIP files, this method searches the ZIP contents for the index.html file. It then uses the index.html as the document root.

Parameters:
inDoc - This mandatory parameter contains an instance of the Document whose content is to be converted. For this object, it is recommended that you either use the appropriate Document constructor if you have access to the file, or that you use the com.adobe.idp.Document.setAttribute() method if you only have access to the stream.
fileTypeSettingsName - Name of a file type settings instance that is defined on the Forms server. The Forms Administration Console window for Generate PDF lets you view the currently defined file type settings. It also lets you create custom file type settings. If the inSettingsDoc parameter specifies a non-NULL value, this parameter is ignored. If this parameter and the inSettingsDoc parameter are both null, this method uses the default file type settings instance that is defined on the Forms server.
securitySettingsName - Name of a security settings instance that is defined on the Forms server. These settings can be viewed by using the Forms Administration Console window for Generate PDF. You can also use this same window to create custom settings. The default security setting is "No Security", although the exact name differs depending on locale. If the inSettingsDoc parameter specifies a non-NULL value, this parameter is ignored. If this parameter and the inSettingsDoc parameter are both null, this method uses the default security settings defined on the Forms server.
inSettingsDoc - A file2pdf-settings XML file that contains all settings used by the Generate PDF service, including the file type settings and security settings used by this method. For information about this file, see the description for the createPDF2() method.
inXMPDoc - An XML file that specifies metadata information to be applied to the generated PDF document. Only UTF-8 encoded XMP metadata is supported.
Returns:
The result of the operation. The PDF document generated from the input file can be obtained from this result.
Throws:
InvalidParameterException
ConversionException
FileFormatNotSupportedException

exportPDF

public ExportPDFResult exportPDF(Document inputDocument,
                                 java.lang.String inputFileName,
                                 ConvertPDFFormatType formatType,
                                 Document inSettingsDoc)
                          throws InvalidParameterException,
                                 ConversionException,
                                 FileFormatNotSupportedException
Converts a PDF document to the specified file type.

Parameters:
inputDocument - The PDF document to be converted.
inputFileName - The name of the input document.
formatType - The target file format to which the PDF document will be converted.
inSettingsDoc - file2pdf-settings XML file that contains file type settings to use for optimization. For information about this file, see the description for the createPDF2() method.
Returns:
The result of the operation. It contains the converted document in the format specified in the formatType parameter.
Throws:
InvalidParameterException
ConversionException
FileFormatNotSupportedException
See Also:
ConvertPDFFormatType

createPDF2

public CreatePDFResult createPDF2(Document inDoc,
                                  java.lang.String inputFileExtension,
                                  java.lang.String fileTypeSettings,
                                  java.lang.String pdfSettings,
                                  java.lang.String securitySettings,
                                  Document inSettingsDoc,
                                  Document inXMPDoc)
                           throws InvalidParameterException,
                                  ConversionException,
                                  FileFormatNotSupportedException
Converts different file formats into PDF documents. The supported file formats include Microsoft (MS) Word, MS Powerpoint, and Autocad. For a complete list of supported file formats, see the Services Guide. In addition to the supported file formats, you can add support for any third party generic application type (see Programming with Forms).

This method obtains conversion parameters from one the following sources (listed in order of consideration):

  1. An XML file that conforms to the file2pdf-settings schema. This file is specified by the inSettingsDoc parameter)
  2. Names of settings defined on the Forms server (specified with the fileTypeSettings, pdfSettings, and securitySettings parameters)
  3. Default settings defined on the Forms server

The file2pdf-settings XML file specified by the inSettingsDoc parameter is an XML file that contains a serialized representation of the PDF Generator settings that can be configured by using the Forms Administration Console. This method uses the following settings from the file2pdf-settings XML file, which is a subset of what the file contains:

This file must conform to the file2pdf-settings.xsd schema, which is installed in the following folder:

Install directory\Forms_SDK\schemas\PDFGenerator.

The file2pdf-settings XML file can contain multiple instances of each of these settings. This method uses only the default settings instances. These default settings instances are identified by the default attribute in the corresponding element. That is, this method uses the filetype-settings element that contains the following attribute: file2pdf-settings/filetype-settings/settings/@default="true" And it uses the security-settings element that contains the following attribute: file2pdf-settings/security-settings/settings/@default="true"

Parameters:
inDoc - This mandatory parameter contains an instance of the Document whose content is to be converted. For this object, it is recommended that you either use the appropriate Document constructor if you have access to the file, or that you use the com.adobe.idp.Document.setAttribute() method if you only have access to the stream.
inputFileExtension - This optional parameter contains the file extension of the document to be converted.
fileTypeSettings - Settings to be applied to the generated PDF document. Name of a file type settings instance that is defined on the Forms server. The Forms Administration Console window for Generate PDF lets you view the currently defined file type settings. It also lets you create custom file type settings. If the inSettingsDoc parameter specifies a non-NULL value, this parameter is ignored. If this parameter and the inSettingsDoc parameter are both null, this method uses the default file type settings instance that is defined on the Forms server.
pdfSettings - Name of the Adobe PDF Settings to apply. Forms installs the following settings, although the exact names differ depending on locale:
  • "High Quality Print"
  • "Oversized Pages"
  • "PDFA1b 2005 CMYK"
  • "PDFA1b 2005 RGB"
  • "PDFX1a 2001"
  • "PDFX3 2002"
  • "Press Quality"
  • "Smallest File Size"
  • "Standard"
To determine the names of Adobe PDF Settings on your system, check the Forms Administration Console web pages for PDF Generator. To determine the default Adobe PDF Settings, check the Forms Administration Console web pages for PDF Generator.
securitySettings - Name of a security settings instance that is defined on the Forms server. These settings can be viewed by using the Forms Administration Console window for Generate PDF. You can also use this same window to create custom settings. The default security setting is "No Security", although the exact name differs depending on locale. If the inSettingsDoc parameter specifies a non-NULL value, this parameter is ignored. If this parameter and the inSettingsDoc parameter are both null, this method uses the default security settings defined on the Forms server.
inSettingsDoc - A file2pdf-settings XML file that contains PDF Generator settings, including the file type settings, PDF settings (job options), and security settings used by this method. For information about this file, see the description for this method.
inXMPDoc - This optional parameter contains the file containing metadata information to be applied to the generated PDF document. Only UTF-8 encoded XMP metadata is supported.
Returns:
The result of the operation. It contains the created PDF document and the log document, if any.
Throws:
InvalidParameterException
ConversionException
FileFormatNotSupportedException

createPDF3

public CreatePDFResult createPDF3(java.util.Map inputDocuments,
                                  java.lang.String primaryFileToConvertFilter,
                                  java.lang.String inputFileExtension,
                                  java.lang.String fileTypeSettings,
                                  java.lang.String pdfSettings,
                                  java.lang.String securitySettings,
                                  Document inSettingsDoc,
                                  Document inXMPDoc)
                           throws InvalidParameterException,
                                  ConversionException,
                                  FileFormatNotSupportedException
Converts different file formats into PDF documents. The supported file formats include Microsoft (MS) Word, MS Powerpoint, and Autocad. For a complete list of supported file formats, see the Services Guide. In addition to the supported file formats, you can add support for any third party generic application type (see Programming with Forms).

This method obtains conversion parameters from one the following sources (listed in order of consideration):

  1. An XML file that conforms to the file2pdf-settings schema. This file is specified by the inSettingsDoc parameter)
  2. Names of settings defined on the Forms server (specified with the fileTypeSettings, pdfSettings, and securitySettings parameters)
  3. Default settings defined on the Forms server

The file2pdf-settings XML file specified by the inSettingsDoc parameter is an XML file that contains a serialized representation of the PDF Generator settings that can be configured by using the Forms Administration Console. This method uses the following settings from the file2pdf-settings XML file, which is a subset of what the file contains:

This file must conform to the file2pdf-settings.xsd schema, which is installed in the following folder:

Install directory\Forms_SDK\schemas\PDFGenerator.

The file2pdf-settings XML file can contain multiple instances of each of these settings. This method uses only the default settings instances. These default settings instances are identified by the default attribute in the corresponding element. That is, this method uses the filetype-settings element that contains the following attribute: file2pdf-settings/filetype-settings/settings/@default="true" And it uses the security-settings element that contains the following attribute: file2pdf-settings/security-settings/settings/@default="true"

Parameters:
inputDocuments - This mandatory parameter is a java.util.Map containing instances of Document representing the document to be converted, along with resources referred to by this document. For this object, it is recommended that you populate the map either using the appropriate Document constructor if you have access to the file, or using the com.adobe.idp.Document.setAttribute() method if you only have access to the stream.
primaryFileToConvertFilter - This mandatory parameter is a java.lang.String representing the pattern matching the name of the file to be converted.
inputFileExtension - This optional parameter contains the file extension of the document to be converted.
fileTypeSettings - Settings to be applied to the generated PDF document. Name of a file type settings instance that is defined on the Forms server. The Forms Administration Console window for Generate PDF lets you view the currently defined file type settings. It also lets you create custom file type settings. If the inSettingsDoc parameter specifies a non-NULL value, this parameter is ignored. If this parameter and the inSettingsDoc parameter are both null, this method uses the default file type settings instance that is defined on the Forms server.
pdfSettings - Name of the Adobe PDF Settings to apply. Forms installs the following settings, although the exact names differ depending on locale:
  • "High Quality Print"
  • "Oversized Pages"
  • "PDFA1b 2005 CMYK"
  • "PDFA1b 2005 RGB"
  • "PDFX1a 2001"
  • "PDFX3 2002"
  • "Press Quality"
  • "Smallest File Size"
  • "Standard"
To determine the names of Adobe PDF Settings on your system, check the Forms Administration Console web pages for PDF Generator. To determine the default Adobe PDF Settings, check the Forms Administration Console web pages for PDF Generator.
securitySettings - Name of a security settings instance that is defined on the Forms server. These settings can be viewed by using the Forms Administration Console window for Generate PDF. You can also use this same window to create custom settings. The default security setting is "No Security", although the exact name differs depending on locale. If the inSettingsDoc parameter specifies a non-NULL value, this parameter is ignored. If this parameter and the inSettingsDoc parameter are both null, this method uses the default security settings defined on the Forms server.
inSettingsDoc - A file2pdf-settings XML file that contains PDF Generator settings, including the file type settings, PDF settings (job options), and security settings used by this method. For information about this file, see the description for this method.
inXMPDoc - This optional parameter contains the file containing metadata information to be applied to the generated PDF document. Only UTF-8 encoded XMP metadata is supported.
Returns:
The result of the operation. It contains the created PDF document and the log document, if any.
Throws:
InvalidParameterException
ConversionException
FileFormatNotSupportedException

exportPDF2

public ExportPDFResult exportPDF2(Document inputDocument,
                                  java.lang.String inputFileExtension,
                                  ConvertPDFFormatType formatType,
                                  Document inSettingsDoc)
                           throws InvalidParameterException,
                                  ConversionException,
                                  FileFormatNotSupportedException
Converts a PDF document to the specified different file type.

Parameters:
inputDocument - The PDF document to be converted.
inputFileExtension - The extension of the input file.
formatType - The target file format to which the PDF document will be converted.
inSettingsDoc - A file2pdf-settings XML file that contains PDF Generator settings. For information about this file, see the description for the createPDF2() method.
Returns:
The result of the operation. It contains the converted document in the format specified in the formatType parameter.
Throws:
InvalidParameterException
ConversionException
FileFormatNotSupportedException
See Also:
ConvertPDFFormatType

optimizePDF

public OptimizePDFResult optimizePDF(Document inputDocument,
                                     java.lang.String fileTypeSettings,
                                     Document inSettingsDoc)
                              throws ConversionException,
                                     InvalidParameterException,
                                     FileFormatNotSupportedException
Optimizes the input PDF document by reducing its size. This method also converts the PDF document to the PDF version specified in the optimization parameters. This method supports the same optimization settings as Adobe Acrobat.

Parameters:
inDoc - This mandatory parameter contains an instance of the Document whose content is to be optimized. For this object, it is recommended that you either use the appropriate Document constructor if you have access to the file, or that you use the com.adobe.idp.Document.setAttribute() method if you only have access to the stream.
fileTypeSettings - Name of a file type settings instance that is defined on the Forms server. The Forms Administration Console window for Generate PDF lets you view the currently defined file type settings. It also lets you create custom file type settings. If the inSettingsDoc parameter specifies a non-NULL value, this parameter is ignored. If this parameter and the inSettingsDoc parameter are both null, this method uses the default file type settings instance that is defined on the Forms server.
inSettingsDoc - file2pdf-settings XML file that contains file type settings to use for optimization, including the file type settings used by this method. For information about this file, see the description for the createPDF2() method.
Returns:
An object that exposes a method for getting the optimized PDF document.
Throws:
ConversionException
InvalidParameterException
FileFormatNotSupportedException

htmlToPDF2

public HtmlToPdfResult htmlToPDF2(java.lang.String inputUrl,
                                  java.lang.String fileTypeSettingsName,
                                  java.lang.String securitySettingsName,
                                  Document inSettingsDoc,
                                  Document inXMPDoc)
                           throws InvalidParameterException,
                                  ConversionException,
                                  FileFormatNotSupportedException
Creates a PDF document from an HTML file located at a given URL.

Parameters:
inputUrl - The URL for the HTML file.
fileTypeSettingsName - Name of a file type settings instance that is defined on the Forms server. The Forms Administration Console window for Generate PDF lets you view the currently defined file type settings. It also lets you create custom file type settings. If the inSettingsDoc parameter specifies a non-NULL value, this parameter is ignored. If this parameter and the inSettingsDoc parameter are both null, this method uses the default file type settings instance that is defined on the Forms server.
securitySettingsName - Name of a security settings instance that is defined on the Forms server. These settings can be viewed by using the Forms Administration Console window for Generate PDF. You can also use this same window to create custom settings. The default security setting is "No Security", although the exact name differs depending on locale. If the inSettingsDoc parameter specifies a non-NULL value, this parameter is ignored. If this parameter and the inSettingsDoc parameter are both null, this method uses the default security settings defined on the Forms server.
inSettingsDoc - file2pdf-settings XML file that contains file type settings to use for optimization, including the file type settings and security settings used by this method. For information about this file, see the description for the createPDF2() method.
inXMPDoc - This optional parameter contains the file containing metadata information to be applied to the generated PDF document. Only UTF-8 encoded XMP metadata is supported.
Returns:
The result of the operation. The PDF document generated from the URL can be obtained from this result.
Throws:
InvalidParameterException
ConversionException
FileFormatNotSupportedException