public class PDFreactorCompatibilityLayer extends Object
PDFreactor
converts HTML and XML 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("https://www.realobjects.com/");
outputStream.write(pdf);
outputStream.close();
Please note: A new instance of PDFreactor
should be created for every conversion.
Important: On a system without a graphical environment you have to enable the headless mode by setting the appropriate system property. Please see the manual for details.
For more information please have a look at the PDFreactor manual.
This API is deprecated. Use PDFreactor
instead.
Constructor and Description |
---|
PDFreactorCompatibilityLayer(Configuration config,
com.realobjects.pdfreactor.core.util.CachingLogHandler handler)
Creates an instance of
PDFreactor . |
Modifier and Type | Method and Description |
---|---|
com.realobjects.pdfreactor.core.PDFreactorConfiguration |
getConfig()
Returns a PDFreactor configuration object.
|
Connection[] |
getConnections() |
Record[] |
getCssMessages()
Returns the log messages of the CSS auxiliary log.
|
String |
getError()
Returns the error messages generated during rendering.
|
ExceedingContent[] |
getExceedingContents()
Provides information about content exceeding its page or parent.
|
String |
getJavaScriptExports() |
Record[] |
getJavaScriptMessages()
Returns the log messages of the JavaScript auxiliary log.
|
String |
getLog()
Returns the log messages generated during rendering based on the log
level.
|
Logger |
getLogger()
Returns the
Logger used by this PDFreactor . |
MissingResource[] |
getMissingResources()
Provides information about content exceeding its page or parent.
|
int |
getNumberOfPages(boolean pdf)
Returns the number of pages of the document after conversion.
|
byte[] |
renderDocumentInternal(InputSource inputSource,
boolean separate)
Generates a PDF document from an InputSource.
|
byte[][] |
renderDocumentInternal(InputSource inputSource,
OutputStream os,
boolean separate) |
public PDFreactorCompatibilityLayer(Configuration config, com.realobjects.pdfreactor.core.util.CachingLogHandler handler)
Creates an instance of PDFreactor
.
public com.realobjects.pdfreactor.core.PDFreactorConfiguration getConfig()
Returns a PDFreactor configuration object.
public byte[] renderDocumentInternal(InputSource inputSource, boolean separate) throws SAXException, IOException, TransformerException
Generates a PDF document from an InputSource.
The resulting PDF document will be returned as a byte array.
inputSource
- The input source of the XML document.separate
- TODOSAXException
IOException
TransformerException
com.realobjects.pdfreactor.Exceptions.PDFreactorException
public byte[][] renderDocumentInternal(InputSource inputSource, OutputStream os, boolean separate) throws SAXException, IOException, TransformerException
public Logger getLogger()
Returns the Logger
used by this PDFreactor
.
Logger
.#setLogger(Logger)
public String getError()
Returns the error messages generated during rendering.
String
.public String getLog()
Returns the log messages generated during rendering based on the log level.
String
.#setLogLevel(int)
public Record[] getJavaScriptMessages()
Returns the log messages of the JavaScript auxiliary log.
public Record[] getCssMessages()
Returns the log messages of the CSS auxiliary log.
public ExceedingContent[] getExceedingContents()
Provides information about content exceeding its page or parent. Depends on the mode set via #setContentObserver(int, int)
.
ExceedingContent
objects
or null
if the logging of exceeding content was not enabled, no content exceeded its page or parent
or no conversion was run, yet.public MissingResource[] getMissingResources()
Provides information about content exceeding its page or parent.
Depends on the mode set via #setContentObserver(int, int, boolean)
.
MissingResource
objects or null
if the logging of missing
resources was not enabled, no resources were missing or no conversion was run, yet.public Connection[] getConnections()
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.
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 laid out input document.public String getJavaScriptExports()
This doc was generated on 2020-09-17. Copyright © 2002-2020 RealObjects GmbH. All Rights Reserved.