Class PdfEncodedImage

java.lang.Object
com.independentsoft.office.pdf.PdfEncodedImage

public class PdfEncodedImage extends Object
An image prepared for inclusion in a PDF file. Produced by PdfImageEncoder.
  • Method Details

    • getPixelWidth

      public int getPixelWidth()
      Gets the image width in pixels.
      Returns:
      the width in pixels
    • getPixelHeight

      public int getPixelHeight()
      Gets the image height in pixels.
      Returns:
      the height in pixels
    • hasSoftMask

      public boolean hasSoftMask()
      Gets whether this image has an alpha channel and needs a soft mask object.
      Returns:
      true if a soft mask object must be written
    • buildImageObject

      public byte[] buildImageObject(int objectId, int smaskObjectId) throws IOException
      Builds the complete image XObject.
      Parameters:
      objectId - the PDF object id of the image
      smaskObjectId - the PDF object id of the soft mask, ignored when hasSoftMask() is false
      Returns:
      the complete "N 0 obj ... endobj" bytes
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • buildSoftMaskObject

      public byte[] buildSoftMaskObject(int objectId) throws IOException
      Builds the soft mask XObject holding the alpha channel.
      Parameters:
      objectId - the PDF object id of the soft mask
      Returns:
      the complete "N 0 obj ... endobj" bytes
      Throws:
      IOException - Signals that an I/O exception has occurred.