This class implements the Transcoder interface and
can convert a WMF input document into an SVG document.
This class is copied from
batik org.apache.batik.transcoder.wmf.tosvg.WMFTranscoder class.
It can use TranscoderInput that are either a URI
or a InputStream or a Reader. The
XMLReader and Document TranscoderInput
types are not supported.
This transcoder can use TranscoderOutputs that are
of any type except the XMLFilter type.
Corrected bugs from the original class:
Exemple of use :
WMFTranscoder transcoder = new WMFTranscoder();
try {
TranscoderInput wmf = new TranscoderInput(wmffile.toURL().toString());
TranscoderOutput svg = new TranscoderOutput(new FileOutputStream(svgFile));
transcoder.transcode(wmf, svg);
} catch (MalformedURLException e){
throw new TranscoderException(e);
} catch (IOException e){
throw new TranscoderException(e);
}
Several transcoding hints are available for this transcoder :
- KEY_INPUT_WIDTH, KEY_INPUT_HEIGHT, KEY_XOFFSET, KEY_YOFFSET : this Integer values allows to
set the portion of the image to transcode, defined by the width, height, and offset
of this portion in Metafile units.
transcoder.addTranscodingHint(FromWMFTranscoder.KEY_INPUT_WIDTH, new Integer(input_width));
KEY_WIDTH, KEY_HEIGHT : this Float values allows to force the width and height of the output:
transcoder.addTranscodingHint(FromWMFTranscoder.KEY_WIDTH, new Float(width));
version: $Id: WMFTranscoder.java 501495 2007-01-30 18:00:36Z dvholten $ |