public class PDFRenderer extends Object
URL, renderToPDF(String, String) and one
for rendering a File, renderToPDF(File, String)
You can use this utility from the command line by passing in the URL or file location as first parameter, and PDF path as second parameter:
java -cp %classpath% org.xhtmlrenderer.simple.PDFRenderer
| Constructor and Description |
|---|
PDFRenderer() |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] args)
Renders a file or URL to a PDF.
|
static void |
renderToPDF(byte[] bytes,
String pdf)
Renders the XML file as a PDF file at the target location.
|
static void |
renderToPDF(byte[] bytes,
String pdf,
Character pdfVersion)
Renders the XML file as a PDF file at the target location.
|
static void |
renderToPDF(File file,
String pdf)
Renders the XML file as a PDF file at the target location.
|
static void |
renderToPDF(File file,
String pdf,
Character pdfVersion)
Renders the XML file as a PDF file at the target location.
|
static void |
renderToPDF(String url,
String pdf)
Renders the XML file at the given URL as a PDF file
at the target location.
|
static void |
renderToPDF(String url,
String pdf,
Character pdfVersion)
Renders the XML file at the given URL as a PDF file
at the target location.
|
static byte[] |
renderToPDFBytes(byte[] bytes)
Renders the XML file as a PDF file and return its bytes.
|
static byte[] |
renderToPDFBytes(byte[] bytes,
Character pdfVersion)
Renders the XML file as a PDF file return its bytes.
|
public static void renderToPDF(String url, String pdf) throws IOException, com.itextpdf.text.DocumentException
url - url for the XML file to renderpdf - path to the PDF file to createIOException - if the URL or PDF location is
invalidcom.itextpdf.text.DocumentException - if an error occurred
while building the Document.public static void renderToPDF(String url, String pdf, Character pdfVersion) throws IOException, com.itextpdf.text.DocumentException
url - url for the XML file to renderpdf - path to the PDF file to createpdfVersion - version of PDF to output; null uses default versionIOException - if the URL or PDF location is
invalidcom.itextpdf.text.DocumentException - if an error occurred
while building the Document.public static void renderToPDF(File file, String pdf) throws IOException, com.itextpdf.text.DocumentException
file - XML file to renderpdf - path to the PDF file to createIOException - if the file or PDF location is
invalidcom.itextpdf.text.DocumentException - if an error occurred
while building the Document.public static void renderToPDF(File file, String pdf, Character pdfVersion) throws IOException, com.itextpdf.text.DocumentException
file - XML file to renderpdf - path to the PDF file to createpdfVersion - version of PDF to output; null uses default versionIOException - if the file or PDF location is
invalidcom.itextpdf.text.DocumentException - if an error occurred
while building the Document.public static byte[] renderToPDFBytes(byte[] bytes)
throws IOException,
com.itextpdf.text.DocumentException
bytes - XML file bytes to renderIOException - if the file or PDF location is
invalidcom.itextpdf.text.DocumentException - if an error occurred
while building the Document.public static byte[] renderToPDFBytes(byte[] bytes,
Character pdfVersion)
throws IOException,
com.itextpdf.text.DocumentException
bytes - XML file bytes to renderpdfVersion - version of PDF to output; null uses default versionIOException - if the file or PDF location is
invalidcom.itextpdf.text.DocumentException - if an error occurred
while building the Document.public static void renderToPDF(byte[] bytes,
String pdf)
throws IOException,
com.itextpdf.text.DocumentException
bytes - XML file bytes to renderpdf - path to the PDF file to createIOException - if the file or PDF location is
invalidcom.itextpdf.text.DocumentException - if an error occurred
while building the Document.public static void renderToPDF(byte[] bytes,
String pdf,
Character pdfVersion)
throws IOException,
com.itextpdf.text.DocumentException
bytes - XML file bytes to renderpdf - path to the PDF file to createpdfVersion - version of PDF to output; null uses default versionIOException - if the file or PDF location is
invalidcom.itextpdf.text.DocumentException - if an error occurred
while building the Document.public static void main(String[] args) throws IOException, com.itextpdf.text.DocumentException
args - see descIOException - if source could not be read, or if
PDF path is invalidcom.itextpdf.text.DocumentException - if an error occurs while building
the documentCopyright © 2021. All rights reserved.