Package writer2latex.base
Class ImageConverter
java.lang.Object
writer2latex.base.ImageConverter
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
ConstructorsConstructorDescriptionImageConverter
(OfficeReader ofr, boolean bDestructive, boolean bExtractEPS) Construct a newImageConverter
referring to a specific document -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAcceptedFormat
(String sMime) Define an accepted graphics formatGet an image from adraw:image
element.void
setAcceptOtherFormats
(boolean b) Specify that theImageConverter
should return an image even if it was not possible to convert it to an acceptable format.void
setBaseFileName
(String sBaseFileName) Define the base file name to use for generating file namesvoid
setDefaultFormat
(String sMime) Define the default format for raster graphicsvoid
setDefaultVectorFormat
(String sMime) Define the default format for vector graphicsvoid
Define theGraphicConverter
to use for image conversionvoid
setUseSubdir
(String sSubDirName) Define the name of a sub directory to prepend to file names
-
Constructor Details
-
ImageConverter
Construct a newImageConverter
referring to a specific document- Parameters:
ofr
- the office reader to usebExtractEPS
- set true if EPS content should be extracted from SVM files
-
-
Method Details
-
setBaseFileName
Define the base file name to use for generating file names- Parameters:
sBaseFileName
- the base file name
-
setUseSubdir
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 theImageConverter
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
Define the default format for raster graphics- Parameters:
sMime
- the MIME type of the default raster format
-
setDefaultVectorFormat
Define the default format for vector graphics- Parameters:
sMime
- the MIME type for the default vector format
-
addAcceptedFormat
Define an accepted graphics format- Parameters:
sMime
- the MIME type of the format
-
setGraphicConverter
Define theGraphicConverter
to use for image conversion- Parameters:
gcv
- the graphics converter
-
getImage
Get an image from adraw:image
element. If the converter is destructive, the returnedBinaryGraphicsDocument
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
-