java.lang.Object
com.ironsoftware.ironpdf.internal.staticapi.Image_Api

public final class Image_Api extends Object
The type Image api.
  • Constructor Details

    • Image_Api

      public Image_Api()
  • Method Details

    • 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 via ChromePdfRenderOptions.setPaperSize(PaperSize) Note: Imaging.ImageBehavior.CropPage will set PaperSize equal to ImageSize.
      Parameters:
      imagesData - The Image_Api.ImageData
      imageBehavior - Describes how image should be placed on the PDF page
      renderOptions - 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 document
      imageBytes - images to draw
      pageIndexes - Target page indexes
      x - X coordinate
      y - Y coordinate
      desiredWidth - Desired widths
      desiredHeight - 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 document
      pageIndexes - 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 document
      pageIndexes - 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 document
      pageIndexes - 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 document
      pageIndexes - 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 document
      pageIndexes - 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, Iterable<Integer> pageIndexes, int dpi, Integer imageMaxWidth, Integer imageMaxHeight) throws IOException
      Throws:
      IOException