PDFreactor API

com.realobjects.pdfreactor
Class PDFreactor

java.lang.Object
  extended bycom.realobjects.pdfreactor.PDFreactor

public class PDFreactor
extends Object

PDFreactor converts XML/XHTML documents into PDF and provides a large number of settings for the conversion process.

This sample demonstrates the use of PDFreactor:

 PDFreactor pdfReactor = new PDFreactor();
 
 FileOutputStream outputStream = new FileOutputStream("realobjects.pdf");
 
 pdfReactor.setAddBookmarks(true);
 pdfReactor.setAddLinks(true);
 
 byte[] pdf = pdfReactor.renderDocumentFromURL("http://www.realobjects.com/");
 
 outputStream.write(pdf);
 outputStream.close();

Please note: A new instance of PDFreactor should be created for every conversion.

For more information please have a look at the PDFreactor manual.


Field Summary
static int CLEANUP_CYBERNEKO
          Indicates that the CyberNeko HTML parser will be used to perform a cleanup when loading a non-well-formed document.
static int CLEANUP_JTIDY
          Indicates that JTidy will be used to perform a cleanup when loading a non-well-formed document.
static int CLEANUP_NONE
          Indicates that no cleanup will be performed when loading a document.
static int CLEANUP_TAGSOUP
          Indicates that tagsoup will be used to perform a cleanup when loading a non-well-formed document.
static int COLOR_SPACE_CMYK
          The color space CMYK
static int COLOR_SPACE_RGB
          The color space RGB
static int CONFORMANCE_PDF
          PDF with no additional restrictions (default)
static int CONFORMANCE_PDFA
          PDF/A-1a (ISO 19005-1 Level A)
static int DOCTYPE_AUTODETECT
          Indicates that the document type will be detected automatically.
static int DOCTYPE_XHTML
          Indicates that the document type will be set to XHTML.
static int DOCTYPE_XML
          Indicates that the document type will be set to generic XML.
static int ENCRYPTION_128
          Indicates that the document will be encrypted using RC4 128 bit encryption.
static int ENCRYPTION_40
          Indicates that the document will be encrypted using RC4 40 bit encryption.
static int ENCRYPTION_NONE
          Indicates that the document will not be encrypted.
static int EXCEEDING_CONTENT_AGAINST_NONE
          Do not log exceeding content
static int EXCEEDING_CONTENT_AGAINST_PAGE_BORDERS
          Log content exceeding the edges of its page
static int EXCEEDING_CONTENT_AGAINST_PAGE_CONTENT
          Log content exceeding its page content area (overlaps the page margin)
static int EXCEEDING_CONTENT_AGAINST_PARENT
          Log content exceeding its container
static int EXCEEDING_CONTENT_ANALYZE_CONTENT
          Log exceeding content
static int EXCEEDING_CONTENT_ANALYZE_CONTENT_AND_BOXES
          Log exceeding content and all boxes
static int EXCEEDING_CONTENT_ANALYZE_CONTENT_AND_STATIC_BOXES
          Log exceeding content and boxes without absolute positioning
static int EXCEEDING_CONTENT_ANALYZE_NONE
          Do not log exceeding content
static String KEYSTORE_TYPE_JKS
          Keystore type "jks"
static String KEYSTORE_TYPE_PKCS12
          Keystore type "pkcs12"
static int LOG_LEVEL_DEBUG
          Indicates that debug, info, warn and fatal log events will be logged.
static int LOG_LEVEL_FATAL
          Indicates that only fatal log events will be logged.
static int LOG_LEVEL_INFO
          Indicates that info, warn and fatal log events will be logged.
static int LOG_LEVEL_NONE
          Indicates that no log events will be logged.
static int LOG_LEVEL_PERFORMANCE
          Indicates that all log events will be logged.
static int LOG_LEVEL_WARN
          Indicates that warn and fatal log events will be logged.
static int MERGE_MODE_APPEND
          Default merge mode: Append converted document to existing PDF
static int MERGE_MODE_OVERLAY
          Alternate merge mode (overlay): Adding converted document above the existing PDF
static int MERGE_MODE_OVERLAY_BELOW
          Alternate merge mode (overlay): Adding converted document below the existing PDF
static int MERGE_MODE_PREPEND
          Alternate merge mode: Prepend converted document to existing PDF
static int OVERLAY_REPEAT_ALL_PAGES
          All pages of the shorter document are repeated, to overlay all pages of the longer document
static int OVERLAY_REPEAT_LAST_PAGE
          Last page of the shorter document is repeated, to overlay all pages of the longer document
static int OVERLAY_REPEAT_NONE
          No pages of the shorter document are repeated, leaving some pages of the longer document without overlay
static String PAGE_ORDER_BOOKLET
          Page order mode to arrange all pages in booklet order
static String PAGE_ORDER_BOOKLET_RTL
          Page order mode to arrange all pages in right-to-left booklet order
static String PAGE_ORDER_EVEN
          Page order mode to keep even pages only
static String PAGE_ORDER_ODD
          Page order mode to keep odd pages only
static String PAGE_ORDER_REVERSE
          Page order mode to reverse the page order
static int PAGES_PER_SHEET_DIRECTION_DOWN_LEFT
          Arranges the pages on a sheet from top to bottom and right to left
static int PAGES_PER_SHEET_DIRECTION_DOWN_RIGHT
          Arranges the pages on a sheet from top to bottom and left to right
static int PAGES_PER_SHEET_DIRECTION_LEFT_DOWN
          Arranges the pages on a sheet from right to left and top to bottom
static int PAGES_PER_SHEET_DIRECTION_LEFT_UP
          Arranges the pages on a sheet from right to left and bottom to top
static int PAGES_PER_SHEET_DIRECTION_RIGHT_DOWN
          Arranges the pages on a sheet from left to right and top to bottom
static int PAGES_PER_SHEET_DIRECTION_RIGHT_UP
          Arranges the pages on a sheet from left to right and bottom to top
static int PAGES_PER_SHEET_DIRECTION_UP_LEFT
          Arranges the pages on a sheet from bottom to top and right to left
static int PAGES_PER_SHEET_DIRECTION_UP_RIGHT
          Arranges the pages on a sheet from bottom to top and left to right
static int PROCESSING_PREFERENCES_SAVE_MEMORY_IMAGES
          Processing preferences flag for the memory saving mode for images
static int SIGNING_MODE_SELF_SIGNED
          Signing mode for self-signed certificates
static int SIGNING_MODE_VERISIGN_SIGNED
          Signing mode for VeriSign certificates
static int SIGNING_MODE_WINCER_SIGNED
          Signing mode for Windows certificates
static int VIEWER_PREFERENCES_CENTER_WINDOW
          Position the document's window in the center of the screen.
static int VIEWER_PREFERENCES_DIRECTION_L2R
          Position pages in ascending order from left to right.
static int VIEWER_PREFERENCES_DIRECTION_R2L
          Position pages in ascending order from right to left.
static int VIEWER_PREFERENCES_DISPLAY_DOC_TITLE
          Display the document's title in the top bar.
static int VIEWER_PREFERENCES_DUPLEX_FLIP_LONG_EDGE
          Print dialog default setting: duplex (long edge)
static int VIEWER_PREFERENCES_DUPLEX_FLIP_SHORT_EDGE
          Print dialog default setting: duplex (short edge)
static int VIEWER_PREFERENCES_DUPLEX_SIMPLEX
          Print dialog default setting: simplex
static int VIEWER_PREFERENCES_FIT_WINDOW
          Resize the document's window to fit the size of the first displayed page.
static int VIEWER_PREFERENCES_HIDE_MENUBAR
          Hide the viewer application's menu bar when the document is active.
static int VIEWER_PREFERENCES_HIDE_TOOLBAR
          Hide the viewer application's tool bars when the document is active.
static int VIEWER_PREFERENCES_HIDE_WINDOW_UI
          Hide user interface elements in the document's window.
static int VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_NONE
          Show document outline panel on exiting full-screen mode.
static int VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_OC
          Show attachments panel on exiting full-screen mode.
static int VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_OUTLINES
          Show thumbnail images panel on exiting full-screen mode.
static int VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_THUMBS
          Show optional content group panel on exiting full-screen mode.
static int VIEWER_PREFERENCES_PAGE_LAYOUT_ONE_COLUMN
          Display the pages in one column.
static int VIEWER_PREFERENCES_PAGE_LAYOUT_SINGLE_PAGE
          Display one page at a time.
