Class Image_Api
java.lang.Object
com.ironsoftware.ironpdf.internal.staticapi.Image_Api
The type Image api.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddrawImage(InternalPdfDocument internalPdfDocument, byte[] imageBytes, Iterable<Integer> pageIndexes, double x, double y, double desiredWidth, double desiredHeight) Draw an image multiple times according to the specified parameters; all occurrences of the image will share a single data streamstatic List<byte[]>extractAllImages(InternalPdfDocument internalPdfDocument) Finds all embedded Images from within the PDF and returns as list of image bytesstatic List<byte[]>extractAllImages(InternalPdfDocument internalPdfDocument, Iterable<Integer> pageIndexes) Finds all embedded Images from within the PDF and returns then as image byte[] objectsstatic InternalPdfDocumentimageToPdf(List<byte[]> imagesBytes, ImageBehavior imageBehavior, ChromePdfRenderOptions renderOptions) Converts multiple image files to a PDF document.static List<byte[]>pdfToImage(InternalPdfDocument internalPdfDocument) Renders the PDF and exports image Files in convenient formats.static List<byte[]>pdfToImage(InternalPdfDocument internalPdfDocument, Iterable<Integer> pageIndexes) Renders the PDF and exports image Files in convenient formats.static List<byte[]>pdfToImage(InternalPdfDocument internalPdfDocument, Iterable<Integer> pageIndexes, int dpi) Renders the PDF and exports image Files in convenient formats.static List<byte[]>pdfToImage(InternalPdfDocument internalPdfDocument, Iterable<Integer> pageIndexes, int dpi, Integer imageMaxWidth) Renders the PDF and exports image Files in convenient formats.static List<byte[]>pdfToImage(InternalPdfDocument internalPdfDocument, Iterable<Integer> pageIndexes, int dpi, Integer imageMaxWidth, Integer imageMaxHeight) Renders the PDF and exports image Files in convenient formats.static byte[]toMultiPageTiff(InternalPdfDocument internalPdfDocument, Iterable<Integer> pageIndexes, int dpi, Integer imageMaxWidth, Integer imageMaxHeight)
-
Constructor Details
-
Image_Api
public Image_Api()
-
-
Method Details
-
imageToPdf
public static InternalPdfDocument imageToPdf(List<byte[]> imagesBytes, ImageBehavior imageBehavior, ChromePdfRenderOptions renderOptions) Converts multiple image files to a PDF document. Each image creates 1 page which matches the image dimensions. The default PaperSize is A4. You can set it viaChromePdfRenderOptions.setPaperSize(PaperSize)Note: Imaging.ImageBehavior.CropPage will set PaperSize equal to ImageSize.- Parameters:
imagesBytes- The image file as bytes.imageBehavior- Describes how image should be placed on the PDF pagerenderOptions- Rendering options- Returns:
- the internal pdf document
-
drawImage
public static void drawImage(InternalPdfDocument internalPdfDocument, byte[] imageBytes, Iterable<Integer> pageIndexes, double x, double y, double desiredWidth, double desiredHeight) Draw an image multiple times according to the specified parameters; all occurrences of the image will share a single data stream- Parameters:
internalPdfDocument- the internal pdf documentimageBytes- images to drawpageIndexes- Target page indexesx- X coordinatey- Y coordinatedesiredWidth- Desired widthsdesiredHeight- Desired heights
-
extractAllImages
public static List<byte[]> extractAllImages(InternalPdfDocument internalPdfDocument) throws IOException Finds all embedded Images from within the PDF and returns as list of image bytes- Parameters:
internalPdfDocument- the internal pdf document- Returns:
- the list
- Throws:
IOException- the io exception
-
extractAllImages
public static List<byte[]> extractAllImages(InternalPdfDocument internalPdfDocument, Iterable<Integer> pageIndexes) throws IOException Finds all embedded Images from within the PDF and returns then as image byte[] objects- Parameters:
internalPdfDocument- the internal pdf documentpageIndexes- Index of the page. Note: Page 1 has index 0. Defaults to all pages- Returns:
- the list
- Throws:
IOException- the io exception
-
pdfToImage
public static List<byte[]> pdfToImage(InternalPdfDocument internalPdfDocument, Iterable<Integer> pageIndexes, int dpi, Integer imageMaxWidth) throws IOException Renders the PDF and exports image Files in convenient formats. Page Numbers may be specified. 1 image file is created for each page.FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers
- Parameters:
internalPdfDocument- the internal pdf documentpageIndexes- A list of the specific zero based page number to render as images.dpi- The desired resolution of the output Images.imageMaxWidth- The target maximum width(in pixel) of the output images.- Returns:
- An array of the file paths of the image files created.
The DPI will be ignored under Linux and macOS.
- Throws:
IOException- the io exception
-
pdfToImage
public static List<byte[]> pdfToImage(InternalPdfDocument internalPdfDocument, Iterable<Integer> pageIndexes, int dpi, Integer imageMaxWidth, Integer imageMaxHeight) throws IOException Renders the PDF and exports image Files in convenient formats. Page Numbers may be specified. 1 image file is created for each page.FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers
- Parameters:
internalPdfDocument- the internal pdf documentpageIndexes- A list of the specific zero based page number to render as images.dpi- The desired resolution of the output Images.imageMaxWidth- The target maximum width(in pixel) of the output images.imageMaxHeight- The target maximum height(in pixel) of the output images.- Returns:
- An array of the file paths of the image files created.
- Throws:
IOException- the io exception
-
pdfToImage
public static List<byte[]> pdfToImage(InternalPdfDocument internalPdfDocument, Iterable<Integer> pageIndexes, int dpi) throws IOException Renders the PDF and exports image Files in convenient formats. Page Numbers may be specified. 1 image file is created for each page.FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers
- Parameters:
internalPdfDocument- the internal pdf documentpageIndexes- A list of the specific zero based page number to render as images.dpi- The desired resolution of the output Images.- Returns:
- An array of the file paths of the image files created.
- Throws:
IOException- the io exception
-
pdfToImage
public static List<byte[]> pdfToImage(InternalPdfDocument internalPdfDocument, Iterable<Integer> pageIndexes) throws IOException Renders the PDF and exports image Files in convenient formats. Page Numbers may be specified. 1 image file is created for each page.FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers
- Parameters:
internalPdfDocument- the internal pdf documentpageIndexes- A list of the specific zero based page number to render as images.- Returns:
- An array of the file paths of the image files created.
- Throws:
IOException- the io exception
-
pdfToImage
Renders the PDF and exports image Files in convenient formats. Page Numbers may be specified. 1 image file is created for each page.FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers
- Parameters:
internalPdfDocument- the internal pdf document- Returns:
- An array of the file paths of the image files created.
- Throws:
IOException- the io exception
-
toMultiPageTiff
public static byte[] toMultiPageTiff(InternalPdfDocument internalPdfDocument, Iterable<Integer> pageIndexes, int dpi, Integer imageMaxWidth, Integer imageMaxHeight) throws IOException - Throws:
IOException
-