PDFreactor API

com.realobjects.pdfreactor
Class PDFreactor

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

public class PDFreactor
extends Object

RealObjects(R) PDFreactor(R)

PDFreactor is a powerful formatting processor for converting XML and XHTML/HTML documents into PDF.

A sample demonstrates the use of PDFreactor:

 PDFreactor pdfReactor = new PDFreactor();
 
 InputSource inputSource = new InputSource("http://www.realobjects.com/");
 FileOutputStream outputStream = new FileOutputStream("realobjects.pdf");
 
 pdfReactor.setAddBookmarks(true);
 pdfReactor.setAddLinks(true);
 
 pdfReactor.renderDocument(inputSource,outputStream);
 
 outputStream.close();

For more information go to: http://www.realobjects.com


Field Summary
static boolean ADD_BOOKMARKS_DEFAULT
           
static boolean ADD_LINKS_DEFAULT
           
static boolean ADD_PREVIEW_IMAGES_DEFAULT
           
static boolean ADD_TAGS_DEFAULT
           
static boolean ALLOW_ANNOTATIONS_DEFAULT
           
static boolean ALLOW_ASSEMBLY_DEFAULT
           
static boolean ALLOW_COPY_DEFAULT
           
static boolean ALLOW_DEGRADED_PRINTING_DEFAULT
           
static boolean ALLOW_FILL_IN_DEFAULT
           
static boolean ALLOW_MODIFY_CONTENTS_DEFAULT
           
static boolean ALLOW_PRINTING_DEFAULT
           
static boolean ALLOW_SCREEN_READERS_DEFAULT
           
static boolean APPEND_LOG_DEFAULT
           
static String AUTHOR_DEFAULT
           
static String BASE_URL_DEFAULT
           
static boolean CACHE_FONTS_DEFAULT
           
static int CLEANUP_CYBERNEKO
          Indicates that the CyberNeko HTML parser will be used to perform a cleanup when loading a document.
static int CLEANUP_DEFAULT
          The default cleanup setting.
static int CLEANUP_JTIDY
          Indicates that JTidy will be used to perform a cleanup when loading a 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 document.
static String CREATOR_DEFAULT
           
static boolean DISABLE_FONT_REGISTRATION_DEFAULT
           
static int DOCTYPE_AUTODETECT
          Indicates that the document type will be detected automatically.
static int DOCTYPE_DEFAULT
          The default document type setting.
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 String ENCODING_DEFAULT
           
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_DEFAULT
          The default encryption setting.
static int ENCRYPTION_NONE
          Indicates that the document will not be encrypted.
static String FONT_CACHE_PATH_DEFAULT
           
static String FONT_DIRECTORY_DEFAULT
           
static boolean FULL_COMPRESSION_DEFAULT
           
static String KEYWORDS_DEFAULT
           
static String LICENSE_KEY_DEFAULT
           
static int LOG_LEVEL_DEBUG
          Indicates that debug, info, warn and fatal log events will be logged.
static int LOG_LEVEL_DEFAULT
          The default log level setting.
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 Logger LOGGER_DEFAULT
           
static boolean MERGE_BEFORE_PDF_DEFAULT
           
static byte[] MERGE_BYTE_ARRAY_DEFAULT
           
static String MERGE_URL_DEFAULT
           
static String OWNER_PASSWORD_DEFAULT
           
static boolean PRINT_DIALOG_PROMPT_DEFAULT
           
static String SUBJECT_DEFAULT
           
static String TITLE_DEFAULT
           
static String USER_PASSWORD_DEFAULT
           
static int VIEWER_PREFERENCES_CENTER_WINDOW
          Position the document's window in the center of the screen.
static int VIEWER_PREFERENCES_DEFAULT
           
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_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 boolean XSLT_MODE_DEFAULT
           
 
Constructor Summary
PDFreactor()
          Constructs PDFreactor.
 