static int VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_COLUMN_LEFT
          Display the pages in two columns, with odd numbered pages on the left.
static int VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_COLUMN_RIGHT
          Display the pages in two columns, with odd numbered pages on the right.
static int VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_PAGE_LEFT
          Display two pages at a time, with odd numbered pages on the left.
static int VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_PAGE_RIGHT
          Display two pages at a time, with odd numbered pages on the right.
static int VIEWER_PREFERENCES_PAGE_MODE_FULLSCREEN
          Switch to fullscreen mode on startup.
static int VIEWER_PREFERENCES_PAGE_MODE_USE_ATTACHMENTS
          Show attachments panel on startup.
static int VIEWER_PREFERENCES_PAGE_MODE_USE_NONE
          Show no panel on startup.
static int VIEWER_PREFERENCES_PAGE_MODE_USE_OC
          Show optional content group panel on startup.
static int VIEWER_PREFERENCES_PAGE_MODE_USE_OUTLINES
          Show document outline panel on startup.
static int VIEWER_PREFERENCES_PAGE_MODE_USE_THUMBS
          Show thumbnail images panel on startup.
static int VIEWER_PREFERENCES_PICKTRAYBYPDFSIZE_FALSE
          Print dialog default setting: do not pick tray by PDF size
static int VIEWER_PREFERENCES_PICKTRAYBYPDFSIZE_TRUE
          Print dialog default setting: pick tray by PDF size
static int VIEWER_PREFERENCES_PRINTSCALING_APPDEFAULT
          Print dialog default setting: set scaling to application default value.
static int VIEWER_PREFERENCES_PRINTSCALING_NONE
          Print dialog default setting: disabled scaling
 
Constructor Summary
PDFreactor()
          Creates an instance of PDFreactor.
 
Method Summary
 void addProgressEventListener(ProgressEventListener listener)
          Adds a ProgressEventListener.
 void addUserStyleSheet(InputSource inputSource)
          Adds a user style sheet to the document.
 void addUserStyleSheet(String content, String media, String title, String uri)
          Adds a user style sheet to the document.
 void addXSLTStyleSheet(String content, String uri)
          Adds an XSLT style sheet to the document.
 String getError()
          Returns the error messages generated during rendering.
 ExceedingContent[] getExceedingContents()
          Provides information about content exceeding its page or parent.
 String getLog()
          Returns the log messages generated during rendering based on the log level.
 Logger getLogger()
          Returns the Logger used by this PDFreactor.
 int getNumberOfPages(boolean pdf)
          Returns the number of pages of the document after conversion.
 void removeAllUserStyleSheets()
          Removes all user style sheets.
 void removeAllXSLTStyleSheets()
          Removes all XSLT style sheets.
 void removeProgressEventListener(ProgressEventListener listener)
          Removes a ProgressEventListener.
 void renderDocument(InputSource inputSource, OutputStream outputStream)
          Generates a PDF document from an InputSource.
 byte[] renderDocumentFromByteArray(byte[] array)
          Generates a PDF document from an XML document inside a byte array.
 byte[] renderDocumentFromContent(String content)
          Generates a PDF document from an XML document inside a String.
 byte[] renderDocumentFromURL(String url)
          Generates a PDF document from an XML document at a URL.
 void setAddBookmarks(boolean value)
          Enables or disables bookmarks in the PDF document.
 void setAddLinks(boolean value)
          Enables or disables links in the PDF document.
 void setAddPreviewImages(boolean value)
          Enables or disables embedding of image previews per page in the PDF document.
 void setAddTags(boolean value)
          Enables or disables tagging of the PDF document.
 void setAllowAnnotations(boolean value)
          Enables or disables the 'annotations' restriction in the PDF document.
 void setAllowAssembly(boolean value)
          Enables or disables the 'assembly' restriction in the PDF document.
 void setAllowCopy(boolean value)
          Enables or disables the 'copy' restriction in the PDF document.
 void setAllowDegradedPrinting(boolean value)
          Enables or disables the 'degraded printing' restriction in the PDF document.
 void setAllowFillIn(boolean value)
          Enables or disables the 'fill in' restriction in the PDF document.
 void setAllowModifyContents(boolean value)
          Enables or disables the 'modify contents' restriction in the PDF document.
 void setAllowPrinting(boolean value)
          Enables or disables the 'printing' restriction in the PDF document.
 void setAllowScreenReaders(boolean value)
          Enables or disables the 'screen readers' restriction in the PDF document.
 void setAppendLog(boolean value)
          Specifies whether or not the log data should be added to the PDF document.
 void setAuthenticationCredentials(String username, String password)
          Enables access to resources that are secured via Basic or Digest authentication.
 void setAuthor(String value)
          Sets the value of the author field of the PDF document.
 void setBaseURL(String value)
          Sets the base URL of the XML document.
 void setBookletMode(String sheetSize, String sheetMargin, boolean rtl)
          Convenience method to set pages-per-sheet properties and page order in one step to create a booklet.
 void setCacheFonts(boolean value)
          Enables or disables caching of font information.
 void setCleanupTool(int value)
          Sets the cleanup tool to use for documents with unparsable content.
 void setConformance(int conformance)
          Sets the conformance of the PDF.
 void setCookie(String key, String value)
          Adds a cookie to all outgoing HTTP connections.
 void setCreator(String value)
          Sets the value of creator field of the PDF document.
 void setDefaultColorSpace(int defaultColorSpace)
          Sets whether to convert color key words to CMYK instead of RGB.
 void setDisableFontEmbedding(boolean disableFontEmbedding)
          Sets whether fonts will not be embedded into the resulting PDF.
 void setDisableFontRegistration(boolean value)
          Enables or disables the font registration.
 void setDocumentDefaultLanguage(String languageCode)
          Sets the language used for documents having no explicit language attribute set.
 void setDocumentType(int value)
          Sets the document type.
 void setEncoding(String value)
          Sets the encoding of the document.
 void setEncryption(int value)
          Sets the encryption.
 void setFontCachePath(String location)
          Sets the path of the font cache.
 void setFontDirectory(String location)
          Sets the font directory from which fonts will be read.
 void setFontFallback(String[] fontFallback)
          Sets a list of fallback font families used for character substitution.
 void setFullCompression(boolean value)
          Enables or disables full compression of the PDF document.
 void setKeywords(String value)
          Sets the value of the keywords field of the PDF document.
 void setLicenseKey(String content)
          Sets the license key using a String.
 void setLogExceedingContent(int logExceedingContentAnalyze, int logExceedingContentAgainst)
          Whether to log content exceeding the page.
 void setLogger(Logger object)
          Sets a Logger to receive log messages.
 void setLogLevel(int value)
          Sets the log level.
 void setMergeBeforePDF(boolean value)
          Deprecated. As of PDFreactor 5.0, replaced by PDFreactor.setMergeMode(int)
 void setMergeByteArray(byte[] array)
          This method sets a byte array containing an external PDF document which will be merged with the PDF document generated by the XML source.
 void setMergeByteArrays(byte[][] arrays)
          This method sets an array of byte arrays that contain multiple external PDFs which will be merged with the PDF document generated by the XML source.
 void setMergeMode(int mode)
          Sets the merge mode.
 void setMergeURL(String url)
          This method sets a URL of an external PDF document which will be merged with the PDF document generated by the XML source.
 void setMergeURLs(String[] urls)
          This method sets an array of URLs of external PDF documents which will be merged with the PDF document generated by the XML source.
 void setOutputIntentFromByteArray(String identifier, byte[] profileData)
          Sets the output intent including the identifier and the ICC profile to be embedded into the PDF.
 void setOutputIntentFromURL(String identifier, String profileUrl)
          Sets the output intent including the identifier and the ICC profile to be embedded into the PDF.
 void setOverlayRepeat(int overlayRepeat)
          If one of the documents of an overlay process is shorter than the other, this method allows repeating either its last page or all of its pages in order to overlay all pages of the longer document.
 void setOwnerPassword(String value)
          Sets the owner password of the PDF document.
 void setPageOrder(String order)
          Sets the page order of the direct result of the conversion.
 void setPagesPerSheetProperties(int cols, int rows, String sheetSize, String sheetMargin, String spacing, int direction)
          Sets the properties of a sheet on which multiple pages are being arranged.
 void setPixelsPerInch(int ppi)
          Sets the pixels per inch.
 void setPixelsPerInchShrinkToFit(boolean pixelsPerInchShrinkToFit)
          Whether the pixels per inch should be adapted automatically to avoid content exceeding pages.
 void setPrintDialogPrompt(boolean value)
          Enables or disables a print dialog to be shown upon opening the generated PDF document by a PDF viewer.
 void setProcessingPreferences(int processingPreferences)
          Preferences that influence the conversion process without changing the output
 void setRequestHeader(String key, String value)
          Adds a request header to all outgoing HTTP connections.
 void setSignPDF(String keystoreURL, String keyAlias, String keystorePassword, String keystoreType, int signingMode)
          Sets a digital certificate to sign the newly created PDF.
 void setSubject(String value)
          Sets the value of the subject field of the PDF document.
 void setThrowLicenseExceptions(boolean throwLicenseExceptions)
          Whether an exception should be thrown when no legal full license key is set.
 void setTitle(String value)
          Sets the value of the title field of the PDF document.
 void setUserPassword(String value)
          Sets the user password of the PDF document.
 void setViewerPreferences(int viewerPreferences)
          Sets the page layout and page mode preferences of the PDF.
 void setXSLTMode(boolean value)
          Enables or disables XSLT transformations.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLEANUP_NONE

