org.apache.batik.transcoder.wmf.tosvg

Class WMFTranscoder

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:

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 :

     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));
      
  • Field Summary
    static StringSVG_EXTENSION
    static StringWMF_EXTENSION
    Constructor Summary
    WMFTranscoder()
    Default constructor
    Method Summary
    static voidmain(String[] args)
    Unit testing : Illustrates how the transcoder might be used.
    voidtranscode(TranscoderInput input, TranscoderOutput output)
    Transcodes the specified input in the specified output.

    Field Detail

    SVG_EXTENSION

    public static final String SVG_EXTENSION

    WMF_EXTENSION

    public static final String WMF_EXTENSION

    Constructor Detail

    WMFTranscoder

    public WMFTranscoder()
    Default constructor

    Method Detail

    main

    public static void main(String[] args)
    Unit testing : Illustrates how the transcoder might be used.

    transcode

    public void transcode(TranscoderInput input, TranscoderOutput output)
    Transcodes the specified input in the specified output.

    Parameters: input the input to transcode output the ouput where to transcode

    Throws: TranscoderException if an error occured while transcoding

    Copyright B) 2007 Apache Software Foundation. All Rights Reserved.