Class ImageConverter


  • public final class ImageConverter
    extends java.lang.Object
    This class extracts and converts images from an office document. The images are returned as BinaryGraphicsDocument. The image converter can be configured as destructive. In this case, the returned graphics documents will contain the only reference to the image (the original data will be removed).
    • Constructor Summary

      Constructors 
      Constructor Description
      ImageConverter​(OfficeReader ofr, boolean bDestructive, boolean bExtractEPS)
      Construct a new ImageConverter referring to a specific document
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAcceptedFormat​(java.lang.String sMime)
      Define an accepted graphics format
      BinaryGraphicsDocument getImage​(org.w3c.dom.Element node)
      Get an image from a draw:image element.
      void setAcceptOtherFormats​(boolean b)
      Specify that the ImageConverter should return an image even if it was not possible to convert it to an acceptable format.
      void setBaseFileName​(java.lang.String sBaseFileName)
      Define the base file name to use for generating file names
      void setDefaultFormat​(java.lang.String sMime)
      Define the default format for raster graphics
      void setDefaultVectorFormat​(java.lang.String sMime)
      Define the default format for vector graphics
      void setGraphicConverter​(GraphicConverter gcv)
      Define the GraphicConverter to use for image conversion
      void setUseSubdir​(java.lang.String sSubDirName)
      Define the name of a sub directory to prepend to file names
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ImageConverter

        public ImageConverter​(OfficeReader ofr,
                              boolean bDestructive,
                              boolean bExtractEPS)
        Construct a new ImageConverter referring to a specific document
        Parameters:
        ofr - the office reader to use
        bExtractEPS - set true if EPS content should be extracted from SVM files
    • Method Detail

      • setBaseFileName

        public void setBaseFileName​(java.lang.String sBaseFileName)
        Define the base file name to use for generating file names
        Parameters:
        sBaseFileName - the base file name
      • setUseSubdir

        public void setUseSubdir​(java.lang.String sSubDirName)
        Define the name of a sub directory to prepend to file names
        Parameters:
        sSubDirName - the sub directory
      • setAcceptOtherFormats

        public void setAcceptOtherFormats​(boolean b)
        Specify that the ImageConverter should return an image even if it was not possible to convert it to an acceptable format.
        Parameters:
        b - true if other formats should be accepted
      • setDefaultFormat

        public void setDefaultFormat​(java.lang.String sMime)
        Define the default format for raster graphics
        Parameters:
        sMime - the MIME type of the default raster format
      • setDefaultVectorFormat

        public void setDefaultVectorFormat​(java.lang.String sMime)
        Define the default format for vector graphics
        Parameters:
        sMime - the MIME type for the default vector format
      • addAcceptedFormat

        public void addAcceptedFormat​(java.lang.String sMime)
        Define an accepted graphics format
        Parameters:
        sMime - the MIME type of the format
      • setGraphicConverter

        public void setGraphicConverter​(GraphicConverter gcv)
        Define the GraphicConverter to use for image conversion
        Parameters:
        gcv - the graphics converter
      • getImage

        public BinaryGraphicsDocument getImage​(org.w3c.dom.Element node)
        Get an image from a draw:image element. If the converter is destructive, the returned BinaryGraphicsDocument will hold the only reference to the image data (the original data will be removed).
        Parameters:
        node - the image element
        Returns:
        a document containing the (converted) image, or null if it was not possible to read the image or convert it to an accepted format