On Tuesday 04 December 2001 03:31, Russ Leong wrote:
> Hi all,
>
> As I read the ability to output to JPEG or PDF is because of the
> transcoders, I changed the transcoder from JPEG to PDF to find out if it is
> so.
>
> import java.io.*;
> import org.apache.batik.transcoder.image.JPEGTranscoder;
> import org.apache.fop.svg.PDFTranscoder;
> import org.apache.batik.transcoder.TranscoderInput;
> import org.apache.batik.transcoder.TranscoderOutput;
>
> public class SaveAsJpeg {
> public static void main(String [] args) throws Exception {
> // create a JPEG transcoder
> //JPEGTranscoder t = new JPEGTranscoder();
> PDFTranscoder t = new PDFTranscoder();
> // set the transcoding hints
> //t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(.8));
> // create the transcoder input
> String svgURI = new File("G://batik//test.svg").toURL().toString();
> TranscoderInput input = new TranscoderInput(svgURI);
> // create the transcoder output
> OutputStream ostream = new FileOutputStream("G://batik//test.pdf");
> TranscoderOutput output = new TranscoderOutput(ostream);
> // save the image
> t.transcode(input, output);
> // flush and close the stream then exit
> ostream.flush();
> ostream.close();
> System.exit(0);
> }
> }
>
> Compilation was fine but when I ran the code, I got the follow exception
>
> java.lang.AbstractMethodError
> at org.apache.batik.bridge.DocumentLoader.<init>(Unknown Source)
> at org.apache.batik.bridge.BridgeContext.<init>(Unknown Source)
> at
> org.apache.fop.svg.PDFTranscoder.transcode(PDFTranscoder.java:180) at
> org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)
> at kikuze.printmanager.batik.SaveAsJpeg.main(SaveAsJpeg.java:25)
fop is required to transcode SVG to PDF. Please, ensure that fop jar files
are in your classpath.
Thierry.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]