Class Image_Api


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

      • Image_Api

        public Image_Api()
    • Method Detail

      • 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 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,
                                                    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 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,
                                              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 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,
                                              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 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,
                                              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 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,
                                              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 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