You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Julien Beghin <ju...@gmail.com> on 2008/09/19 15:13:51 UTC

PDF Export bug

Hi there,

I have a new problem that I can't understand...

I figured out a few day ago how I can generate PDF files from my SVG Doc and I thought it was OK.

I use a SVG Canvas in my application and some Elements of my svgDoc have a special cursor on mouseOver.
Cursor are added like this :
for(String test : s){
Element elt = svgDom.getElementById(s);
elt.setAttribute(SVGConstants.SVG_CURSOR_TAG,SVGConstants.SVG_POINTER_VALUE);
}

This seems to work as when my mouse is over an element in the canvas, its cursor becomes a hand.

I also need to export my svg as a pdf. Here is what I do :

            PDFTranscoder transcoder = new PDFTranscoder();
            TranscoderInput input = new TranscoderInput(doc);
            FileOutputStream fos = new FileOutputStream(filename);
            TranscoderOutput output = new TranscoderOutput(fos);
            transcoder.addTranscodingHint(PDFTranscoder.KEY_HEIGHT, (float)1500);
            transcoder.addTranscodingHint(PDFTranscoder.KEY_WIDTH, (float)2200);
            transcoder.transcode(input, output);
            fos.close();


When my export is done, the output file is a great pdf in a A3 format, as I need. 

But when I try to mouve over an element in the SVG Canvas, the cursor doesn't change anymore.
When removing the trancsode line, I keep this effect. I was wondering if the transcoder.transcode(input, output) call wasq modifying 
my input document ?

This behaviour seems to be very weird.

Does someone have an idea to correct this ?

Thank and have a great week end ;)

_________________________________________________________________
Installez gratuitement les 20 émôticones Windows Live Messenger les plus fous ! Cliquez ici !
http://www.emoticones-messenger.fr/

Re: PDF Export bug

Posted by th...@kodak.com.
Hi Minimoi,

<mi...@hotmail.com> wrote on 09/19/2008 09:13:51 AM:

> I figured out a few day ago how I can generate PDF files from my SVG
> Doc and I thought it was OK.
> 
> I use a SVG Canvas in my application and some Elements of my svgDoc 
> have a special cursor on mouseOver.
[...] 
> This seems to work as when my mouse is over an element in the 
> canvas, its cursor becomes a hand.
> 
> I also need to export my svg as a pdf. Here is what I do :
> 
>             PDFTranscoder transcoder = new PDFTranscoder();
>             TranscoderInput input = new TranscoderInput(doc);

> When my export is done, the output file is a great pdf in a A3 
> format, as I need. 
> 
> But when I try to mouve over an element in the SVG Canvas, the 
> cursor doesn't change anymore.
> When removing the trancsode line, I keep this effect. I was 
> wondering if the transcoder.transcode(input, output) call wasq modifying 

> my input document ?

   A document can only be associated with one renderer at a time.
So when you generate the PDF it breaks the links with the canvas.
I would suggest that you either clone the document before generating
the PDF, or that you reset the document on the canvas after the
PDF is created. 

   I think the clone is better.