public static final int CLEANUP_NONE
Indicates that no cleanup will be performed when loading a document. If the loaded document is not well-formed, an exception will be thrown.

See Also:
PDFreactor.setCleanupTool(int), Constant Field Values

CLEANUP_JTIDY

public static final int CLEANUP_JTIDY
Indicates that JTidy will be used to perform a cleanup when loading a non-well-formed document.

See Also:
PDFreactor.setCleanupTool(int), Constant Field Values

CLEANUP_CYBERNEKO

public static final int CLEANUP_CYBERNEKO
Indicates that the CyberNeko HTML parser will be used to perform a cleanup when loading a non-well-formed document.

See Also:
PDFreactor.setCleanupTool(int), Constant Field Values

CLEANUP_TAGSOUP

public static final int CLEANUP_TAGSOUP
Indicates that tagsoup will be used to perform a cleanup when loading a non-well-formed document.

See Also:
PDFreactor.setCleanupTool(int), Constant Field Values

DOCTYPE_AUTODETECT

public static final int DOCTYPE_AUTODETECT
Indicates that the document type will be detected automatically. A document has the type "HTML" if the name of the root element is "html" (ignoring case considerations). In all other cases the document type is "XML".

See Also:
PDFreactor.setDocumentType(int), Constant Field Values

DOCTYPE_XML

public static final int DOCTYPE_XML
Indicates that the document type will be set to generic XML. No default style sheet is used and the document is loaded as is without regards to style elements or attributes.

See Also:
PDFreactor.setDocumentType(int), Constant Field Values

DOCTYPE_XHTML

public static final int DOCTYPE_XHTML
Indicates that the document type will be set to XHTML. The XHTML default style sheet is used and the document is loaded regarding style elements, style attributes and link stylesheets.

See Also:
PDFreactor.setDocumentType(int), Constant Field Values

ENCRYPTION_NONE

public static final int ENCRYPTION_NONE
Indicates that the document will not be encrypted. If encryption is disabled then no user password and no owner password can be used.

See Also:
PDFreactor.setEncryption(int), Constant Field Values

ENCRYPTION_40

public static final int ENCRYPTION_40
Indicates that the document will be encrypted using RC4 40 bit encryption.

See Also:
PDFreactor.setEncryption(int), Constant Field Values

ENCRYPTION_128

public static final int ENCRYPTION_128
Indicates that the document will be encrypted using RC4 128 bit encryption. For normal purposes this value should be used.

See Also:
PDFreactor.setEncryption(int), Constant Field Values

KEYSTORE_TYPE_PKCS12

public static final String KEYSTORE_TYPE_PKCS12
Keystore type "pkcs12"

See Also:
PDFreactor.setSignPDF(String, String, String, String, int), Constant Field Values

KEYSTORE_TYPE_JKS

public static final String KEYSTORE_TYPE_JKS
Keystore type "jks"

See Also:
PDFreactor.setSignPDF(String, String, String, String, int), Constant Field Values

SIGNING_MODE_SELF_SIGNED

public static final int SIGNING_MODE_SELF_SIGNED
Signing mode for self-signed certificates

See Also:
PDFreactor.setSignPDF(String, String, String, String, int), Constant Field Values

SIGNING_MODE_VERISIGN_SIGNED

public static final int SIGNING_MODE_VERISIGN_SIGNED
Signing mode for VeriSign certificates

See Also:
PDFreactor.setSignPDF(String, String, String, String, int), Constant Field Values

SIGNING_MODE_WINCER_SIGNED

public static final int SIGNING_MODE_WINCER_SIGNED
Signing mode for Windows certificates

See Also:
PDFreactor.setSignPDF(String, String, String, String, int), Constant Field Values

LOG_LEVEL_NONE

public static final int LOG_LEVEL_NONE
Indicates that no log events will be logged.

See Also:
PDFreactor.setLogLevel(int), Constant Field Values

LOG_LEVEL_FATAL

public static final int LOG_LEVEL_FATAL
Indicates that only fatal log events will be logged.

See Also:
PDFreactor.setLogLevel(int), Constant Field Values

LOG_LEVEL_WARN

public static final int LOG_LEVEL_WARN
Indicates that warn and fatal log events will be logged.

See Also:
PDFreactor.setLogLevel(int), Constant Field Values

LOG_LEVEL_INFO

public static final int LOG_LEVEL_INFO
Indicates that info, warn and fatal log events will be logged.

See Also:
PDFreactor.setLogLevel(int), Constant Field Values

LOG_LEVEL_DEBUG

public static final int LOG_LEVEL_DEBUG
Indicates that debug, info, warn and fatal log events will be logged.

See Also:
PDFreactor.setLogLevel(int), Constant Field Values

LOG_LEVEL_PERFORMANCE

public static final int LOG_LEVEL_PERFORMANCE
Indicates that all log events will be logged.

See Also:
PDFreactor.setLogLevel(int), Constant Field Values

PAGE_ORDER_REVERSE

public static final String PAGE_ORDER_REVERSE
Page order mode to reverse the page order

See Also:
PDFreactor.setPageOrder(String), Constant Field Values

PAGE_ORDER_ODD

public static final String PAGE_ORDER_ODD
Page order mode to keep odd pages only

See Also:
PDFreactor.setPageOrder(String), Constant Field Values

PAGE_ORDER_EVEN

public static final String PAGE_ORDER_EVEN
Page order mode to keep even pages only

See Also:
PDFreactor.setPageOrder(String), Constant Field Values

PAGE_ORDER_BOOKLET

public static final String PAGE_ORDER_BOOKLET
Page order mode to arrange all pages in booklet order

See Also:
PDFreactor.setPageOrder(String), Constant Field Values

PAGE_ORDER_BOOKLET_RTL

public static final String PAGE_ORDER_BOOKLET_RTL
Page order mode to arrange all pages in right-to-left booklet order

See Also:
PDFreactor.setPageOrder(String), Constant Field Values

PAGES_PER_SHEET_DIRECTION_RIGHT_DOWN

public static final int PAGES_PER_SHEET_DIRECTION_RIGHT_DOWN
Arranges the pages on a sheet from left to right and top to bottom

See Also:
PDFreactor.setPagesPerSheetProperties(int, int, String, String, String, int), Constant Field Values

PAGES_PER_SHEET_DIRECTION_LEFT_DOWN

public static final int PAGES_PER_SHEET_DIRECTION_LEFT_DOWN
Arranges the pages on a sheet from right to left and top to bottom

See Also:
PDFreactor.setPagesPerSheetProperties(int, int, String, String, String, int), Constant Field Values

PAGES_PER_SHEET_DIRECTION_RIGHT_UP

public static final int PAGES_PER_SHEET_DIRECTION_RIGHT_UP
Arranges the pages on a sheet from left to right and bottom to top

See Also:
PDFreactor.setPagesPerSheetProperties(int, int, String, String, String, int), Constant Field Values

PAGES_PER_SHEET_DIRECTION_LEFT_UP

public static final int PAGES_PER_SHEET_DIRECTION_LEFT_UP
Arranges the pages on a sheet from right to left and bottom to top

See Also:
PDFreactor.setPagesPerSheetProperties(int, int, String, String, String, int), Constant Field Values

PAGES_PER_SHEET_DIRECTION_DOWN_RIGHT

public static final int PAGES_PER_SHEET_DIRECTION_DOWN_RIGHT
Arranges the pages on a sheet from top to bottom and left to right

