public class PDFRenderer extends FormatProducer implements LayoutedPagesConsumer, java.io.Serializable
FontInfoPdf
.
Modifier and Type | Class and Description |
---|---|
static class |
PDFRenderer.AttachmentRelationship |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
legalCopyright |
Modifier | Constructor and Description |
---|---|
protected |
PDFRenderer()
Creates a PDFRenderer object.
|
|
PDFRenderer(FormatHandler handler)
Creates a PDFRenderer object that outputs to the given
handler object.
|
Modifier and Type | Method and Description |
---|---|
static void |
addAttachment(org.xml.sax.ContentHandler handler,
java.net.URL url,
java.lang.String mimeType,
java.lang.String fileName,
java.lang.String description,
PDFRenderer.AttachmentRelationship relationship)
Embeds a file in the PDF.
|
static void |
embedFacturXAttachment(org.xml.sax.ContentHandler handler,
java.lang.String url)
Embeds a Factur-X XML invoice document in the PDF.
|
static void |
embedFacturXAttachment(org.xml.sax.ContentHandler handler,
java.net.URL url)
Embeds a Factur-X XML invoice document in the PDF.
|
void |
setEncodeImagesAsJPEG(java.lang.Boolean encodeImagesAsJPEG)
Sets whether images included in the document are encoded in JPEG
format or in a more space consuming lossless format.
|
void |
setFontDirectory(java.lang.String fontDirectory)
Sets an additional search directory for font files.
|
void |
setFromPage(java.lang.Integer fromPage)
Sets the first page to be included in the document.
|
void |
setJPEGQuality(java.lang.Double quality)
Sets the compression quality to a value between
0
and 1 in case JPEG image inclusion has been selected. |
void |
setMaximumImageResolution(java.lang.Integer maximumImageResolutionInDPI)
Sets the maximum DPI of images included in the document.
|
void |
setToPage(java.lang.Integer toPage)
Sets the last page (inclusive) to be included in the document.
|
setHandler
public static final java.lang.String legalCopyright
protected PDFRenderer()
public PDFRenderer(FormatHandler handler)
handler
- A FormatHandlerpublic void setFontDirectory(java.lang.String fontDirectory)
fontDirectory
- An absolute path to a directory containing
font files.public void setFromPage(java.lang.Integer fromPage)
fromPage
- an integer greater than zero and less than or equal to
toPage.java.lang.IllegalArgumentException
- if the above condition
is violated.public void setToPage(java.lang.Integer toPage)
toPage
- an integer greater than zero and greater than or equal
to fromPage.java.lang.IllegalArgumentException
- if the above condition
is violated.public void setEncodeImagesAsJPEG(java.lang.Boolean encodeImagesAsJPEG)
false
.encodeImagesAsJPEG
- whether images are encoded in JPEG
or in a lossless formatpublic void setJPEGQuality(java.lang.Double quality)
0
and 1
in case JPEG image inclusion has been selected.
A compression quality setting of 0.0 is interpreted as "high compression is important," while a setting of 1.0 is interpreted as "high image quality is important."
quality
- a float
between 0
and
1
indicating the desired quality level.java.lang.IllegalArgumentException
- if quality
is
not between 0
and 1
, inclusive.setEncodeImagesAsJPEG(java.lang.Boolean)
public void setMaximumImageResolution(java.lang.Integer maximumImageResolutionInDPI)
maximumImageResolutionInDPI
- the maximum resolution of images included in the documentjava.lang.IllegalArgumentException
- if maximumImageResolutionInDPI
is not greater
than 0
.public static void embedFacturXAttachment(org.xml.sax.ContentHandler handler, java.lang.String url) throws org.xml.sax.SAXException, java.net.MalformedURLException
handler
- the content handler of the current report pipeurl
- the url from which the XML document is readjava.lang.IllegalArgumentException
- if handler
or url
are null.java.net.MalformedURLException
- if url
cannot be parsed.org.xml.sax.SAXException
public static void embedFacturXAttachment(org.xml.sax.ContentHandler handler, java.net.URL url) throws org.xml.sax.SAXException
handler
- the content handler of the current report pipeurl
- the url from which the XML document is readjava.lang.IllegalArgumentException
- if handler
or url
are null.org.xml.sax.SAXException
public static void addAttachment(org.xml.sax.ContentHandler handler, java.net.URL url, java.lang.String mimeType, java.lang.String fileName, java.lang.String description, PDFRenderer.AttachmentRelationship relationship) throws org.xml.sax.SAXException
handler
- the content handler of the current report pipeurl
- the url from which the XML document is readmimeType
- the mime type of the attachment (e.g. application/vnd.openxmlformats-officedocument.spreadsheetml.sheet for an .xlsx file).
If the mime type is not specified then an attempt will be made to compute it from the fileName
param.fileName
- the name of the file (e.g. report.xlsx)
Note that this does not specify the location of the file. The location is specified by the url
param.
If the file name is not specified then an attempt will be made to compute if from the url
param.description
- a description of the file that is to be attachedrelationship
- the relationship between the file that is to attached and the PDF documentjava.lang.IllegalArgumentException
- if handler
or url
are nullorg.xml.sax.SAXException