com.aspose.pdf.devices

Class PngDevice



  • public final class PngDevice
    extends ImageDevice

    Represents image device that helps to save pdf document pages into png.

    • Constructor Detail

      • PngDevice

        public PngDevice()

        Initializes a new instance of the PngDevice class with default resolution.

      • PngDevice

        public PngDevice(Resolution resolution)

        Initializes a new instance of the PngDevice class.

        Parameters:
        resolution - Resolution for the result image file, see Resolution class.
      • PngDevice

        public PngDevice(int width,
                         int height,
                         Resolution resolution)

        Initializes a new instance of the PngDevice class with provided image dimensions and resolution.

        Parameters:
        width - Image output width.
        height - Image output height.
        resolution - Resolution for the result image file, see Resolution class.
      • PngDevice

        public PngDevice(PageSize pageSize,
                         Resolution resolution)

        Initializes a new instance of the PngDevice class with provided page size and resolution.

        Parameters:
        pageSize - Page size of the output image.
        resolution - Resolution for the result image file, see Resolution class.
      • PngDevice

        public PngDevice(int width,
                         int height)

        Initializes a new instance of the PngDevice class with provided image dimensions, default resolution (=150).

        Parameters:
        width - Image output width.
        height - Image output height.
      • PngDevice

        public PngDevice(PageSize pageSize)

        Initializes a new instance of the PngDevice class with provided page size, default resolution (=150).

        Parameters:
        pageSize - Page size of the output image.
    • Method Detail

      • processInternal

        public void processInternal(Page page,
                                    com.aspose.ms.System.IO.Stream output)

        Converts the page into png and saves it in the output stream.

        Specified by:
        processInternal in class PageDevice
        Parameters:
        page - The page to convert.
        output - Output stream with png image.
      • process

        public void process(Page page,
                            OutputStream output)

        Converts the page into png and saves it in the output stream.

        Overrides:
        process in class PageDevice
        Parameters:
        page - The page to convert.
        output - Output stream with png image.
      • processToBufferedImage

        public BufferedImage processToBufferedImage(Page page)

        Converts the page into BufferedImage.

        Parameters:
        page - The page to convert.
        Returns:
        BufferedImage Output BufferedImage image.
      • processToBufferedImageBinarized

        public BufferedImage processToBufferedImageBinarized(Page page,
                                                             double threshold)

        Converts the page into BufferedImage with Bradley binarization.

        Parameters:
        page - The page to convert.
        threshold - The threshold value between 0.0 and 1.0.
        Returns:
        BufferedImage Output BufferedImage image.