Class Image_Api
- java.lang.Object
-
- com.ironsoftware.ironpdf.internal.staticapi.Image_Api
-
public final class Image_Api extends Object
The type Image api.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Image_Api.ImageData
-
Constructor Summary
Constructors Constructor Description Image_Api()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
drawImage(InternalPdfDocument internalPdfDocument, byte[] imageBytes, List<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, List<Integer> pageIndexes)
Finds all embedded Images from within the PDF and returns then as image byte[] objectsstatic InternalPdfDocument
imageToPdf(List<Image_Api.ImageData> imagesData, 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, List<Integer> pageIndexes)
Renders the PDF and exports image Files in convenient formats.static List<byte[]>
pdfToImage(InternalPdfDocument internalPdfDocument, List<Integer> pageIndexes, int dpi)
Renders the PDF and exports image Files in convenient formats.static List<byte[]>
pdfToImage(InternalPdfDocument internalPdfDocument, List<Integer> pageIndexes, int dpi, Integer imageMaxWidth)
Renders the PDF and exports image Files in convenient formats.static List<byte[]>
pdfToImage(InternalPdfDocument internalPdfDocument, List<Integer> pageIndexes, int dpi, Integer imageMaxWidth, Integer imageMaxHeight)
Renders the PDF and exports image Files in convenient formats.static byte[]
toMultiPageTiff(InternalPdfDocument internalPdfDocument, List<Integer> pageIndexes, int dpi, Integer imageMaxWidth, Integer imageMaxHeight)
-
-
-
Method Detail
-
imageToPdf
public static InternalPdfDocument imageToPdf(List<Image_Api.ImageData> imagesData, 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:
imagesData
- TheImage_Api.ImageData
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, List<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, List<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, List<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, List<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, List<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, List<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
public static List<byte[]> pdfToImage(InternalPdfDocument internalPdfDocument) 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 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, List<Integer> pageIndexes, int dpi, Integer imageMaxWidth, Integer imageMaxHeight) throws IOException
- Throws:
IOException
-
-