See Also:
PDFreactor.setPagesPerSheetProperties(int, int, String, String, String, int), Constant Field Values

PAGES_PER_SHEET_DIRECTION_DOWN_LEFT

public static final int PAGES_PER_SHEET_DIRECTION_DOWN_LEFT
Arranges the pages on a sheet from top to bottom and right to left

See Also:
PDFreactor.setPagesPerSheetProperties(int, int, String, String, String, int), Constant Field Values

PAGES_PER_SHEET_DIRECTION_UP_RIGHT

public static final int PAGES_PER_SHEET_DIRECTION_UP_RIGHT
Arranges the pages on a sheet from bottom to top and left to right

See Also:
PDFreactor.setPagesPerSheetProperties(int, int, String, String, String, int), Constant Field Values

PAGES_PER_SHEET_DIRECTION_UP_LEFT

public static final int PAGES_PER_SHEET_DIRECTION_UP_LEFT
Arranges the pages on a sheet from bottom to top and right to left

See Also:
PDFreactor.setPagesPerSheetProperties(int, int, String, String, String, int), Constant Field Values

MERGE_MODE_APPEND

public static final int MERGE_MODE_APPEND
Default merge mode: Append converted document to existing PDF

See Also:
PDFreactor.setMergeMode(int), Constant Field Values

MERGE_MODE_PREPEND

public static final int MERGE_MODE_PREPEND
Alternate merge mode: Prepend converted document to existing PDF

See Also:
PDFreactor.setMergeMode(int), Constant Field Values

MERGE_MODE_OVERLAY

public static final int MERGE_MODE_OVERLAY
Alternate merge mode (overlay): Adding converted document above the existing PDF

See Also:
PDFreactor.setMergeMode(int), Constant Field Values

MERGE_MODE_OVERLAY_BELOW

public static final int MERGE_MODE_OVERLAY_BELOW
Alternate merge mode (overlay): Adding converted document below the existing PDF

See Also:
PDFreactor.setMergeMode(int), Constant Field Values

OVERLAY_REPEAT_NONE

public static final int OVERLAY_REPEAT_NONE
No pages of the shorter document are repeated, leaving some pages of the longer document without overlay

See Also:
PDFreactor.setOverlayRepeat(int), Constant Field Values

OVERLAY_REPEAT_LAST_PAGE

public static final int OVERLAY_REPEAT_LAST_PAGE
Last page of the shorter document is repeated, to overlay all pages of the longer document

See Also:
PDFreactor.setOverlayRepeat(int), Constant Field Values

OVERLAY_REPEAT_ALL_PAGES

public static final int OVERLAY_REPEAT_ALL_PAGES
All pages of the shorter document are repeated, to overlay all pages of the longer document

See Also:
PDFreactor.setOverlayRepeat(int), Constant Field Values

VIEWER_PREFERENCES_PAGE_LAYOUT_SINGLE_PAGE

public static final int VIEWER_PREFERENCES_PAGE_LAYOUT_SINGLE_PAGE
Display one page at a time. (default)

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_PAGE_LAYOUT_ONE_COLUMN

public static final int VIEWER_PREFERENCES_PAGE_LAYOUT_ONE_COLUMN
Display the pages in one column.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_COLUMN_LEFT

public static final int VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_COLUMN_LEFT
Display the pages in two columns, with odd numbered pages on the left.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_COLUMN_RIGHT

public static final int VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_COLUMN_RIGHT
Display the pages in two columns, with odd numbered pages on the right.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_PAGE_LEFT

public static final int VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_PAGE_LEFT
Display two pages at a time, with odd numbered pages on the left.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_PAGE_RIGHT

public static final int VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_PAGE_RIGHT
Display two pages at a time, with odd numbered pages on the right.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_PAGE_MODE_USE_NONE

public static final int VIEWER_PREFERENCES_PAGE_MODE_USE_NONE
Show no panel on startup.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_PAGE_MODE_USE_OUTLINES

public static final int VIEWER_PREFERENCES_PAGE_MODE_USE_OUTLINES
Show document outline panel on startup.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_PAGE_MODE_USE_THUMBS

public static final int VIEWER_PREFERENCES_PAGE_MODE_USE_THUMBS
Show thumbnail images panel on startup.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_PAGE_MODE_FULLSCREEN

public static final int VIEWER_PREFERENCES_PAGE_MODE_FULLSCREEN
Switch to fullscreen mode on startup.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_PAGE_MODE_USE_OC

public static final int VIEWER_PREFERENCES_PAGE_MODE_USE_OC
Show optional content group panel on startup.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_PAGE_MODE_USE_ATTACHMENTS

public static final int VIEWER_PREFERENCES_PAGE_MODE_USE_ATTACHMENTS
Show attachments panel on startup.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_HIDE_TOOLBAR

public static final int VIEWER_PREFERENCES_HIDE_TOOLBAR
Hide the viewer application's tool bars when the document is active.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_HIDE_MENUBAR

public static final int VIEWER_PREFERENCES_HIDE_MENUBAR
Hide the viewer application's menu bar when the document is active.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_HIDE_WINDOW_UI

public static final int VIEWER_PREFERENCES_HIDE_WINDOW_UI
Hide user interface elements in the document's window.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_FIT_WINDOW

public static final int VIEWER_PREFERENCES_FIT_WINDOW
Resize the document's window to fit the size of the first displayed page.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_CENTER_WINDOW

public static final int VIEWER_PREFERENCES_CENTER_WINDOW
Position the document's window in the center of the screen.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_DISPLAY_DOC_TITLE

public static final int VIEWER_PREFERENCES_DISPLAY_DOC_TITLE
Display the document's title in the top bar.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_NONE

public static final int VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_NONE
Show document outline panel on exiting full-screen mode. Has to be combined with PDFreactor.VIEWER_PREFERENCES_PAGE_MODE_FULLSCREEN.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_OUTLINES

public static final int VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_OUTLINES
Show thumbnail images panel on exiting full-screen mode. Has to be combined with PDFreactor.VIEWER_PREFERENCES_PAGE_MODE_FULLSCREEN.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_THUMBS

public static final int VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_THUMBS
Show optional content group panel on exiting full-screen mode. Has to be combined with PDFreactor.VIEWER_PREFERENCES_PAGE_MODE_FULLSCREEN.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_OC

public static final int VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_OC
Show attachments panel on exiting full-screen mode. Has to be combined with PDFreactor.VIEWER_PREFERENCES_PAGE_MODE_FULLSCREEN.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_DIRECTION_L2R

public static final int VIEWER_PREFERENCES_DIRECTION_L2R
Position pages in ascending order from left to right.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_DIRECTION_R2L

public static final int VIEWER_PREFERENCES_DIRECTION_R2L
Position pages in ascending order from right to left.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_PRINTSCALING_NONE

public static final int VIEWER_PREFERENCES_PRINTSCALING_NONE
Print dialog default setting: disabled scaling

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_PRINTSCALING_APPDEFAULT

public static final int VIEWER_PREFERENCES_PRINTSCALING_APPDEFAULT
Print dialog default setting: set scaling to application default value.

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_DUPLEX_SIMPLEX

public static final int VIEWER_PREFERENCES_DUPLEX_SIMPLEX
Print dialog default setting: simplex

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_DUPLEX_FLIP_SHORT_EDGE

public static final int VIEWER_PREFERENCES_DUPLEX_FLIP_SHORT_EDGE
Print dialog default setting: duplex (short edge)

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_DUPLEX_FLIP_LONG_EDGE

public static final int VIEWER_PREFERENCES_DUPLEX_FLIP_LONG_EDGE
Print dialog default setting: duplex (long edge)

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_PICKTRAYBYPDFSIZE_FALSE

public static final int VIEWER_PREFERENCES_PICKTRAYBYPDFSIZE_FALSE
Print dialog default setting: do not pick tray by PDF size

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

VIEWER_PREFERENCES_PICKTRAYBYPDFSIZE_TRUE

public static final int VIEWER_PREFERENCES_PICKTRAYBYPDFSIZE_TRUE
Print dialog default setting: pick tray by PDF size

See Also:
PDFreactor.setViewerPreferences(int), Constant Field Values

PROCESSING_PREFERENCES_SAVE_MEMORY_IMAGES

public static final int PROCESSING_PREFERENCES_SAVE_MEMORY_IMAGES
Processing preferences flag for the memory saving mode for images

See Also:
PDFreactor.setProcessingPreferences(int), Constant Field Values

COLOR_SPACE_RGB

public static final int COLOR_SPACE_RGB
The color space RGB