Method Summary
 void addProgressEventListener(ProgressEventListener listener)
          Adds a progress event listener.
 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.
 String getLog()
          Returns the log messages generated during rendering based on the log level.
 Logger getLogger()
          Returns the current logger.
static boolean isValidCleanup(int value)
          Determines whether a specified number is a valid cleanup value or not.
static boolean isValidDocType(int value)
          Determines whether a specified number is a valid document type value or not.
static boolean isValidEncryption(int value)
          Determines whether a specified number is a valid encryption value or not.
static boolean isValidLogLevel(int value)
          Determines whether a specified number is a valid log level value or not.
 void removeAllUserStyleSheets()
          Removes all user style sheets.
 void removeAllXSLTStyleSheets()
          Removes all XSLT style sheets.
 void removeProgressEventListener(ProgressEventListener listener)
          Removes a progress event listener.
 void renderDocument(InputSource inputSource, OutputStream outputStream)
          Generates a PDF document from an InputSource based on the current settings.
 byte[] renderDocumentFromByteArray(byte[] array)
          Generates a PDF document from an XML document based on the current settings.
 byte[] renderDocumentFromContent(String content)
          Generates a PDF document from an XML document based on the current settings.
 byte[] renderDocumentFromURL(String url)
          Generates a PDF document from an XML document based on the current settings.
 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 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 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 setCreator(String value)
          Sets the value of creator field of the PDF document.
 void setDisableFontRegistration(boolean value)
          Enables or disables the font registration.
 void setDocType(String value)
          Deprecated. Since PDFreactor version 2. Replaced by setDocumentType(int).
 void setDocTypeAsInt(int value)
          Deprecated. Since PDFreactor version 2. Replaced by setDocumentType(int).
 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 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 setLicenseKeyInputSource(InputSource inputSource)
          Deprecated. Since PDFreactor version 2. Replaced by setLicenseKey(String).
 void setLogger(Logger object)
          Sets a logger to receive log messages.
 void setLogLevel(int value)
          Sets the log level.
 void setMergeBeforePDF(boolean value)
          Sets the merge method which describes how the two PDF documents (the PDF from the XML source and the external PDF) will be merged.
 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 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 setOwnerPassword(String value)
          Sets the owner password of the PDF document.
 void setPrintDialogPrompt(boolean value)
          Enables or disables a print dialog to be shown upon opening the generated PDF document by a PDF viewer.
 void setSubject(String value)
          Sets the value of the subject field of the PDF document.
 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.

See Also:
Constant Field Values

CLEANUP_JTIDY

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

See Also:
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 document.

See Also:
Constant Field Values

CLEANUP_TAGSOUP

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

See Also:
Constant Field Values

CLEANUP_DEFAULT

public static final int CLEANUP_DEFAULT
The default cleanup setting. It is set to CLEANUP_CYBERNEKO.

See Also:
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:
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:
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:
Constant Field Values

DOCTYPE_DEFAULT

public static final int DOCTYPE_DEFAULT
The default document type setting. It is set to DOCTYPE_AUTODETECT.

See Also:
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:
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:
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:
Constant Field Values

ENCRYPTION_DEFAULT

public static final int ENCRYPTION_DEFAULT
The default encryption setting. It is set to ENCRYPTION_NONE.

See Also:
Constant Field Values

LOG_LEVEL_NONE

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

See Also:
Constant Field Values

LOG_LEVEL_FATAL

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

See Also:
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:
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:
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:
Constant Field Values

LOG_LEVEL_PERFORMANCE

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

See Also:
Constant Field Values

LOG_LEVEL_DEFAULT

public static final int LOG_LEVEL_DEFAULT
The default log level setting. It is set to LOG_LEVEL_NONE.

See Also:
Constant Field Values

LICENSE_KEY_DEFAULT

public static final String LICENSE_KEY_DEFAULT

DISABLE_FONT_REGISTRATION_DEFAULT

