All Implemented Interfaces:
COSObjectable

public class PDJpeg extends PDXObjectImage
An image class for JPegs.
Author:
mathiak
  • Constructor Details

    • PDJpeg

      public PDJpeg(PDStream jpeg)
      Standard constructor.
      Parameters:
      jpeg - The COSStream from which to extract the JPeg
    • PDJpeg

      public PDJpeg(PDDocument doc, InputStream is) throws IOException
      Construct from a stream.
      Parameters:
      doc - The document to create the image as part of.
      is - The stream that contains the jpeg data.
      Throws:
      IOException - If there is an error reading the jpeg data.
    • PDJpeg

      public PDJpeg(PDDocument doc, BufferedImage bi) throws IOException
      Construct from a buffered image. The default compression level of 0.75 will be used.
      Parameters:
      doc - The document to create the image as part of.
      bi - The image to convert to a jpeg
      Throws:
      IOException - If there is an error processing the jpeg data.
    • PDJpeg

      public PDJpeg(PDDocument doc, BufferedImage bi, float compressionQuality) throws IOException
      Construct from a buffered image.
      Parameters:
      doc - The document to create the image as part of.
      bi - The image to convert to a jpeg
      compressionQuality - The desired JPEG compression quality; between 0 (best compression) and 1 (best image quality). See ImageWriteParam.setCompressionQuality(float) for more details.
      Throws:
      IOException - If there is an error processing the jpeg data.
  • Method Details

    • getRGBImage

      public BufferedImage getRGBImage() throws IOException
      Returns an image of the JPeg, or null if JPegs are not supported. (They should be. ) Returns an java.awt.Image, that can be used for display etc.
      Specified by:
      getRGBImage in class PDXObjectImage
      Returns:
      A Jpeg image.
      Throws:
      IOException
    • write2OutputStream

      public void write2OutputStream(OutputStream out) throws IOException
      This writes the JPeg to out. Writes the Image to out.
      Specified by:
      write2OutputStream in class PDXObjectImage
      Parameters:
      out - the OutputStream that the Image is written to.
      Throws:
      IOException - when somethings wrong with out
    • clear

      public void clear()
      Description copied from class: PDXObject
      Calling this will release all cached information.
      Overrides:
      clear in class PDXObject