Class WMFTranscoder

  • All Implemented Interfaces:
    XMLConstants, Transcoder, CSSConstants, SVGConstants

    public class WMFTranscoder
    extends ToSVGAbstractTranscoder
    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:

    • Manage images size

    Exemple of use :

        WMFTranscoder transcoder = new WMFTranscoder();
        try {
           TranscoderInput wmf = new TranscoderInput(wmffile.toURL().toString());
           FileOutputStream fos = new FileOutputStream(svgFile);
           TranscoderOutput svg =
               new TranscoderOutput(new OutputStreamWriter(fos, "UTF-8"));
           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, Integer.valueOf(input_width));
      
    KEY_WIDTH, KEY_HEIGHT : this Float values allows to force the width and height of the output:
         transcoder.addTranscodingHint(FromWMFTranscoder.KEY_WIDTH, Float.valueOf(width));
      
    Version:
    $Id: WMFTranscoder.java 1808001 2017-09-11 09:51:29Z ssteiner $