xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ed Robbins ...@erobbins.com>
Subject Problem with transcoder
Date Thu, 30 Jan 2003 01:47:29 GMT
I'm new to the list and did a search for a similar problem but I
couldn't find anything.  I've been working on a project where I have
been generating SVG's from servlets to display data.  I've been
generating the SVG's without a problem for several months now but was
asked to demonstrate a transformation of an SVG into another format, jpg
in this case.  I found many examples on the net and plugged one in to
try it out, but I'm having no success.  My first attempt was to try it
via the servlet response, which was part of the example I found, but I
couldn't get it to work.  So then I tried to create a file and if I get
anything, I get an empty file with the name specified.

This line:   transcoder.transcode(input,output);  

seems to give me the most trouble.  If I get to it, the whole shooting
works just stops at that line, this is during debug of course.

I also have trouble at this line:   JPEGTranscoder transcoder = new
JPEGTranscoder();

Again, with the same behavior, it just hangs there.

I've tried this with Batike 1.1.1 and 1.5 with the same results.  If
anyone can shed some light on this I would be most appreciative.

Thanks.

Ed


public void execute() {
    response.setContentType("image/jpeg");


    JPEGTranscoder transcoder = new JPEGTranscoder();
   
transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,imageQuality);
    transcoder.setErrorHandler(new SVGErrorHandler());


    TranscoderInput input = new TranscoderInput(new
StringReader(this.svgString));

    try
    {
      FileOutputStream fos = new FileOutputStream("image.jpg");
      TranscoderOutput output = new TranscoderOutput(fos);
      transcoder.transcode(input,output);
//      response.getOutputStream().flush();
//      response.getOutputStream().close();
      fos.flush();
      fos.close();

    } catch(Exception ex)
    {
      System.err.println("Caught exception in JPEGEmitter: " + ex);
      ex.printStackTrace();
    } // try - catch
  } // execute()




-- 
Ed Robbins <ed@erobbins.com>


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


Mime
View raw message