See Also:
PDFreactor.setDefaultColorSpace(int)

COLOR_SPACE_CMYK

public static final int COLOR_SPACE_CMYK
The color space CMYK

See Also:
PDFreactor.setDefaultColorSpace(int)

EXCEEDING_CONTENT_ANALYZE_NONE

public static final int EXCEEDING_CONTENT_ANALYZE_NONE
Do not log exceeding content

See Also:
PDFreactor.setLogExceedingContent(int, int), Constant Field Values

EXCEEDING_CONTENT_ANALYZE_CONTENT

public static final int EXCEEDING_CONTENT_ANALYZE_CONTENT
Log exceeding content

See Also:
PDFreactor.setLogExceedingContent(int, int), Constant Field Values

EXCEEDING_CONTENT_ANALYZE_CONTENT_AND_STATIC_BOXES

public static final int EXCEEDING_CONTENT_ANALYZE_CONTENT_AND_STATIC_BOXES
Log exceeding content and boxes without absolute positioning

See Also:
PDFreactor.setLogExceedingContent(int, int), Constant Field Values

EXCEEDING_CONTENT_ANALYZE_CONTENT_AND_BOXES

public static final int EXCEEDING_CONTENT_ANALYZE_CONTENT_AND_BOXES
Log exceeding content and all boxes

See Also:
PDFreactor.setLogExceedingContent(int, int), Constant Field Values

EXCEEDING_CONTENT_AGAINST_NONE

public static final int EXCEEDING_CONTENT_AGAINST_NONE
Do not log exceeding content

See Also:
PDFreactor.setLogExceedingContent(int, int), Constant Field Values

EXCEEDING_CONTENT_AGAINST_PAGE_BORDERS

public static final int EXCEEDING_CONTENT_AGAINST_PAGE_BORDERS
Log content exceeding the edges of its page

See Also:
PDFreactor.setLogExceedingContent(int, int), Constant Field Values

EXCEEDING_CONTENT_AGAINST_PAGE_CONTENT

public static final int EXCEEDING_CONTENT_AGAINST_PAGE_CONTENT
Log content exceeding its page content area (overlaps the page margin)

See Also:
PDFreactor.setLogExceedingContent(int, int), Constant Field Values

EXCEEDING_CONTENT_AGAINST_PARENT

public static final int EXCEEDING_CONTENT_AGAINST_PARENT
Log content exceeding its container

See Also:
PDFreactor.setLogExceedingContent(int, int), Constant Field Values

CONFORMANCE_PDF

public static final int CONFORMANCE_PDF
PDF with no additional restrictions (default)

See Also:
PDFreactor.setConformance(int), Constant Field Values

CONFORMANCE_PDFA

public static final int CONFORMANCE_PDFA
PDF/A-1a (ISO 19005-1 Level A)

See Also:
PDFreactor.setConformance(int), Constant Field Values
Constructor Detail

PDFreactor

public PDFreactor()
Creates an instance of PDFreactor.

Method Detail

setLicenseKey

public void setLicenseKey(String content)
Sets the license key using a String. If the license key is set to null then PDFreactor looks for a 'licensekey.xml' file in the same directory where the 'PDFreactor.jar' file is located. If no license key could be found then PDFreactor runs in evaluation mode.

The default value is null.

Parameters:
content - The content of the license key as String.

setDisableFontRegistration

public void setDisableFontRegistration(boolean value)

Enables or disables the font registration. If font registration is enabled and a valid font cache exists then this font cache will be used. If font registration is disabled, any existing font cache will be ignored and the font directories will be scanned for font information.

The default value is false.

Parameters:
value - The new value of the font registration setting.
See Also:
PDFreactor.setCacheFonts(boolean), PDFreactor.setFontCachePath(String), PDFreactor.setFontDirectory(String)

setCacheFonts

public void setCacheFonts(boolean value)

Enables or disables caching of font information.

During the PDF creation PDFreactor requires information about fonts in the system. The process to get this information takes a long time, thus PDFreactor offers an option to cache the collected information about fonts.

A font cache can be reused by PDFreactor on every PDF creation process but only if font registration is enabled. If font registration is disabled then the font cache will be ignored. (see PDFreactor.setDisableFontRegistration(boolean) for more information).

The default value is true.

Parameters:
value - The new value of the cache fonts setting.
See Also:
PDFreactor.setDisableFontRegistration(boolean), PDFreactor.setFontCachePath(String), PDFreactor.setFontDirectory(String)

setFontCachePath

public void setFontCachePath(String location)

Sets the path of the font cache. This path will be used to read and write the font cache. If the font cache path is set to null then the "user.home" directory will be used.

The default value is null.

Parameters:
location - The path of the font cache.
See Also:
PDFreactor.setDisableFontRegistration(boolean), PDFreactor.setCacheFonts(boolean), PDFreactor.setFontDirectory(String)

setFontDirectory

public void setFontDirectory(String location)

Sets the font directory from which fonts will be read. All files with the endings ".ttf", ".otf", ".afm" and ".ttc" will be read.

The default value of the font directory is "%system%".

Parameters:
location - The font directory.
See Also:
PDFreactor.setDisableFontRegistration(boolean), PDFreactor.setCacheFonts(boolean), PDFreactor.setFontCachePath(String)

setLogLevel

public void setLogLevel(int value)

Sets the log level.

Use one of the LOG_LEVEL_ constants to specify the log level.

The default value is PDFreactor.LOG_LEVEL_NONE.

Parameters:
value - The new log level setting.
See Also:
PDFreactor.LOG_LEVEL_NONE, PDFreactor.LOG_LEVEL_FATAL, PDFreactor.LOG_LEVEL_WARN, PDFreactor.LOG_LEVEL_INFO, PDFreactor.LOG_LEVEL_DEBUG, PDFreactor.LOG_LEVEL_PERFORMANCE, PDFreactor.getLog()

setLogExceedingContent

public void setLogExceedingContent(int logExceedingContentAnalyze,
                                   int logExceedingContentAgainst)

Whether to log content exceeding the page.

Use EXCEEDING_CONTENT_ANALYZE_ constants to specify which kind of content should be observed for exceeding content logging. The default value is PDFreactor.EXCEEDING_CONTENT_ANALYZE_NONE.

Use EXCEEDING_CONTENT_AGAINST_ constants to specify that exceeding this content starts exceeding content logging. The default value is PDFreactor.EXCEEDING_CONTENT_AGAINST_NONE.

Parameters:
logExceedingContentAnalyze - Enables logging of exceeding content and optionally of boxes.
logExceedingContentAgainst - Enables logging of exceeding content either against the page edges, page content areas or containers.
See Also:
PDFreactor.EXCEEDING_CONTENT_ANALYZE_NONE, PDFreactor.EXCEEDING_CONTENT_ANALYZE_CONTENT, PDFreactor.EXCEEDING_CONTENT_ANALYZE_CONTENT_AND_BOXES, PDFreactor.EXCEEDING_CONTENT_ANALYZE_CONTENT_AND_STATIC_BOXES, PDFreactor.EXCEEDING_CONTENT_AGAINST_NONE, PDFreactor.EXCEEDING_CONTENT_AGAINST_PARENT, PDFreactor.EXCEEDING_CONTENT_AGAINST_PAGE_CONTENT, PDFreactor.EXCEEDING_CONTENT_AGAINST_PAGE_BORDERS

setThrowLicenseExceptions

public void setThrowLicenseExceptions(boolean throwLicenseExceptions)

Whether an exception should be thrown when no legal full license key is set. This allows to programmatically ensure that documents are not altered due to license issues.

The default value is false.


setBaseURL

public void setBaseURL(String value)

Sets the base URL of the XML document.

To resolve relative URLs to absolute URLs a reference (base) URL is required. This reference URL is usually the system id of the document.

This method can be used to specify another reference URL. If this URL is not null then it will be used instead of the system id.

The default value is null.

Parameters:
value - The base URL for the document.

setXSLTMode

public void setXSLTMode(boolean value)

Enables or disables XSLT transformations.

Set this value to true to enable XSLT transformations or to false to disable XSLT transformations.

The default value is false.

Parameters:
value - The new XSLT mode.

setEncoding

public void setEncoding(String value)

Sets the encoding of the document.

If this value is set to null or it is empty then the encoding will be detected automatically.

The default value is null.

Parameters:
value - The encoding of the document or null for autodetection.

setCleanupTool

public void setCleanupTool(int value)

Sets the cleanup tool to use for documents with unparsable content.

