Package com.itextpdf.pdfrender
Class PdfToImageRenderer
java.lang.Object
com.itextpdf.pdfrender.PdfToImageRenderer
The main class for rendering PDF files as images.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
The event listener which is called when a page has been rendered to aBufferedImage
.static interface
The event listener which is called when a page has been rendered to an image. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
renderPdf
(File pdfFile, com.itextpdf.kernel.utils.PageRange range, PdfToImageRenderer.BufferedImageReadyListener bufferedImageReadyListener) Renders a PDF stored in a file with the providedPdfToImageRenderer.BufferedImageReadyListener
toBufferedImage
.static void
renderPdf
(File pdfFile, PdfToImageRenderer.BufferedImageReadyListener bufferedImageReadyListener) Renders a PDF stored in a file with the providedPdfToImageRenderer.BufferedImageReadyListener
toBufferedImage
.static void
renderPdf
(File pdfFile, RenderingProperties properties, com.itextpdf.kernel.utils.PageRange range, PdfToImageRenderer.BufferedImageReadyListener bufferedImageReadyListener) Renders a PDF stored in a file with the providedPdfToImageRenderer.BufferedImageReadyListener
toBufferedImage
.static void
renderPdf
(File pdfFile, RenderingProperties properties, PdfToImageRenderer.BufferedImageReadyListener bufferedImageReadyListener) Renders a PDF stored in a file with the providedPdfToImageRenderer.BufferedImageReadyListener
toBufferedImage
.static void
Renders a PDF stored in a file with the provided path to images.static void
renderPdf
(File pdfFile, File outImagesDirectory, RenderingProperties properties) Renders a PDF stored in a file with the provided path to images.static void
Renders a PDF stored in a file with the provided path to images.static void
Renders a PDF stored in a file with the provided path to images.static void
renderPdf
(File pdfFile, String outImageFilePattern, RenderingProperties properties) Renders a PDF stored in a file with the provided path to images.static void
renderPdf
(File pdfFile, String outImageFilePattern, RenderingProperties properties, com.itextpdf.kernel.utils.PageRange range) Renders a PDF stored in a file with the provided path to images.static void
renderPdf
(File pdfFile, String outImageFilePattern, RenderingProperties properties, com.itextpdf.kernel.utils.PageRange range, PdfToImageRenderer.ImageFileReadyListener imageReadyListener) Renders a PDF stored in a file with the provided path to images.static void
renderPdf
(InputStream pdfStream, com.itextpdf.kernel.utils.PageRange range, PdfToImageRenderer.BufferedImageReadyListener bufferedImageReadyListener) Renders a PDF stored in the provided bytes with the providedPdfToImageRenderer.BufferedImageReadyListener
toBufferedImage
.static void
renderPdf
(InputStream pdfStream, PdfToImageRenderer.BufferedImageReadyListener bufferedImageReadyListener) Renders a PDF stored in the provided bytes with the providedPdfToImageRenderer.BufferedImageReadyListener
toBufferedImage
.static void
renderPdf
(InputStream pdfStream, RenderingProperties properties, com.itextpdf.kernel.utils.PageRange range, PdfToImageRenderer.BufferedImageReadyListener bufferedImageReadyListener) Renders a PDF stored in the provided bytes with the providedPdfToImageRenderer.BufferedImageReadyListener
toBufferedImage
.static void
renderPdf
(InputStream pdfStream, RenderingProperties properties, PdfToImageRenderer.BufferedImageReadyListener bufferedImageReadyListener) Renders a PDF stored in the provided bytes with the providedPdfToImageRenderer.BufferedImageReadyListener
toBufferedImage
.static void
renderPdf
(InputStream pdfStream, File outImagesDirectory) Renders a PDF stored in a file with the provided path to images.static void
renderPdf
(InputStream pdfStream, File outImagesDirectory, RenderingProperties properties) Renders a PDF stored in a file with the provided path to images.static void
renderPdf
(InputStream pdfStream, String outImageFilePattern) Renders a PDF stored in the provided bytes to images.static void
renderPdf
(InputStream pdfStream, String outImageFilePattern, com.itextpdf.kernel.utils.PageRange range) Renders a PDF stored in the provided bytes to images.static void
renderPdf
(InputStream pdfStream, String outImageFilePattern, RenderingProperties properties) Renders a PDF stored in the provided bytes to images.static void
renderPdf
(InputStream pdfStream, String outImageFilePattern, RenderingProperties properties, com.itextpdf.kernel.utils.PageRange range) Renders a PDF stored in the provided bytes to images.static void
renderPdf
(InputStream pdfStream, String outImageFilePattern, RenderingProperties properties, com.itextpdf.kernel.utils.PageRange range, PdfToImageRenderer.ImageFileReadyListener imageReadyListener) Renders a PDF stored in the provided bytes to images.
-
Method Details
-
renderPdf
public static void renderPdf(File pdfFile, File outImagesDirectory) throws RenderingException, IOException Renders a PDF stored in a file with the provided path to images.- Parameters:
-
pdfFile
- the PDF file to be rendered -
outImagesDirectory
- the directory, in which pdfRender will place the rendered images. Their names will respect the following format: "image%d" and %d will be replaced with the number of the page.PdfRenderImageType.JPEG
, which will be the extension of the images, will be added automatically - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input or output file could not be accessed
-
renderPdf
public static void renderPdf(File pdfFile, File outImagesDirectory, RenderingProperties properties) throws RenderingException, IOException Renders a PDF stored in a file with the provided path to images.- Parameters:
-
pdfFile
- the PDF file to be rendered -
outImagesDirectory
- the directory, in which pdfRender will place the rendered images. Their names will respect the following format: "image%d" and %d will be replaced with the number of the page. The image extension is added automatically based on thePdfRenderImageType
provided withRenderingProperties
. By default it isPdfRenderImageType.JPEG
-
properties
- the properties which will define rendering process - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input or output file could not be accessed
-
renderPdf
public static void renderPdf(InputStream pdfStream, File outImagesDirectory) throws RenderingException, IOException Renders a PDF stored in a file with the provided path to images.- Parameters:
-
pdfStream
- the stream of the PDF to be rendered -
outImagesDirectory
- the directory, in which pdfRender will place the rendered images. Their names will respect the following format: "image%d" and %d will be replaced with the number of the page.PdfRenderImageType.JPEG
, which will be the extension of the images, will be added to the names automatically - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input or output file could not be accessed
-
renderPdf
public static void renderPdf(InputStream pdfStream, File outImagesDirectory, RenderingProperties properties) throws RenderingException, IOException Renders a PDF stored in a file with the provided path to images.- Parameters:
-
pdfStream
- the stream of the PDF to be rendered -
outImagesDirectory
- the directory, in which pdfRender will place the rendered images. Their names will respect the following format: "image%d" and %d will be replaced with the number of the page. The image extension is added automatically based on thePdfRenderImageType
provided withRenderingProperties
. By default it isPdfRenderImageType.JPEG
-
properties
- the properties which will define rendering process - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input or output file could not be accessed
-
renderPdf
public static void renderPdf(File pdfFile, String outImageFilePattern) throws RenderingException, IOException Renders a PDF stored in a file with the provided path to images.- Parameters:
-
pdfFile
- the PDF file to be rendered -
outImageFilePattern
- the string which defines the path and the format of the resultant images. The format specifier is of a form similar to the C printf format. In the most simple case just place a template '%d' in the filename which pdfRender will replace with the page number.PdfRenderImageType.JPEG
, which will be the extension of the images, will be added to the filename automatically - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input or output file could not be accessed
-
renderPdf
public static void renderPdf(File pdfFile, String outImageFilePattern, com.itextpdf.kernel.utils.PageRange range) throws RenderingException, IOException Renders a PDF stored in a file with the provided path to images.Only pages, specified in the provided range, will be rendered.
- Parameters:
-
pdfFile
- the PDF file to be rendered -
outImageFilePattern
- the string which defines the path and the format of the resultant images. The format specifier is of a form similar to the C printf format. In the most simple case just place a template '%d' in the filename which pdfRender will replace with the page number.PdfRenderImageType.JPEG
, which will be the extension of the images, will be added to the filename automatically -
range
- the range of pages which will be rendered - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input or output file could not be accessed
-
renderPdf
public static void renderPdf(InputStream pdfStream, String outImageFilePattern) throws RenderingException, IOException Renders a PDF stored in the provided bytes to images.- Parameters:
-
pdfStream
- the stream of the PDF to be rendered -
outImageFilePattern
- the string which defines the path and the format of the resultant images. The format specifier is of a form similar to the C printf format. In the most simple case just place a template '%d' in the filename which pdfRender will replace with the page number.PdfRenderImageType.JPEG
, which will be the extension of the images, will be added to the filename automatically - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input or output file could not be accessed
-
renderPdf
public static void renderPdf(InputStream pdfStream, String outImageFilePattern, com.itextpdf.kernel.utils.PageRange range) throws RenderingException, IOException Renders a PDF stored in the provided bytes to images.Only pages specified in the provided range will be rendered.
- Parameters:
-
pdfStream
- the stream of the PDF to be rendered -
outImageFilePattern
- the string which defines the path and the format of the resultant images. The format specifier is of a form similar to the C printf format. In the most simple case just place a template '%d' in the filename which pdfRender will replace with the page number.PdfRenderImageType.JPEG
, which will be the extension of the images, will be added to the filename automatically -
range
- the range of pages which will be rendered - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input or output file could not be accessed
-
renderPdf
public static void renderPdf(InputStream pdfStream, String outImageFilePattern, RenderingProperties properties) throws RenderingException, IOException Renders a PDF stored in the provided bytes to images.- Parameters:
-
pdfStream
- the stream of the PDF to be rendered -
outImageFilePattern
- the string which defines the path and the format of the resultant images. The format specifier is of a form similar to the C printf format. In the most simple case just place a template '%d' in the filename which pdfRender will replace with the page number. The image extension is added automatically based on thePdfRenderImageType
provided withRenderingProperties
. By default it isPdfRenderImageType.JPEG
-
properties
- the properties which will define rendering process - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input or output file could not be accessed
-
renderPdf
public static void renderPdf(InputStream pdfStream, String outImageFilePattern, RenderingProperties properties, com.itextpdf.kernel.utils.PageRange range) throws RenderingException, IOException Renders a PDF stored in the provided bytes to images.Only pages specified in the provided range will be rendered.
- Parameters:
-
pdfStream
- the stream of the PDF to be rendered -
outImageFilePattern
- the string which defines the path and the format of the resultant images. The format specifier is of a form similar to the C printf format. In the most simple case just place a template '%d' in the filename which pdfRender will replace with the page number. The image extension is added automatically based on thePdfRenderImageType
provided withRenderingProperties
. By default it isPdfRenderImageType.JPEG
-
properties
- the properties which will define rendering process -
range
- the range of pages which will be rendered - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input or output file could not be accessed
-
renderPdf
public static void renderPdf(InputStream pdfStream, String outImageFilePattern, RenderingProperties properties, com.itextpdf.kernel.utils.PageRange range, PdfToImageRenderer.ImageFileReadyListener imageReadyListener) throws RenderingException, IOException Renders a PDF stored in the provided bytes to images.Only pages specified in the provided range will be rendered.
- Parameters:
-
pdfStream
- the stream of the PDF to be rendered -
outImageFilePattern
- the string which defines the path and the format of the resultant images. The format specifier is of a form similar to the C printf format. In the most simple case just place a template '%d' in the filename which pdfRender will replace with the page number. The image extension is added automatically based on thePdfRenderImageType
provided withRenderingProperties
. By default it isPdfRenderImageType.JPEG
-
properties
- the properties which will define rendering process -
range
- the range of pages which will be rendered -
imageReadyListener
- the event listener which is called when the image is ready. - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input or output file could not be accessed
-
renderPdf
public static void renderPdf(File pdfFile, String outImageFilePattern, RenderingProperties properties) throws RenderingException, IOException Renders a PDF stored in a file with the provided path to images.- Parameters:
-
pdfFile
- the PDF file to be rendered -
outImageFilePattern
- the string which defines the path and the format of the resultant images. The format specifier is of a form similar to the C printf format. In the most simple case just place a template '%d' in the filename which pdfRender will replace with the page number. The image extension is added automatically based on thePdfRenderImageType
provided withRenderingProperties
. By default it isPdfRenderImageType.JPEG
-
properties
- the properties which will define rendering process - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input or output file could not be accessed
-
renderPdf
public static void renderPdf(File pdfFile, String outImageFilePattern, RenderingProperties properties, com.itextpdf.kernel.utils.PageRange range) throws RenderingException, IOException Renders a PDF stored in a file with the provided path to images.Only pages specified in the provided range will be rendered.
- Parameters:
-
pdfFile
- the PDF file to be rendered -
outImageFilePattern
- the string which defines the path and the format of the resultant images. The format specifier is of a form similar to the C printf format. In the most simple case just place a template '%d' in the filename which pdfRender will replace with the page number. The image extension is added automatically based on thePdfRenderImageType
provided withRenderingProperties
. By default it isPdfRenderImageType.JPEG
-
properties
- the properties which will define rendering process -
range
- the range of pages which will be rendered - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input or output file could not be accessed
-
renderPdf
public static void renderPdf(File pdfFile, String outImageFilePattern, RenderingProperties properties, com.itextpdf.kernel.utils.PageRange range, PdfToImageRenderer.ImageFileReadyListener imageReadyListener) throws RenderingException, IOException Renders a PDF stored in a file with the provided path to images.Only pages specified in the provided range will be rendered.
- Parameters:
-
pdfFile
- the PDF file to be rendered -
outImageFilePattern
- the string which defines the path and the format of the resultant images. The format specifier is of a form similar to the C printf format. In the most simple case just place a template '%d' in the filename which pdfRender will replace with the page number. The image extension is added automatically based on thePdfRenderImageType
provided withRenderingProperties
. By default it isPdfRenderImageType.JPEG
-
properties
- the properties which will define rendering process -
range
- the range of pages which will be rendered -
imageReadyListener
- the event listener which is called when the image is ready. - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input or output file could not be accessed
-
renderPdf
public static void renderPdf(File pdfFile, PdfToImageRenderer.BufferedImageReadyListener bufferedImageReadyListener) throws RenderingException, IOException Renders a PDF stored in a file with the providedPdfToImageRenderer.BufferedImageReadyListener
toBufferedImage
.- Parameters:
-
pdfFile
- the PDF file to be rendered -
bufferedImageReadyListener
- the event listener which is called when the image is rendered toBufferedImage
. - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input file could not be accessed
-
renderPdf
public static void renderPdf(File pdfFile, com.itextpdf.kernel.utils.PageRange range, PdfToImageRenderer.BufferedImageReadyListener bufferedImageReadyListener) throws RenderingException, IOException Renders a PDF stored in a file with the providedPdfToImageRenderer.BufferedImageReadyListener
toBufferedImage
.Only pages specified in the provided range will be rendered.
- Parameters:
-
pdfFile
- the PDF file to be rendered -
range
- the range of pages which will be rendered -
bufferedImageReadyListener
- the event listener which is called when the image is rendered toBufferedImage
. - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input file could not be accessed
-
renderPdf
public static void renderPdf(File pdfFile, RenderingProperties properties, PdfToImageRenderer.BufferedImageReadyListener bufferedImageReadyListener) throws RenderingException, IOException Renders a PDF stored in a file with the providedPdfToImageRenderer.BufferedImageReadyListener
toBufferedImage
.- Parameters:
-
pdfFile
- the PDF file to be rendered -
properties
- the properties which will define rendering process. Note thatimageType
property will not be taken into account. -
bufferedImageReadyListener
- the event listener which is called when the image is rendered toBufferedImage
. - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input file could not be accessed
-
renderPdf
public static void renderPdf(File pdfFile, RenderingProperties properties, com.itextpdf.kernel.utils.PageRange range, PdfToImageRenderer.BufferedImageReadyListener bufferedImageReadyListener) throws RenderingException, IOException Renders a PDF stored in a file with the providedPdfToImageRenderer.BufferedImageReadyListener
toBufferedImage
.Only pages specified in the provided range will be rendered.
- Parameters:
-
pdfFile
- the PDF file to be rendered -
properties
- the properties which will define rendering process. Note thatimageType
property will not be taken into account. -
range
- the range of pages which will be rendered -
bufferedImageReadyListener
- the event listener which is called when the image is rendered toBufferedImage
. - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input file could not be accessed
-
renderPdf
public static void renderPdf(InputStream pdfStream, PdfToImageRenderer.BufferedImageReadyListener bufferedImageReadyListener) throws RenderingException, IOException Renders a PDF stored in the provided bytes with the providedPdfToImageRenderer.BufferedImageReadyListener
toBufferedImage
.- Parameters:
-
pdfStream
- the stream of the PDF to be rendered -
bufferedImageReadyListener
- the event listener which is called when the image is rendered toBufferedImage
. - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input file could not be accessed
-
renderPdf
public static void renderPdf(InputStream pdfStream, RenderingProperties properties, PdfToImageRenderer.BufferedImageReadyListener bufferedImageReadyListener) throws RenderingException, IOException Renders a PDF stored in the provided bytes with the providedPdfToImageRenderer.BufferedImageReadyListener
toBufferedImage
.- Parameters:
-
pdfStream
- the stream of the PDF to be rendered -
properties
- the properties which will define rendering process. Note thatimageType
property will not be taken into account. -
bufferedImageReadyListener
- the event listener which is called when the image is rendered toBufferedImage
. - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input file could not be accessed
-
renderPdf
public static void renderPdf(InputStream pdfStream, com.itextpdf.kernel.utils.PageRange range, PdfToImageRenderer.BufferedImageReadyListener bufferedImageReadyListener) throws RenderingException, IOException Renders a PDF stored in the provided bytes with the providedPdfToImageRenderer.BufferedImageReadyListener
toBufferedImage
.Only pages specified in the provided range will be rendered.
- Parameters:
-
pdfStream
- the stream of the PDF to be rendered -
range
- the range of pages which will be rendered -
bufferedImageReadyListener
- the event listener which is called when the image is rendered toBufferedImage
. - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input file could not be accessed
-
renderPdf
public static void renderPdf(InputStream pdfStream, RenderingProperties properties, com.itextpdf.kernel.utils.PageRange range, PdfToImageRenderer.BufferedImageReadyListener bufferedImageReadyListener) throws RenderingException, IOException Renders a PDF stored in the provided bytes with the providedPdfToImageRenderer.BufferedImageReadyListener
toBufferedImage
.Only pages specified in the provided range will be rendered.
- Parameters:
-
pdfStream
- the stream of the PDF to be rendered -
properties
- the properties which will define rendering process. Note thatimageType
property will not be taken into account. -
range
- the range of pages which will be rendered -
bufferedImageReadyListener
- the event listener which is called when the image is rendered toBufferedImage
. - Throws:
-
RenderingException
- an error occurred while rendering the PDF. It could be caused by different reasons: for example, when the PDF contains unsupported features (XFA) or some arguments are invalid (for example, too big page scaling is passed). -
IOException
- input file could not be accessed
-