public static final boolean DISABLE_FONT_REGISTRATION_DEFAULT
See Also:
Constant Field Values

CACHE_FONTS_DEFAULT

public static final boolean CACHE_FONTS_DEFAULT
See Also:
Constant Field Values

FONT_CACHE_PATH_DEFAULT

public static final String FONT_CACHE_PATH_DEFAULT

FONT_DIRECTORY_DEFAULT

public static final String FONT_DIRECTORY_DEFAULT
See Also:
Constant Field Values

BASE_URL_DEFAULT

public static final String BASE_URL_DEFAULT

XSLT_MODE_DEFAULT

public static final boolean XSLT_MODE_DEFAULT
See Also:
Constant Field Values

ENCODING_DEFAULT

public static final String ENCODING_DEFAULT

AUTHOR_DEFAULT

public static final String AUTHOR_DEFAULT

CREATOR_DEFAULT

public static final String CREATOR_DEFAULT

KEYWORDS_DEFAULT

public static final String KEYWORDS_DEFAULT

TITLE_DEFAULT

public static final String TITLE_DEFAULT

SUBJECT_DEFAULT

public static final String SUBJECT_DEFAULT

FULL_COMPRESSION_DEFAULT

public static final boolean FULL_COMPRESSION_DEFAULT
See Also:
Constant Field Values

OWNER_PASSWORD_DEFAULT

public static final String OWNER_PASSWORD_DEFAULT

USER_PASSWORD_DEFAULT

public static final String USER_PASSWORD_DEFAULT

ADD_LINKS_DEFAULT

public static final boolean ADD_LINKS_DEFAULT
See Also:
Constant Field Values

ADD_BOOKMARKS_DEFAULT

public static final boolean ADD_BOOKMARKS_DEFAULT
See Also:
Constant Field Values

ADD_TAGS_DEFAULT

public static final boolean ADD_TAGS_DEFAULT
See Also:
Constant Field Values

ADD_PREVIEW_IMAGES_DEFAULT

public static final boolean ADD_PREVIEW_IMAGES_DEFAULT
See Also:
Constant Field Values

PRINT_DIALOG_PROMPT_DEFAULT

public static final boolean PRINT_DIALOG_PROMPT_DEFAULT
See Also:
Constant Field Values

APPEND_LOG_DEFAULT

public static final boolean APPEND_LOG_DEFAULT
See Also:
Constant Field Values

ALLOW_ANNOTATIONS_DEFAULT

public static final boolean ALLOW_ANNOTATIONS_DEFAULT
See Also:
Constant Field Values

ALLOW_ASSEMBLY_DEFAULT

public static final boolean ALLOW_ASSEMBLY_DEFAULT
See Also:
Constant Field Values

ALLOW_COPY_DEFAULT

public static final boolean ALLOW_COPY_DEFAULT
See Also:
Constant Field Values

ALLOW_DEGRADED_PRINTING_DEFAULT

public static final boolean ALLOW_DEGRADED_PRINTING_DEFAULT
See Also:
Constant Field Values

ALLOW_FILL_IN_DEFAULT

public static final boolean ALLOW_FILL_IN_DEFAULT
See Also:
Constant Field Values

ALLOW_MODIFY_CONTENTS_DEFAULT

public static final boolean ALLOW_MODIFY_CONTENTS_DEFAULT
See Also:
Constant Field Values

ALLOW_PRINTING_DEFAULT

public static final boolean ALLOW_PRINTING_DEFAULT
See Also:
Constant Field Values

ALLOW_SCREEN_READERS_DEFAULT

public static final boolean ALLOW_SCREEN_READERS_DEFAULT
See Also:
Constant Field Values

VIEWER_PREFERENCES_DEFAULT

public static final int VIEWER_PREFERENCES_DEFAULT
See Also:
Constant Field Values

MERGE_URL_DEFAULT