The CLEANUP_ constants can be used as value. The default value specified is PDFreactor.CLEANUP_CYBERNEKO.

Parameters:
value - The new cleanup tool.
See Also:
PDFreactor.CLEANUP_NONE, PDFreactor.CLEANUP_JTIDY, PDFreactor.CLEANUP_CYBERNEKO, PDFreactor.CLEANUP_TAGSOUP

setDocumentType

public void setDocumentType(int value)

Sets the document type.

The DOCTYPE_ constants can be used to specify the document type. The default value specified is PDFreactor.DOCTYPE_AUTODETECT.

Parameters:
value - The new document type setting.
See Also:
PDFreactor.DOCTYPE_AUTODETECT, PDFreactor.DOCTYPE_XML, PDFreactor.DOCTYPE_XHTML

addUserStyleSheet

public void addUserStyleSheet(InputSource inputSource)
                       throws IOException

Adds a user style sheet to the document.

The specified input source will be loaded and then added.

Parameters:
inputSource - The InputSource of the style sheet.
Throws:
IOException - If the style sheet could not be loaded.
See Also:
PDFreactor.addUserStyleSheet(String,String,String,String), PDFreactor.removeAllUserStyleSheets()

addUserStyleSheet

public void addUserStyleSheet(String content,
                              String media,
                              String title,
                              String uri)

Adds a user style sheet to the document.

There are two ways to specify the style sheet:

  1. Specifying the style sheet only using an URI.
  2. Specifying the style sheet by the content of the style sheet and alternatively setting a URI to resolve relative elements. If no URI is specified then the system id/base URL of the document will be used.

Parameters:
content - The content of the style sheet.
media - The media type of the style sheet.
title - The title of the style sheet.
uri - The URI of the style sheet.
See Also:
PDFreactor.addUserStyleSheet(InputSource), PDFreactor.removeAllUserStyleSheets()

removeAllUserStyleSheets

public void removeAllUserStyleSheets()

Removes all user style sheets.

See Also:
PDFreactor.addUserStyleSheet(InputSource), PDFreactor.addUserStyleSheet(String,String,String,String)

addXSLTStyleSheet

public void addXSLTStyleSheet(String content,
                              String uri)

Adds an XSLT style sheet to the document.

There are two ways to specify the style sheet:

  1. Specifying the style sheet only by an URI.
  2. Specifying the style sheet by the content of the style sheet and alternatively setting a URI to resolve relative elements. If no URI is specified then the system id/base URL of the document will be used.

Parameters:
content - The content of the style sheet.
uri - The URI of the style sheet.
See Also:
PDFreactor.removeAllXSLTStyleSheets()

removeAllXSLTStyleSheets

public void removeAllXSLTStyleSheets()

Removes all XSLT style sheets.

See Also:
PDFreactor.addXSLTStyleSheet(String,String)

setAuthor

public void setAuthor(String value)

Sets the value of the author field of the PDF document.

Parameters:
value - The author of the document.

setCreator

public void setCreator(String value)

Sets the value of creator field of the PDF document.

Parameters:
value - The creator of the document.

setKeywords

public void setKeywords(String value)

Sets the value of the keywords field of the PDF document.

Parameters:
value - The keywords of the document.

setTitle

public void setTitle(String value)

Sets the value of the title field of the PDF document.

Parameters:
value - The title of the document.

setSubject

public void setSubject(String value)

Sets the value of the subject field of the PDF document.

Parameters:
value - The subject of the document.

setDocumentDefaultLanguage

public void setDocumentDefaultLanguage(String languageCode)

Sets the language used for documents having no explicit language attribute set.

The language code is used to resolve the lang() selector correct and to determine the correct language used for hyphenation.

Parameters:
languageCode - the default ISO 639 language code used for documents.

setEncryption

public void setEncryption(int value)

Sets the encryption.

Use one of the ENCRYPTION_ constants to specify the encryption. The default value is PDFreactor.ENCRYPTION_NONE.

Parameters:
value - The new encryption setting.
See Also:
PDFreactor.ENCRYPTION_NONE, PDFreactor.ENCRYPTION_40, PDFreactor.ENCRYPTION_128, PDFreactor.setOwnerPassword(String), PDFreactor.setUserPassword(String), PDFreactor.setAllowAnnotations(boolean), PDFreactor.setAllowAssembly(boolean), PDFreactor.setAllowCopy(boolean), PDFreactor.setAllowDegradedPrinting(boolean), PDFreactor.setAllowFillIn(boolean), PDFreactor.setAllowModifyContents(boolean), PDFreactor.setAllowPrinting(boolean), PDFreactor.setAllowScreenReaders(boolean)

setFullCompression

public void setFullCompression(boolean value)

Enables or disables full compression of the PDF document.

The default value is false.

Parameters:
value - Use true to enable full compression of the document and false to disable full compression.

setOwnerPassword

public void setOwnerPassword(String value)

Sets the owner password of the PDF document.

The default value is null.

Parameters:
value - The new owner password.
See Also:
PDFreactor.setEncryption(int), PDFreactor.setUserPassword(String)

setUserPassword

public void setUserPassword(String value)

Sets the user password of the PDF document.

The default value is null.

Parameters:
value - The new user password.
See Also:
PDFreactor.setEncryption(int), PDFreactor.setOwnerPassword(String)

setAddLinks

public void setAddLinks(boolean value)

Enables or disables links in the PDF document.

The default value is false.

Parameters:
value - Use true to enable links in the document and false to disable links.

setAddBookmarks

public void setAddBookmarks(boolean value)

Enables or disables bookmarks in the PDF document.

The default value is false.

Parameters:
value - Use true to enable bookmarks in the document and false to disable bookmarks.

setAddTags

public void setAddTags(boolean value)

Enables or disables tagging of the PDF document.

The default value is false.

Parameters:
value - Use true to enable tagging of the document and false to disable tagging.

setAddPreviewImages

public void setAddPreviewImages(boolean value)

Enables or disables embedding of image previews per page in the PDF document.

The default value is false.

Parameters:
value - Use true to enable embedding of image previews per page in the document and false to disable embedding of image previews per page.

setPrintDialogPrompt

public void setPrintDialogPrompt(boolean value)

Enables or disables a print dialog to be shown upon opening the generated PDF document by a PDF viewer.

The default value is false.

Parameters:
value - Use true to enable a print dialog to be shown upon document opening by a PDF viewer and false to disable the print dialog prompt.

setAppendLog

public void setAppendLog(boolean value)

Specifies whether or not the log data should be added to the PDF document.

The default value is false.

Parameters:
value - Use true to add the log data to the document and false if the log data should not be added.

setAllowAnnotations

public void setAllowAnnotations(boolean value)

Enables or disables the 'annotations' restriction in the PDF document.

The default value is false.

Parameters:
value - Use true to enable 'annotations' in the document and false to disable 'annotations'.
See Also:
PDFreactor.setEncryption(int)

setAllowAssembly

public void setAllowAssembly(boolean value)

Enables or disables the 'assembly' restriction in the PDF document.

The default value is false.

Parameters:
value - Use true to enable 'assembly' in the document and false to disable 'assembly'.
See Also:
PDFreactor.setEncryption(int)

setAllowCopy

public void setAllowCopy(boolean value)

Enables or disables the 'copy' restriction in the PDF document.

The default value is false.

Parameters:
value - Use true to enable 'copy' in the document and false to disable 'copy'.
See Also:
PDFreactor.setEncryption(int)

setAllowDegradedPrinting

public void setAllowDegradedPrinting(boolean value)

Enables or disables the 'degraded printing' restriction in the PDF document.

The default value is false.

Parameters:
value - Use true to enable 'degraded printing' in the document and false to disable 'degraded printing'.
See Also:
PDFreactor.setEncryption(int)

setAllowFillIn

public void setAllowFillIn(boolean value)

Enables or disables the 'fill in' restriction in the PDF document.

The default value is false.

Parameters:
value - Use true to enable 'fill in' in the document and false to disable 'fill in'.
See Also:
PDFreactor.setEncryption(int)

setAllowModifyContents

public void setAllowModifyContents(boolean value)

Enables or disables the 'modify contents' restriction in the PDF document.

The default value is false.

Parameters:
value - Use true to enable 'modify contents' in the document and false to disable 'modify contents'.
See Also:
PDFreactor.setEncryption(int)

setAllowPrinting

public void setAllowPrinting(boolean value)

Enables or disables the 'printing' restriction in the PDF document.

The default value is false.

