RealObjects(R) PDFreactor(R) is a powerful formatting processor for converting HTML and XML documents into PDF.
The simplest sample for the PDFreactor Perl API:
#!/usr/bin/perl -w
use PDFreactor;
my $pdfReactor = PDFreactor -> new();
$result = $pdfReactor -> renderDocumentFromURL("http://www.pdfreactor.com");
print "Content-type: application/pdf\n\n";
print $result;
Indicates that no cleanup will be performed when loading document. If the loaded document is not well-formed, an exception will be thrown.
see setCleanupTool()
Indicates that JTidy will be used to perform a cleanup when loading a non-well-formed document.
see setCleanupTool()
Indicates that the CyberNeko HTML parser will be used to perform a cleanup when loading a document.
see setCleanupTool()
Indicates that the TagSoup HTML parser will be used to perform a cleanup when loading a document.
see setCleanupTool()
The default cleanup setting. It is set to CLEANUP_CYBERNEKO.
see setCleanupTool()
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 DOCTYPE_XML
see DOCTYPE_XHTML
see DOCTYPE_HTML5
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.
Indicates that the document type will be set to XHTML. The HTML default style sheet is used and the document is loaded regarding style elements, style attributes and link stylesheets.
Indicates that the document type will be set to HTML5. The HTML5 parser is used for this document. The HTML default style sheet is used and the document is loaded regarding style elements, style attributes and link stylesheets.
The default document type setting.
It is set to DOCTYPE_AUTODETECT.
Indicates the Default language used for a document if no other language is set in the document itself.
Indicates that the document will not be encrypted.
If encryption is disabled then no user password and no owner password can be used.
see setEncryption()
Indicates that the document will be encrypted using 40 bit encryption.
see setEncryption()
Indicates that the document will be encrypted using 128 bit encryption.
For normal purposes this value should be used.
see setEncryption()
The default encryption setting.
It is set to ENCRYPTION_NONE.
see setEncryption()
Keystore type "pkcs12"
see setSignPDF()
Keystore type "jks"
see setSignPDF()
Signing mode for self-signed certificates
see setSignPDF()
Signing mode for VeriSign certificates
see setSignPDF()
Signing mode for Windows certificates
see setSignPDF()
Indicates that no log events will be logged.
see setLogLevel()
Indicates that only fatal log events will be logged.
see setLogLevel()
Indicates that warn and fatal log events will be logged.
see setLogLevel()
Indicates that info, warn and fatal log events will be logged.
see setLogLevel()
Indicates that debug, info, warn and fatal log events will be logged.
see setLogLevel()
Indicates that all log events will be logged.
see setLogLevel()
The default log level setting.
It is set to LOG_LEVEL_NONE.
see setLogLevel()
Display one page at a time. (default)
Display the pages in one column.
Display the pages in two columns, with odd numbered pages on the left.
Display the pages in two columns, with odd numbered pages on the right.
Display two pages at a time, with odd numbered pages on the left.
Display two pages at a time, with odd numbered pages on the right.
Show no panel on startup.
Show document outline panel on startup.
Show thumbnail images panel on startup.
Switch to fullscreen mode on startup.
Show optional content group panel on startup.
Show attachments panel on startup.
Hide the viewer application's tool bars when the document is active.
Hide the viewer application's menu bar when the document is active.
Hide user interface elements in the document's window.
Resize the document's window to fit the size of the first displayed page
Position the document's window in the center of the screen.
Display the document's title in the top bar.
Show document outline panel on exiting full-screen mode.
Has to be combined with VIEWER_PREFERENCES_PAGE_MODE_FULLSCREEN.
Show thumbnail images panel on exiting full-screen mode.
Has to be combined with VIEWER_PREFERENCES_PAGE_MODE_FULLSCREEN.
Show optional content group panel on exiting full-screen mode.
Has to be combined with VIEWER_PREFERENCES_PAGE_MODE_FULLSCREEN.
Show attachments panel on exiting full-screen mode.
Has to be combined with VIEWER_PREFERENCES_PAGE_MODE_FULLSCREEN.
Position pages in ascending order from left to right.
Position pages in ascending order from right to left.
Print dialog default setting: disabled scaling.
Print dialog default setting: set scaling to application default value.
Print dialog default setting: simplex
Print dialog default setting: duplex (short edge)
Print dialog default setting: duplex (long edge).
Print dialog default setting: do not pick tray by PDF size.
Print dialog default setting: pick tray by PDF size.
The color space RGB
The color space CMYK
PDF with no additional restrictions (default)
see setConformance()
PDF/A-1a (ISO 19005-1 Level A)
see setConformance()
PDF/A-3a (ISO 19005-3 Level A)
see setConformance()
deprecated As of PDFreactor 7.0, replaced by CONFORMANCE_PDFA1A
see setConformance()
The default value of the conformance property which is CONFORMANCE_PDF.
see setConformance()
Processing preferences flag for the memory saving mode for images
see setProcessingPreferences()
Default merge mode: Append converted document to existing PDF
see setMergeMode()
Alternate merge mode: Prepend converted document to existing PDF
see setMergeMode()
Alternate merge mode (overlay): Adding new content above the existing PDF.
see setMergeMode()
Alternate merge mode (overlay): Adding new content below the existing PDF.
see setMergeMode()
No pages of the shorter document are repeated, leaving some pages of the longer document without overlay.
Last page of the shorter document is repeated, to overlay all pages of the longer document.
All pages of the shorter document are repeated, to overlay all pages of the longer document.
Page order mode to reverse the page order.
see setPageOrder()
Page order mode to keep odd pages only.
see setPageOrder()
Page order mode to keep even pages only.
see setPageOrder()
Page order mode to arrange all pages in booklet order.
see setPageOrder()
Page order mode to arrange all pages in right-to-left booklet order.
see setPageOrder()
Arranges the pages on a sheet from left to right and top to bottom.
see setPagesPerSheetProperties()
Arranges the pages on a sheet from right to left and top to bottom.
see setPagesPerSheetProperties()
Arranges the pages on a sheet from left to right and bottom to top.
see setPagesPerSheetProperties()
Arranges the pages on a sheet from right to left and bottom to top.
see setPagesPerSheetProperties()
Arranges the pages on a sheet from top to bottom and left to right.
see setPagesPerSheetProperties()
Arranges the pages on a sheet from top to bottom and right to left.
see setPagesPerSheetProperties()
Arranges the pages on a sheet from bottom to top and left to right.
see setPagesPerSheetProperties()
Arranges the pages on a sheet from bottom to top and right to left.
see setPagesPerSheetProperties()
Do not log exceeding content
Log exceeding content
Log exceeding content and boxes without absolute positioning
Log exceeding content and all boxes
Do not log exceeding content
Log content exceeding the edges of its page
Log content exceeding its page content area (overlaps the page margin)
Log content exceeding its container
Indicates that JavaScript is disabled.
Indicates that JavaScript is enabled.
Indicates that JavaScript is enabled, without access to layout data.
Indicates that JavaScript is enabled, without converter-specific optimizations to timeouts and intervals. This mode is significantly more time consuming and should only be used when no other mode provides the expected results.
Indicates that JavaScript is enabled, with time stamps increasing more quickly. This makes some kinds of JS based animations (e.g. when using jQuery) finish immediately, which has the same effect as JAVASCRIPT_MODE_ENABLED_REAL_TIME, but is significantly faster. Only Date.getTime() is affected by this.
Indicates strict HTTPS behavior. This matches the default behavior of Java.
see setHTTPSMode()
Indicates lenient HTTPS behavior. This means that many certificate issues are ignored.
see setHTTPSMode()
PDF output format
JPEG output format
PNG output format (using Java Image I/O)
Transparent PNG output format (using Java Image I/O)
BMP output format
GIF output format
PNG output format (using Apache Imaging)
Transparent PNG output format (using Apache Imaging)
LZW compressed TIFF output format
PackBits compressed TIFF output format
Uncompressed TIFF output format
Monochrome CCITT 1D compressed TIFF output format
Monochrome CCITT Group 3 compressed TIFF output format
Monochrome CCITT Group 4 compressed TIFF output format
PDFreactor()
my $PDFreactor = PDFreactor -> new();
The PDFreactor constructor
setLicenseKey()
$PDFreactor -> setLicenseKey(string);
Sets the license key using a string.
If no license key could be found then PDFreactor runs in evaluation mode.
The default value is null.
param string $content The content of the license key as a string.
setDisableFontRegistration()
$PDFreactor -> setDisableFontRegistration(boolean);
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.
param boolean $value The new value of the font registration setting.
see setCacheFonts()
setDisableSystemFonts()
$PDFreactor -> setDisableSystemFonts(boolean);
Enables or disables system fonts.
If system fonts are disabled, PDFreactor will neither scan for system fonts nor use the respective font cache.
The default value is false.
param boolean $value The new value of the system font registration setting.
see setDisableFontRegistration()
setCacheFonts()
$PDFreactor -> setCacheFonts(boolean);
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.
param boolean $value The new value of the cache fonts setting.
see setDisableFontRegistration()
setFontCachePath()
$PDFreactor -> setFontCachePath(string);
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.
param string $location The path of the font cache.
see setDisableFontRegistration()
see setCacheFonts()
setFontDirectory()
$PDFreactor -> setFontDirectory(string);
deprecated As of PDFreactor 6.0, replaced by addFontDirectory().
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%".
param string $location The font directory.
see setDisableFontRegistration()
see setCacheFonts()
addFont()
$PDFreactor -> addFont(string, string, boolean, boolean);
Loads a font from a URL which can be used via the CSS property "font-family".
param string $source The URL to load the font from.
param string $family The font family name the loaded font will be labeled as.
param boolean $bold Whether the font is bold.
param boolean $italic Whether the font is italic.
addFontAlias()
$PDFreactor -> addFontAlias(string, string, boolean, boolean);
Registers an alias font family for an existing font.
This function is limited to fonts loaded automatically from system folders.
param string $source The name of a existing font family.
param string $family The alias name for that font.
param boolean $bold Whether the font is bold.
param boolean $italic Whether the font is italic.
addFontDirectory()
$PDFreactor -> addFontDirectory(string);
Registers an additional font directory to load fonts from.
param string $fontDirectory The path of the font directory.
setLogLevel()
$PDFreactor -> setLogLevel(int);
Sets the log level.
Use one of the following LOG_LEVEL_ constants to specify the log level:
The default value is LOG_LEVEL_NONE.
param int $value The new log level setting.
see LOG_LEVEL_NONE
see LOG_LEVEL_FATAL
see LOG_LEVEL_WARN
see LOG_LEVEL_INFO
see LOG_LEVEL_DEBUG
see getLog()
setLogExceedingContent()
$PDFreactor -> setLogExceedingContent(int, int);
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 EXCEEDING_CONTENT_ANALYZE_NONE.
Use EXCEEDING_CONTENT_AGAINST_ constants to specify that exceeding this content starts exceeding content logging. The default value is EXCEEDING_CONTENT_AGAINST_NONE.
param int $logExceedingContentAnalyze Enables logging of exceeding content and optionally of boxes.
param int $logExceedingContentAgainst Enables logging of exceeding content either against the page edges, page content areas or containers.
see EXCEEDING_CONTENT_ANALYZE_NONE
see EXCEEDING_CONTENT_ANALYZE_CONTENT
see EXCEEDING_CONTENT_ANALYZE_CONTENT_AND_BOXES
see EXCEEDING_CONTENT_ANALYZE_CONTENT_AND_STATIC_BOXES
see EXCEEDING_CONTENT_AGAINST_NONE
see EXCEEDING_CONTENT_AGAINST_PARENT
see EXCEEDING_CONTENT_AGAINST_PAGE_CONTENT
see EXCEEDING_CONTENT_AGAINST_PAGE_BORDERS
setThrowLicenseExceptions()
$PDFreactor -> setThrowLicenseExceptions(boolean)
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.
param boolean $throwLicenseExceptions Whether an exception should be thrown.
setBaseURL()
$PDFreactor -> setBaseURL(string);
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 specifyanother reference URL. If this URL is not null then it will be used instead of the system id.
The default value is null.
param string $value The base URL for the document.
setXSLTMode()
$PDFreactor -> setXSLTMode(boolean);
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.
param boolean $value The new XSLT mode.
setPostTransformationDocumentType()
$PDFreactor -> setPostTransformationDocumentType(int);
Sets the document type after XSL-Transformations have been applied.
The <code>DOCTYPE_</code> constants can be used to specify the document type.
The default value specified is L</"DOCTYPE_AUTODETECT">.
param int $value The new document type setting.
see DOCTYPE_XML
see DOCTYPE_XHTML
see DOCTYPE_HTML5
setEncoding()
$PDFreactor -> setEncoding(string);
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.
param string $value The encoding of the document or null for autodetection.
setCleanupTool()
$PDFreactor -> setCleanupTool(int);
Sets the cleanup tool to use for documents with unparsable content.
The default value specified by CLEANUP_DEFAULT is CLEANUP_CYBERNEKO.
The cleanup tool is only used for DOCTYPE_XHTML. HTML5 utilizes an internal cleanup.
param int $value The new cleanup tool.
Use one of the following CLEANUP_ constants to specify the cleanup tool:
see CLEANUP_NONE
see CLEANUP_JTIDY
see CLEANUP_TAGSOUP
see CLEANUP_DEFAULT
setDocumentType()
$PDFreactor -> setDocumentType(int);
Sets the document type.
The DOCTYPE_ constants can be used to specify the document type.
The default value specified by DOCTYPE_DEFAULT is link DOCTYPE_AUTODETECT.
param int $value The new document type setting.
Use one of the following DOCTYPE_ constants to specify the document type:
see DOCTYPE_XML
see DOCTYPE_XHTML
see DOCTYPE_HTML5
see DOCTYPE_DEFAULT
setDocumentDefaultLanguage()
$PDFreactor -> setDocumentDefaultLanguage(string);
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.
param string $languageCode the default ISO 639 language code used for documents.
addUserStyleSheet()
$PDFreactor -> addUserStyleSheet(string, string, string, string);
Adds a user style sheet to the document.
There are two ways to specify the style sheet:
param string $content The content of the style sheet.
param string $media The media type of the style sheet.
param string $title The title of the stylesheet.
param string $uri The URI of the style sheet.
see removeAllUserStyleSheets()
removeAllUserStyleSheets()
$PDFreactor -> removeAllUserStyleSheets();
Removes all user style sheets.
addIntegrationStyleSheet()
$PDFreactor -> addIntegrationStyleSheet(string, string, string, string);
Adds an integration style sheet to the document.
There are two ways to specify the style sheet:
param string $content The content of the style sheet.
param string $media The media type of the style sheet.
param string $title The title of the stylesheet.
param string $uri The URI of the style sheet.
see removeAllIntegrationStyleSheets()
removeAllIntegrationStyleSheets()
$PDFreactor -> removeAllIntegrationStyleSheets();
Removes all integration style sheets.
see addIntegrationStyleSheet()
addXSLTStyleSheet()
$PDFreactor -> addXSLTStyleSheet(string, string);
Adds a XSLT style sheet to the document.
There are two ways to specify the style sheet:
param string $content The content of the style sheet.
param string $uri The URI of the style sheet.
see removeAllXSLTStyleSheets()
removeAllXSLTStyleSheets()
$PDFreactor -> removeAllXSLTStyleSheets();
Removes all XSLT style sheets.
addUserScript()
$PDFreactor -> addUserScript(string, string, boolean);
Adds an user script to the document.
There are two ways to specify the script:
param string $content The content of the script.
param string $uri The URI of the script.
param boolean $beforeDocumentScripts Use true to cause PDFreactor to run the script before all scripts inside the document and false to run it after.
removeAllUserScripts()
$PDFreactor -> removeAllUserScripts();
Removes all user scripts.
see addUserScript()
setJavaScriptMode()
$PDFreactor -> setJavaScriptMode(int);
Sets the JavaScript Mode. Be default JavaScript is disabled.
param int $javaScriptMode The JavaScript Mode.
See JAVASCRIPT_MODE_ENABLED_NO_LAYOUT
See JAVASCRIPT_MODE_ENABLED_REAL_TIME
See JAVASCRIPT_MODE_ENABLED_TIME_LAPSE
setAuthor()
$PDFreactor -> setAuthor(string);
Sets the value of the author field of the PDF document.
param string $value The author of the document.
setCreator()
$PDFreactor -> setCreator(string);
Sets the value of creator field of the PDF document.
param string $value The creator of the document.
setKeywords()
$PDFreactor -> setKeywords(string);
Sets the value of the keywords field of the PDF document.
param string $value The keywords of the document.
setTitle()
$PDFreactor -> setTitle(string);
Sets the value of the title field of the PDF document.
param string $value The title of the document.
setSubject()
$PDFreactor -> setSubject(string);
Sets the value of the subject field of the PDF document.
param string $value The subject of the document.
addCustomDocumentProperty()
$PDFreactor -> addCustomDocumentProperty(string, string);
Adds a custom property to the PDF document. An existing property of the same name will be replaced.
param string $name The name of the property.
param string $value The value of the property.
addAttachment()
$PDFreactor -> addAttachment(base64string, string, string, string);
Adds a file attachment to PDF document.
param base64string $data The content of the attachment as a base64 encoded string. May be null.
param string $url If data is null, the attachment will be retrieved from this URL. If this is "#" the input document URL is used instead.
param string $name The file name associated with the attachment. It is recommended to specify the correct file extension. If this is null the name is derived from the URL.
param string $description The description of the attachment. If this is null the name is used.
setAddAttachments()
$PDFreactor -> setAddAttachments(boolean);
Enables or disables attachments specified in style sheets.
The default value is false.
param boolean $value Whether to enable CSS based attachments.
setAddOverprint()
$PDFreactor -> setAddOverprint(boolean);
Enables or disables overprinting.
The default value is false.
param boolean $value Whether to enable overprinting.
setEncryption()
$PDFreactor -> setEncryption(int);
Sets the encryption.
The default value specified by ENCRYPTION_DEFAULT is ENCRYPTION_NONE.
param int $value The new encryption setting.
Use one of the following ENCRYPTION_ constants to specify the encryption:
see ENCRYPTION_NONE
see ENCRYPTION_40
see ENCRYPTION_128
see setAllowCopy()
see setAllowDegradedPrinting()
see setAllowFillIn()
setFullCompression()
$PDFreactor -> setFullCompression(boolean);
Enables or disables full compression of the PDF document.
The default value is false.
param boolean $value true to enable full compression of the document and false to disable full compression.
setOwnerPassword()
$PDFreactor -> setOwnerPassword(string);
Sets the owner password of the PDF document.
The default value is null
param string $value The owner password.
see setEncryption()
setUserPassword()
$PDFreactor -> setUserPassword(string);
Sets the user password of the PDF document.
The default value is null.
param string $value The user password.
see setEncryption()
setAuthenticationCredentials()
$PDFreactor -> setAuthenticationCredentials(string, string);
Enables access to resources that are secured via Basic or Digest authentication.
param string $authenticationUsername The user name for the secured realm.
param string $authenticationPassword The password for the secured realm.
setHTTPSMode()
$PDFreactor -> setHTTPSMode(int);
Sets the HTTPS Mode. By default strict mode is set.
In closed environment lenient can be the preferred setting to avoid HTTPS issues that are not security critical.
param int $httpsMode The HTTPS mode constant.
setRequestHeader()
$PDFreactor -> setRequestHeader(string, string);
Adds a request header to all outgoing HTTP connections. If the key already exists, the pair is overwritten.
param string $requestHeaderKey The key of the header.
param string $requestHeaderValue The value of the header.
setCookies()
$PDFreactor -> setCookies(string, string);
Adds a cookie to all outgoing HTTP connections. If the key already exists, the pair is overwritten.
param string $cookieKey An array of keys of cookies.
param string $cookieValue An array of values of cookies.
setAddLinks()
$PDFreactor -> setAddLinks(boolean);
Enables or disables links in the PDF document.
The default value is false.
param boolean $value Use true to enable links in the document and false to disable links.
setAddBookmarks()
$PDFreactor -> setAddBookmarks(boolean);
Enables or disables bookmarks in the PDF document.
The default value is false.
param boolean $value Use true to enable bookmarks in the document and false to disable bookmarks.
setAddTags()
$PDFreactor -> setAddTags(boolean);
Enables or disables tagging of PDF document.
The default value is false.
param boolean $value Use true to enable tagging of the document and false to disable tagging.
setAddComments()
$PDFreactor -> setAddComments(boolean);
Enables or disables comments in the PDF document.
The default value is false.
param boolean $value Use true to enable comments in the document and false to disable comments.
setAddPreviewImages()
$PDFreactor -> setAddPreviewImages(boolean);
Enables or disables embedding of image previews per page in the PDF document.
The default value is false.
param boolean $value Use true to enable embedding of image previews per page in the document and false to disable embedding of image previews per page.
setAddPrintDialogPrompt()
$PDFreactor -> setAddPrintDialogPrompt(boolean);
Enables or disables a print dialog to be shown upon opening the generated PDF document by a PDF viewer.
The default value is false.
param boolean $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()
$PDFreactor -> setAppendLog(boolean);
Specifies whether or not the log data should be added to the PDF document.
The default value is false.
param boolean $value Use true to add the log data to the document and false if the log data should not be added.
setAllowAnnotations()
$PDFreactor -> setAllowAnnotations(boolean);
Enables or disables the 'annotations' restriction in the PDF document.
The default value is false.
param boolean $value Use true to enable 'annotations' in the document and false to disable 'annotations'.
see setEncryption()
setAllowAssembly()
$PDFreactor -> setAllowAssembly(boolean);
Enables or disables the 'assembly' restriction in the PDF document.
The default value is false.
param boolean $value Use true to enable 'assembly' in the document and false to disable 'assembly'.
see setEncryption()
setAllowCopy()
$PDFreactor -> setAllowCopy(boolean);
Enables or disables the 'copy' restriction in the PDF document.
The default value is false.
param boolean $value Use true to enable 'copy' in the document and false to disable 'copy'.
see setEncryption()
setAllowDegradedPrinting()
$PDFreactor -> setAllowDegradedPrinting(boolean);
Enables or disables the 'degraded printing' restriction in the PDF document.
The default value is false.
param boolean $value Use true to enable 'degraded printing' in the document and false to disable 'degraded printing'.
see setEncryption()
setAllowFillIn()
$PDFreactor -> setAllowFillIn(boolean);
Enables or disables the 'fill in' restriction in the PDF document.
The default value is false.
param boolean $value Use true to enable 'fill in' in the document and false to disable 'fill in'.
see setEncryption()
setAllowModifyContents()
$PDFreactor -> setAllowModifyContents(boolean);
Enables or disables the 'modify contents' restriction in the PDF document.
The default value is false.
param boolean $value Use true to enable 'modify contents' in the document and false to disable 'modify contents'.
see setEncryption()
setAllowPrinting()
$PDFreactor -> setAllowPrinting(boolean);
Enables or disables the 'printing' restriction in the PDF document.
The default value is false.
param boolean $value Use true to enable 'printing' in the document and false to disable 'printing'.
see setEncryption()
setAllowScreenReaders()
$PDFreactor -> setAllowScreenReaders(boolean);
Enables or disables the 'screen readers' restriction in the PDF document.
The default value is false.
param boolean $value Use true to enable 'screen readers' in the document and false to disable 'screen readers'.
see setEncryption()
setProcessingPreferences()
$PDFreactor -> setProcessingPreferences(int);
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.
param int $processingPreferences A value of ORed processing preferences flags.
see PROCESSING_PREFERENCES_SAVE_MEMORY_IMAGES
setViewerPreferences()
$PDFreactor -> setViewerPreferences(int);
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.
param int $viewerPreferences ORed VIEWERPREFERENCES_ constants.
see VIEWER_PREFERENCES_CENTER_WINDOW
see VIEWER_PREFERENCES_DIRECTION_L2R
see VIEWER_PREFERENCES_DIRECTION_R2L
see VIEWER_PREFERENCES_DISPLAY_DOC_TITLE
see VIEWER_PREFERENCES_DUPLEX_FLIP_LONG_EDGE
see VIEWER_PREFERENCES_DUPLEX_FLIP_SHORT_EDGE
see VIEWER_PREFERENCES_DUPLEX_SIMPLEX
see VIEWER_PREFERENCES_FIT_WINDOW
see VIEWER_PREFERENCES_HIDE_MENUBAR
see VIEWER_PREFERENCES_HIDE_TOOLBAR
see VIEWER_PREFERENCES_HIDE_WINDOW_UI
see VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_NONE
see VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_OC
see VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_OUTLINES
see VIEWER_PREFERENCES_NON_FULLSCREEN_PAGE_MODE_USE_THUMBS
see VIEWER_PREFERENCES_PAGE_LAYOUT_ONE_COLUMN
see VIEWER_PREFERENCES_PAGE_LAYOUT_SINGLE_PAGE
see VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_COLUMN_LEFT
see VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_COLUMN_RIGHT
see VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_PAGE_LEFT
see VIEWER_PREFERENCES_PAGE_LAYOUT_TWO_PAGE_RIGHT
see VIEWER_PREFERENCES_PAGE_MODE_FULLSCREEN
see VIEWER_PREFERENCES_PAGE_MODE_USE_NONE
see VIEWER_PREFERENCES_PAGE_MODE_USE_OC
see VIEWER_PREFERENCES_PAGE_MODE_USE_OUTLINES
see VIEWER_PREFERENCES_PAGE_MODE_USE_THUMBS
see VIEWER_PREFERENCES_PICKTRAYBYPDFSIZE_FALSE
see VIEWER_PREFERENCES_PICKTRAYBYPDFSIZE_TRUE
see VIEWER_PREFERENCES_PRINTSCALING_APPDEFAULT
see VIEWER_PREFERENCES_PRINTSCALING_NONE
setConformance()
$PDFreactor -> setConformance(int);
Sets the conformance of the PDF.
The CONFORMANCE_ constants can be used as value. The default value specified is CONFORMANCE_PDF.
param int $conformances conformance constants.
see CONFORMANCE_PDF
setDefaultColorSpace()
$PDFreactor -> setDefaultColorSpace();
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 COLOR_SPACE_RGB.
param boolean $defaultColorSpace The default color space of the PDF.
see COLOR_SPACE_CMYK
see COLOR_SPACE_RGB
setOutputIntentFromURL()
$PDFreactor -> setOutputIntentFromURL(String, String);
Sets the ouput intent including the identifier and the ICC profile to be embedded into the PDF.
param String $identifier the OutputConditionIdentifier.
param String $profileUrl the DestOutputProfile.
setOutputIntentFromByteArray()
$PDFreactor -> setOutputIntentFromByteArray(String, base64string);
Sets the output intent including the identifier and the ICC profile to be embedded into the PDF.
param String $identifier the OutputConditionIdentifier.
param base64string $profileData the DestOutputProfile.
setDisableFontEmbedding()
$PDFreactor -> setDisableFontEmbedding(boolean);
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.
param boolean $disableFontEmbedding whether fonts will not be embedded
setFontFallback()
$PDFreactor -> setFontFallback(String);
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.
param array $fontFallback an array of font family names
setPixelsPerInch()
$PDFreactor -> setPixelsPerInch(int)
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.
param int $pixelsPerInch the pixel conversion factor.
setPixelsPerInchShrinkToFit()
$PDFreactor -> setPixelsPerInchShrinkToFit(boolean)
Whether the pixels per inch should be adapted to avoid content exceeding pages.
param boolean $pixelsPerInchShrinkToFit whether the pixel conversion factor should be adapted.
setPageOrder()
$PDFreactor -> setPageOrder(string);
Sets the page order of the direct result of the conversion. A comma-separated list of page numbers and ranges is intended as parameter. Alternatively, constants can be used.
param string $order the page order
see PAGE_ORDER_EVEN
see PAGE_ORDER_ODD
setPagesPerSheetProperties()
$PDFreactor -> setPagesPerSheetProperties(int, int, string, string, string, int)
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 PAGES_PER_SHEET_DIRECTION_RIGHT_DOWN.
param int $pagesPerSheetCols The number of columns per sheet.
param int $pagesPerSheetRows The number of rows per sheet.
param string $pagesPerSheetSheetSize The sheet size as CSS size, e.g. A4, letter landscape, 15in 20in, 20cm 30cm.
param string $pagesPerSheetSheetMargin The sheet margin as CSS margin, e.g. 1in, 1cm 1.5cm, 10mm 20mm 10mm 30mm. null is interpreted as 0mm.
param string $pagesPerSheetSpacing The horizontal and vertical space between pages on a sheet as CSS value, e.g. 0.1in, 5mm 2mm. null is interpreted as 0mm.
param int $pagesPerSheetDirection The direction in which the pages are ordered on a sheet.
see PAGES_PER_SHEET_DIRECTION_DOWN_LEFT
see PAGES_PER_SHEET_DIRECTION_DOWN_RIGHT
see PAGES_PER_SHEET_DIRECTION_LEFT_DOWN
see PAGES_PER_SHEET_DIRECTION_LEFT_UP
see PAGES_PER_SHEET_DIRECTION_RIGHT_DOWN
see PAGES_PER_SHEET_DIRECTION_RIGHT_UP
see PAGES_PER_SHEET_DIRECTION_UP_LEFT
see PAGES_PER_SHEET_DIRECTION_UP_RIGHT
setBookletMode()
$PDFreactor -> setBookletMode(string, string, boolean)
Convenience method to set pages-per-sheet properties and page order in one step to create a booklet.
param string $bookletSheetSize The size of the sheet as CSS value, e.g. A3, letter landscape, 15in 20in, 20cm 30cm.
param string $bookletSheetMargin The sheet margin as CSS margin, e.g. 1in, 1cm 1.5cm, 10mm 20mm 10mm 30mm. null is interpreted as 0mm.
param boolean $bookletRTL Whether or not the reading order of the booklet should be right-to-left.
setMergeURL()
$PDFreactor -> setMergeURL(string);
This methods sets a URL of an external PDF document which will be merged with the PDF document generated by the XML source.
param string $url A URL of a PDF document.
setMergeURLs()
$PDFreactor -> setMergeURLs(string);
This method sets an array of URLs of external PDF documents which will be merged with the PDF document generated by the XML source.
param string $urls An array of URLs of PDF documents.
see setMergeURL()
setMergeByteArray()
$PDFreactor -> setMergeByteArray(base64string);
This methods sets a byte array containing an external PDF document which will be merged with the PDF document generated by the XML source.
The default value is null.
param string $base64string A base64 encoded binary string containing the PDF RAW data.
see setMergeURL()
see setMergeURLs()
setMergeByteArrays()
$PDFreactor -> setMergeByteArrays(base64string);
This method sets an array of several byte arrays containing external PDF documents which will be merged with the PDF document generated by the XML source.
param $array An array of byte arrays containing multiple PDF RAW data.
see setMergeURL()
see setMergeURLs()
setMergeBeforePDF()
$PDFreactor -> setMergeBeforePDF(boolean);
deprecated As of PDFreactor 5.0, replaced by setMergeMode(int)
see setMergeMode()
setMergeMode()
$PDFreactor -> setMergeMode(int);
Sets the merge mode.
The following merge methods can be used:
The default value is MERGE_MODE_APPEND.
param int $modeMode The merge mode.
setOverlayRepeat()
$PDFreactor -> setOverlayRepeat(int);
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.
The default value is OVERLAY_REPEAT_NONE.
param int $overlayRepeat The repeating mode.
setSignPDF()
$PDFreactor -> setSignPDF(string, string, string, string, int)
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.
param string $keystoreURL The URL to the keystore file.
param string $keyAlias The alias of the certificate included in the keystore to be used to sign the PDF.
param string $keystorePassword The password of the keystore.
param string $keystoreType The format of the keystore, i.e. pkcs12 or jks. Use one of the KEYSTORE_TYPE_ constants as value.
param int $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 SIGNING_MODE_VERISIGN_SIGNED
see SIGNING_MODE_WINCER_SIGNED
setOutputFormat()
$PDFreactor -> setOutputFormat(int, int, int);
Sets the output format. The default value is PDF. For image formats the width or height in pixels must be specified. When either dimension is <1 it is computed based on the other dimension and the aspect ratio of the input document.
param int $format the output format. See OUTPUT_FORMAT_ constants
param int $outputWidth The with of the output in pixels (). Values <1 will be computed based on the specified height and the aspect ratio of the input document.
param int $outputHeight The height of the output in pixels (). Values <1 will be computed based on the specified width and the aspect ratio of the input document.
see OUTPUT_FORMAT_PNG_TRANSPARENT
see OUTPUT_FORMAT_PNG_TRANSPARENT_AI
see OUTPUT_FORMAT_TIFF_PACKBITS
see OUTPUT_FORMAT_TIFF_UNCOMPRESSED
see OUTPUT_FORMAT_TIFF_CCITT_1D
see OUTPUT_FORMAT_TIFF_CCITT_GROUP_3
see OUTPUT_FORMAT_TIFF_CCITT_GROUP_4
setContinuousOutput()
$PDFreactor -> setContinuousOutput(int, int);
Enables the conversion of the input document into one image.
param int $width equivalent to the width of a browser window (). Values <1 enable paginated output
param int $height equivalent to the height of a browser window (). For values <1 the entire height of the document is used.
enableDebugMode()
$PDFreactor -> enableDebugMode();
Enables debug mode, which adds additional information to the output.
renderDocumentFromURL()
$PDFreactor -> renderDocumentFromURL(string);
Generates a PDF document from a XML document based on the current settings.
The document can be specified by a URL pointing to the document.
param string $url A URL pointing to the XML document.
return string The PDF document as a base64 encoded binary string.
see renderDocumentFromByteArray()
see renderDocumentFromContent()
renderDocumentFromByteArray()
$PDFreactor -> renderDocumentFromByteArray(base64string);
Generates a PDF document from a XML document based on the current settings.
The document can be specified by a byte array containing the content of the document.
param string $byteArray A binary string containing the content of the XML document.
return string The PDF document as a base64 encoded binary string.
see renderDocumentFromContent()
renderDocumentFromContent()
$PDFreactor -> renderDocumentFromContent(string);
Generates a PDF document from a XML document based on the current settings.
The document can be specified by a string containing the content of the document.
param string $content A string containing the content of the XML document.
return string The PDF document as a base64 encoded binary string.
see renderDocumentFromByteArray()
renderDocumentFromURLAsArray()
$PDFreactor -> renderDocumentFromURLAsArray(String);
Generates an array of byte-arrays each containing an image representing one page of the document from an HTML or XML document at a URL.
param String $url A URL pointing to the input document.
return an array of byte-arrays each containing an image representing one page of the document
see renderDocumentFromByteArrayAsArray()
see renderDocumentFromContentAsArray()
renderDocumentFromByteArrayAsArray()
$PDFreactor -> renderDocumentFromByteArrayAsArray(base64string);
Generates an array of byte-arrays each containing an image representing one page of the document from an HTML or XML document inside a byte-array.
I<param String $byteArray An array containing the content of the HTML or XML document.>
return an array of byte-arrays each containing an image representing one page of the document
see renderDocumentFromByteArray()
see renderDocumentFromContentAsArray()
see renderDocumentFromURLAsArray()
renderDocumentFromContentAsArray()
$PDFreactor -> renderDocumentFromContentAsArray(String);
Generates an array of byte-arrays each containing an image representing one page of the document from an HTML or XML document inside a String.
I<param String $content An String containing the content of the HTML or XML document.>
return an array of byte-arrays each containing an image representing one page of the document
see renderDocumentFromByteArrayAsArray()
see renderDocumentFromContent()
see renderDocumentFromURLAsArray()
getError()
$PDFreactor -> getError();
Returns the error messages generated during rendering.
return string The message string.
getLog()
$PDFreactor -> getLog();
Returns the log messages generated during rendering based on the log level.
return string The log string.
see setLogLevel()
getExceedingContents()
$PDFreactor -> getExceedingContents();
Provides information about content exceeding its page or parent. Depends on the
mode set via setLogExceedingContent().
return An array of Perl Hashes representing exceeding content or undef if the logging of exceeding content was not enabled or no conversion was run, yet or if there is no exceeding content.
The exceeding content hashes have the following keys:
"pageNumber" - the number of the page that contains the exceeding content.
"description" - the text that exceeds the page or null if this exceeding content is an image.
"box" - whether the exceeding content is a box.
"top" - whether the content exceeds the page at the top.
"right" - whether the content exceeds the page to the right.
"bottom" - whether the content exceeds the page at the bottom.
"left" - whether the content exceeds the page to the left.
"containerTop" - the top coordinate of the the container box in the page in pixels. Depending on the settings this box may be the page
"containerRight" - the right coordinate of the the container box in the page in pixels. Depending on the settings this box may be the page
"containerBottom" - the bottom coordinate of the the container box in the page in pixels. Depending on the settings this box may be the page
"containerLeft" - the left coordinate of the the container box in the page in pixels. Depending on the settings this box may be the page
"exceedingBoxTop" - the top coordinate of the the exceeding box in the page in pixels.
"exceedingBoxRight" - the right coordinate of the the exceeding box in the page in pixels.
"exceedingBoxBottom" - the bottom coordinate of the the exceeding box in the page in pixels.
"exceedingBoxLeft" - the left coordinate of the the exceeding box in the page in pixels.
"pageTop" - the top coordinate of the the page in pixels.
"pageRight" - the right coordinate of the the page in pixels.
"pageBottom" - the bottom coordinate of the the page in pixels.
"pageLeft" - the left coordinate of the the page in pixels.
"summary" - summary of this exceeding content object.
"html" - the HTML of the box that contains the exceeding content.
"path" - an array of integers denoting the indexes of the ancestors of the DOM node corresponding to the box containing the exceeding content, starting from below the root node down to the element itself.
getNumberOfPages()
$PDFreactor -> getNumberOfPages(boolean);
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.
return int The number of pages of the document after conversion.
param boolean $PDF If true, return the number of pages of the resulting PDF (including, e.g., merge operations), else return those of the laid out input document.