You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Russ Leong <ru...@kikuze.com> on 2001/12/03 04:14:52 UTC

Problem with generating PDF from Svg

Hi,
    I have tried several methods of generating a PDF but I already end up with the following AbstractMethodError. Can anyone give me a hint as to what can be wrong? Thanks.



About to transcode 1 SVG file(s)
 
Converting test.svg to G:\Vss\Evaluation\batik\test.pdf ... 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 org.apache.batik.apps.rasterizer.SVGConverter.transcode(Unknown Source)
        at org.apache.batik.apps.rasterizer.SVGConverter.execute(Unknown Source)
        at org.apache.batik.apps.rasterizer.Main.execute(Unknown Source)
        at kikuze.printmanager.batik.SaveAsPDF.main(SaveAsPDF.java:14)



Russ

Re: Problem with generating PDF from Svg

Posted by Russ Leong <ru...@kikuze.com>.
Hi Vincent,
    my batik and fop were only download last week so they should be
compatible with each other. 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);
    }
}



----- Original Message -----
From: "Vincent Hardy" <vi...@sun.com>
To: <ba...@xml.apache.org>
Sent: Monday, December 03, 2001 4:03 PM
Subject: Re: Problem with generating PDF from Svg


> Russ,
>
> I suspect you are using an incompatible version of the PDF transcoder.
> There has been an API change in Batik a couple months ago which
> created an incompatibility. Did you try the most recent PDF transcoder?
>
> Vincent.
>
> > Russ Leong wrote:
> >
> > Hi,
> >     I have tried several methods of generating a PDF but I already end
> > up with the following AbstractMethodError. Can anyone give me a hint
> > as to what can be wrong? Thanks.
> >
> >
> >
> > About to transcode 1 SVG file(s)
> >
> > Converting test.svg to G:\Vss\Evaluation\batik\test.pdf ...
> > 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
> > org.apache.batik.apps.rasterizer.SVGConverter.transcode(Unknown
> > Source)
> >         at
> > org.apache.batik.apps.rasterizer.SVGConverter.execute(Unknown Source)
> >         at org.apache.batik.apps.rasterizer.Main.execute(Unknown
> > Source)
> >         at kikuze.printmanager.batik.SaveAsPDF.main(SaveAsPDF.java:14)
> >
> >
> >
> > Russ
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Re: Problem with generating PDF from Svg

Posted by Vincent Hardy <vi...@sun.com>.
Russ,

I suspect you are using an incompatible version of the PDF transcoder.
There has been an API change in Batik a couple months ago which 
created an incompatibility. Did you try the most recent PDF transcoder?

Vincent.

> Russ Leong wrote:
> 
> Hi,
>     I have tried several methods of generating a PDF but I already end
> up with the following AbstractMethodError. Can anyone give me a hint
> as to what can be wrong? Thanks.
> 
> 
> 
> About to transcode 1 SVG file(s)
> 
> Converting test.svg to G:\Vss\Evaluation\batik\test.pdf ...
> 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
> org.apache.batik.apps.rasterizer.SVGConverter.transcode(Unknown
> Source)
>         at
> org.apache.batik.apps.rasterizer.SVGConverter.execute(Unknown Source)
>         at org.apache.batik.apps.rasterizer.Main.execute(Unknown
> Source)
>         at kikuze.printmanager.batik.SaveAsPDF.main(SaveAsPDF.java:14)
> 
> 
> 
> Russ

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org