public static final String MERGE_URL_DEFAULT

MERGE_BYTE_ARRAY_DEFAULT

public static final byte[] MERGE_BYTE_ARRAY_DEFAULT

MERGE_BEFORE_PDF_DEFAULT

public static final boolean MERGE_BEFORE_PDF_DEFAULT
See Also:
Constant Field Values

LOGGER_DEFAULT

public static final Logger LOGGER_DEFAULT

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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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 ViewerPreferences_PageModeFullScreen.

See Also:
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 ViewerPreferences_PageModeFullScreen.

See Also:
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 ViewerPreferences_PageModeFullScreen.

See Also:
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 ViewerPreferences_PageModeFullScreen.

See Also:
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:
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:
Constant Field Values
Constructor Detail

PDFreactor

public PDFreactor()
Constructs PDFreactor.

Method Detail

setLicenseKeyInputSource

public void setLicenseKeyInputSource(InputSource inputSource)
                              throws IOException
Deprecated. Since PDFreactor version 2. Replaced by setLicenseKey(String).

Sets the license key using an XML input source. The input source will be loaded and set by the setLicenseKey(String) method. If the input source is null then the license key is set to null.

Parameters:
inputSource - The input source of the license key.
Throws:
IOException - if an IO error occurs.
See Also:
PDFreactor.setLicenseKey(String)

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 a 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 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 following LOG_LEVEL_ constants to specify the log level:

LOG_LEVEL_NONE
LOG_LEVEL_FATAL
LOG_LEVEL_WARN
LOG_LEVEL_INFO
LOG_LEVEL_DEBUG
LOG_LEVEL_PERFORMANCE
LOG_LEVEL_DEFAULT

The default value specified by LOG_LEVEL_DEFAULT is LOG_LEVEL_NONE.

Parameters:
value - The new log level setting.
See Also:
PDFreactor.getLog()

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. Use one of the following CLEANUP_ constants to specify the cleanup tool:

CLEANUP_NONE
CLEANUP_JTIDY
CLEANUP_CYBERNEKO
CLEANUP_TAGSOUP
CLEANUP_DEFAULT

The default value specified by CLEANUP_DEFAULT is CLEANUP_CYBERNEKO.

Parameters:
value - The new cleanup tool.

setDocType

public void setDocType(String value)
Deprecated. Since PDFreactor version 2. Replaced by setDocumentType(int).

Sets the document type by a string. Valid values are "xhtml", "xml", "auto" and "default".

Parameters:
value - The new document type setting.
See Also:
PDFreactor.setDocumentType(int)

setDocTypeAsInt

public void setDocTypeAsInt(int value)
Deprecated. Since PDFreactor version 2. Replaced by setDocumentType(int).

Sets the document type.

Parameters:
value - The new document type setting.
See Also:
PDFreactor.setDocumentType(int)

setDocumentType

public void setDocumentType(int value)

Sets the document type. Use one of the following DOCTYPE_ constants to specify the document type:

DOCTYPE_AUTODETECT
DOCTYPE_XML
DOCTYPE_XHTML
DOCTYPE_DEFAULT

The default value specified by DOCTYPE_DEFAULT is DOCTYPE_AUTODETECT.

Parameters:
value - The new document type setting.

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 input source of the style sheet.
Throws:
IOException - If the stylesheet 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. Specifing the stylesheet only using an URI.
  2. Specifing the stylesheet by the content of the stylesheet 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. Specifing the stylesheet only by an URI.
  2. Specifing the stylesheet by the content of the stylesheet 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 following ENCRYPTION_ constants to specify the encryption:

ENCRYPTION_NONE
ENCRYPTION_40
ENCRYPTION_128
ENCRYPTION_DEFAULT

The default value specified by ENCRYPTION_DEFAULT is ENCRYPTION_NONE.

Parameters:
value - The new encryption setting.
See Also:
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.

Paramet