Parameters:
value - Use true to enable 'printing' in the document and false to disable 'printing'.
See Also:
PDFreactor.setEncryption(int)

setAllowScreenReaders

public void setAllowScreenReaders(boolean value)

Enables or disables the 'screen readers' restriction in the PDF document.

The default value is false.

Parameters:
value - Use true to enable 'screen readers' in the document and false to disable 'screen readers'.
See Also:
PDFreactor.setEncryption(int)

setDisableFontEmbedding

public void setDisableFontEmbedding(boolean disableFontEmbedding)

Sets whether fonts will not be embedded into the resulting PDF. Setting this to true will reduce the file size of the output document. However, the resulting PDF documents are no longer guaranteed to look identical on all systems.

The default value is false.


setFontFallback

public void setFontFallback(String[] fontFallback)

Sets a list of fallback font families used for character substitution. This list is iterated for characters that can not be displayed with any of the fonts specified via the CSS property font-family.

Parameters:
fontFallback - an array of font family names

setPixelsPerInch

public void setPixelsPerInch(int ppi)

Sets the pixels per inch.

Changing this value changes the physical length of sizes specified in px (including those specified via HTML attributes).

The default value is 96ppi.


setPixelsPerInchShrinkToFit

public void setPixelsPerInchShrinkToFit(boolean pixelsPerInchShrinkToFit)
Whether the pixels per inch should be adapted automatically to avoid content exceeding pages.


setMergeMode

public void setMergeMode(int mode)

Sets the merge mode.

The following merge methods can be used:

The default value is PDFreactor.MERGE_MODE_APPEND.

Parameters:
mode - The merge mode.
See Also:
PDFreactor.MERGE_MODE_APPEND, PDFreactor.MERGE_MODE_PREPEND, PDFreactor.MERGE_MODE_OVERLAY, PDFreactor.MERGE_MODE_OVERLAY_BELOW

setMergeURL

public void setMergeURL(String url)

This method sets a URL of an external PDF document which will be merged with the PDF document generated by the XML source.

See Also:
PDFreactor.setMergeByteArray(byte[]), PDFreactor.setMergeBeforePDF(boolean)

setMergeURLs

public void setMergeURLs(String[] urls)

This method sets an array of URLs of external PDF documents which will be merged with the PDF document generated by the XML source.


setMergeByteArray

public void setMergeByteArray(byte[] array)

This method sets a byte array containing an external PDF document which will be merged with the PDF document generated by the XML source.

See Also:
PDFreactor.setMergeURL(String), PDFreactor.setMergeURLs(String[]), PDFreactor.setMergeByteArrays(byte[][]), PDFreactor.setMergeMode(int)

setMergeByteArrays

public void setMergeByteArrays(byte[][] arrays)

This method sets an array of byte arrays that contain multiple external PDFs which will be merged with the PDF document generated by the XML source.

.

See Also:
PDFreactor.setMergeByteArray(byte[]), PDFreactor.setMergeURL(String), PDFreactor.setMergeURLs(String[]), PDFreactor.setMergeMode(int)

setMergeBeforePDF

public void setMergeBeforePDF(boolean value)
Deprecated. As of PDFreactor 5.0, replaced by PDFreactor.setMergeMode(int)

See Also:
PDFreactor.setMergeMode(int)

setOverlayRepeat

public void setOverlayRepeat(int overlayRepeat)

If one of the documents of an overlay process is shorter than the other, this method allows repeating either its last page or all of its pages in order to overlay all pages of the longer document.

Use one of the OBERLAY_REPEAT_ constants to specify the overlay repeat. The default value is PDFreactor.OVERLAY_REPEAT_NONE.

See Also:
PDFreactor.OVERLAY_REPEAT_NONE, PDFreactor.OVERLAY_REPEAT_LAST_PAGE, PDFreactor.OVERLAY_REPEAT_ALL_PAGES

setPageOrder

public void setPageOrder(String order)

Sets the page order of the direct result of the conversion.

Parameters:
order - A comma-separated list of page numbers and ranges is intended as parameter. Alternatively, PAGE_ORDER_ constants can be used.
See Also:
PDFreactor.PAGE_ORDER_EVEN, PDFreactor.PAGE_ORDER_ODD, PDFreactor.PAGE_ORDER_BOOKLET, PDFreactor.PAGE_ORDER_BOOKLET_RTL

setPagesPerSheetProperties

public void setPagesPerSheetProperties(int cols,
                                       int rows,
                                       String sheetSize,
                                       String sheetMargin,
                                       String spacing,
                                       int direction)

Sets the properties of a sheet on which multiple pages are being arranged.

If cols or rows is less than 1, no pages-per-sheet processing is done. This is the case by default.

Use one of the PAGES_PER_SHEET_DIRECTION_ constants to specify the the direction. The default value is PDFreactor.PAGES_PER_SHEET_DIRECTION_RIGHT_DOWN.

Parameters:
cols - The number of columns per sheet.
rows - The number of rows per sheet.
sheetSize - The sheet size as CSS size, e.g. A4, letter landscape, 15in 20in, 20cm 30cm.
sheetMargin - The sheet margin as CSS margin, e.g. 1in, 1cm 1.5cm, 10mm 20mm 10mm 30mm. null is interpreted as 0mm.
spacing - The horizontal and vertical space between pages on a sheet as CSS value, e.g. 0.1in, 5mm 2mm. null is interpreted as 0mm.
direction - The direction in which the pages are ordered on a sheet.
See Also:
PDFreactor.PAGES_PER_SHEET_DIRECTION_DOWN_LEFT, PDFreactor.PAGES_PER_SHEET_DIRECTION_DOWN_RIGHT, PDFreactor.PAGES_PER_SHEET_DIRECTION_LEFT_DOWN, PDFreactor.PAGES_PER_SHEET_DIRECTION_LEFT_UP, PDFreactor.PAGES_PER_SHEET_DIRECTION_RIGHT_DOWN, PDFreactor.PAGES_PER_SHEET_DIRECTION_RIGHT_UP, PDFreactor.PAGES_PER_SHEET_DIRECTION_UP_LEFT, PDFreactor.PAGES_PER_SHEET_DIRECTION_UP_RIGHT

setBookletMode

public void setBookletMode(String sheetSize,
                           String sheetMargin,
                           boolean rtl)

Convenience method to set pages-per-sheet properties and page order in one step to create a booklet.

Parameters:
sheetSize - The size of the sheet as CSS value, e.g. A3, letter landscape, 15in 20in, 20cm 30cm.
sheetMargin - The sheet margin as CSS margin value, e.g. 1in, 1cm 1.5cm, 10mm 20mm 10mm 30mm. null is interpreted as 0mm.
rtl - Whether or not the reading order of the booklet should be right-to-left .

setViewerPreferences

public void setViewerPreferences(int viewerPreferences)

Sets the page layout and page mode preferences of the PDF.

Use the VIEWER_PREFERENCES_ constants to specify the viewer preferences. By default no viewer preference is set.

Parameters:
viewerPreferences - A value of ORed VIEWER_PREFERENCES_ constants.
See Also:
PDFreactor.VIEWER_PREFERENCES_CENTER_WINDOW, PDFreactor.VIEWER_PREFERENCES_DIRECTION_L2R, PDFreactor.VIEWER_PREFERENCES_DIRECTION_R2L, PDFreactor.VIEWER_PREFERENCES_DISPLAY_DOC_TITLE, PDFreactor.VIEWER_PREFERENCES_DUPLEX_FLIP_LONG_EDGE, PDFreactor.VIEWER_PREFERENCES_DUPLEX_FLIP_SHORT_EDGE, PDFreactor.VIEWER_PREFERENCES_DUPLEX_SIMPLEX, PDFreactor.VIEWER_PREFERENCES_FIT_WINDOW, PDFreactor.VIEWER_PREFERENCES_HIDE_MENUBAR, PDFreactor.VIEWER_PREFERENCES_HIDE_TOOLBAR, PDFreactor.VIEWER_PREFERENCES_HIDE_WINDOW_UI, PDFreactor.VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_NONE, PDFreactor.VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_OC, PDFreactor.VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_OUTLINES, PDFreactor.VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_THUMBS, PDFreactor.VIEWER_PREFERENCES_PAGE_LAYOUT_ONE_COLUMN, PDFreactor.VIEWER_PREFERENCES_PAGE_LAYOUT_SINGLE_PAGE, PDFreactor.VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_COLUMN_LEFT, PDFreactor.VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_COLUMN_RIGHT, PDFreactor.VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_PAGE_LEFT, PDFreactor.VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_PAGE_RIGHT, PDFreactor.VIEWER_PREFERENCES_PAGE_MODE_FULLSCREEN, PDFreactor.VIEWER_PREFERENCES_PAGE_MODE_USE_NONE, PDFreactor.VIEWER_PREFERENCES_PAGE_MODE_USE_OC, PDFreactor.VIEWER_PREFERENCES_PAGE_MODE_USE_OUTLINES, PDFreactor.VIEWER_PREFERENCES_PAGE_MODE_USE_THUMBS, PDFreactor.VIEWER_PREFERENCES_PICKTRAYBYPDFSIZE_FALSE, PDFreactor.VIEWER_PREFERENCES_PICKTRAYBYPDFSIZE_TRUE, PDFreactor.VIEWER_PREFERENCES_PRINTSCALING_APPDEFAULT, PDFreactor.VIEWER_PREFERENCES_PRINTSCALING_NONE

setConformance

public void setConformance(int conformance)

Sets the conformance of the PDF.

The CONFORMANCE_ constants can be used as value. The default value specified is PDFreactor.CONFORMANCE_PDF.

Parameters:
conformance - Any of the conformance constants.
See Also:
PDFreactor.CONFORMANCE_PDF, PDFreactor.CONFORMANCE_PDFA

setDefaultColorSpace

public void setDefaultColorSpace(int defaultColorSpace)

Sets whether to convert color key words to CMYK instead of RGB.

The COLOR_SPACE_ constants can be used as value. The default value specified is PDFreactor.COLOR_SPACE_RGB.

Parameters:
defaultColorSpace - the default color space of the PDF
See Also:
PDFreactor.COLOR_SPACE_CMYK, PDFreactor.COLOR_SPACE_RGB

setOutputIntentFromURL

public void setOutputIntentFromURL(String identifier,
                                   String profileUrl)

Sets the output intent including the identifier and the ICC profile to be embedded into the PDF.

Parameters:
identifier - the OutputConditionIdentifier
profileUrl - the DestOutputProfile

setOutputIntentFromByteArray

public void setOutputIntentFromByteArray(String identifier,
                                         byte[] profileData)

Sets the output intent including the identifier and the ICC profile to be embedded into the PDF.

Parameters:
identifier - the OutputConditionIdentifier
profileData - the DestOutputProfile

setProcessingPreferences

public void setProcessingPreferences(int processingPreferences)

Preferences that influence the conversion process without changing the output

Use the PROCESSING_PREFERENCES_ constants to specify the processing preferences. By default no processing preference is set.

Parameters:
processingPreferences - A value of ORed processing preferences flags.
See Also:
PDFreactor.PROCESSING_PREFERENCES_SAVE_MEMORY_IMAGES

setAuthenticationCredentials

public void setAuthenticationCredentials(String username,
                                         String password)

Enables access to resources that are secured via Basic or Digest authentication.

Parameters:
username - The user name for the secured realm.
password - The password for the secured realm.

setRequestHeader

public void setRequestHeader(String key,
                             String value)

Adds a request header to all outgoing HTTP connections. If the key already exists, the pair is overwritten.

Parameters:
key - The key of the header.
value - The value of the header.

setCookie

public void setCookie(String key,
                      String value)

Adds a cookie to all outgoing HTTP connections. If the key already exists, the pair is overwritten.

Parameters:
key - The key of the cookie.
value - The value of the cookie.

setSignPDF

public void setSignPDF(String keystoreURL,
                       String keyAlias,
                       String keystorePassword,
                       String keystoreType,
                       int signingMode)

Sets a digital certificate to sign the newly created PDF.

Requires a keystore file. The included certificate may be self-signed.

Use the KEYSTORE_TYPE_ constants to specify the keystore type.

Use the SIGNING_MODE_ constants to specify the signing mode.

Parameters:
keystoreURL - The URL to the keystore file.
keyAlias - The alias of the certificate included in the keystore to be used to sign the PDF.
keystorePassword - The password of the keystore.
keystoreType - The format of the keystore, i.e. pkcs12 or jks. Use one of the KEYSTORE_TYPE_ constants as value.
signingMode - The mode that is used to sign the PDF, i.e. self-signed, Windows certificate or VeriSign. Use one of the SIGNING_MODE_ constants as value.
See Also:
PDFreactor.KEYSTORE_TYPE_JKS, PDFreactor.KEYSTORE_TYPE_PKCS12, PDFreactor.SIGNING_MODE_SELF_SIGNED, PDFreactor.SIGNING_MODE_VERISIGN_SIGNED, PDFreactor.SIGNING_MODE_WINCER_SIGNED

renderDocument

public void renderDocument(InputSource inputSource,
                           OutputStream outputStream)
                    throws SAXException,
                           IOException,
                           TransformerException

Generates a PDF document from an InputSource.

The resulting PDF document will be written into an OutputStream.

Parameters:
inputSource - The InputSource of the XML document.
outputStream - The OutputStream where the PDF RAW data will be written into.
Throws:
TransformerException
com.realobjects.lowagie.text.DocumentException
IOException
SAXException
See Also:
PDFreactor.renderDocumentFromURL(String), PDFreactor.renderDocumentFromByteArray(byte[]), PDFreactor.renderDocumentFromContent(String)

renderDocumentFromURL

public byte[] renderDocumentFromURL(String url)
                             throws SAXException,
                                    IOException,
                                    TransformerException

Generates a PDF document from an XML document at a URL.

Parameters:
url - A URL pointing to the XML document.
Returns:
The PDF document as PDF RAW data.
Throws:
TransformerException
com.realobjects.lowagie.text.DocumentException
IOException
SAXException
See Also:
PDFreactor.renderDocumentFromByteArray(byte[]), PDFreactor.renderDocumentFromContent(String)

renderDocumentFromByteArray

public byte[] renderDocumentFromByteArray(byte[] array)
                                   throws SAXException,
                                          IOException,
                                          TransformerException

Generates a PDF document from an XML document inside a byte array.

Parameters:
array - An array containing the content of the XML document.
Returns:
The PDF document as PDF RAW data.
Throws:
TransformerException
com.realobjects.lowagie.text.DocumentException
IOException
SAXException
See Also:
PDFreactor.renderDocumentFromURL(String), PDFreactor.renderDocumentFromContent(String)

renderDocumentFromContent

public byte[] renderDocumentFromContent(String content)
                                 throws SAXException,
                                        IOException,
                                        TransformerException

Generates a PDF document from an XML document inside a String.

Parameters:
content - A String containing the content of the XML document.
Returns:
The PDF document as PDF RAW data.
Throws:
TransformerException
com.realobjects.lowagie.text.DocumentException
IOException
SAXException
See Also:
PDFreactor.renderDocumentFromURL(String), PDFreactor.renderDocumentFromByteArray(byte[])

addProgressEventListener

public void addProgressEventListener(ProgressEventListener listener)

Adds a ProgressEventListener.

Parameters:
listener - The ProgressEventListener to add.

removeProgressEventListener

public void removeProgressEventListener(ProgressEventListener listener)

Removes a ProgressEventListener.

Parameters:
listener - The ProgressEventListener to remove.

setLogger

public void setLogger(Logger object)

Sets a Logger to receive log messages.

The default value is null.

Parameters:
object - The Logger to use.
See Also:
PDFreactor.getLogger()

getLogger

public Logger getLogger()

Returns the Logger used by this PDFreactor.

Returns:
The used Logger.
See Also:
PDFreactor.setLogger(Logger)

getError

public String getError()

Returns the error messages generated during rendering.

Returns:
The message String.

getLog

public String getLog()

Returns the log messages generated during rendering based on the log level.

Returns:
The log String.
See Also:
PDFreactor.setLogLevel(int)

getExceedingContents

public ExceedingContent[] getExceedingContents()

Provides information about content exceeding its page or parent. Depends on the mode set via PDFreactor.setLogExceedingContent(int, int).

Returns:
an array of ExceedingContent objects or null if the logging of exceeding content was not enabled or no conversion was run, yet.

getNumberOfPages

public int getNumberOfPages(boolean pdf)

Returns the number of pages of the document after conversion.

The result returned by this method will only be correct if the document has already been laid out by one of the render methods:

Parameters:
pdf - If true, returns the number of pages of the resulting PDF (including, e.g., merge operations), otherwise it will return the number pages of the converted input document.

PDFreactor API

This doc was generated on 2012-03-15. Copyright © 2002-2012 RealObjects GmbH. All Rights Reserved.