> The easiest thing to do is to simply clone the document before you > go to print it. However if you want to you can probably use the > graphics tree from the Canvas to draw to the print Graphics2D.
What's the suggested way to clone a document? Running into the same kind of issue with transcoding a document to PNG/JPG. Michael Bishop -----Original Message----- From: Thomas DeWeese [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 11, 2005 7:02 AM To: [email protected] Subject: Re: Strange problem when printing Hi Henric, henric wrote: > When I call the print-function of the PrinterJob-class, it somehow seems > to break the SVG loaded in the JSVGCanvas: > > TranscoderInput ti = new > TranscoderInput(SvgEditor.getCanvas().getSVGDocument()); > prm.transcode(ti, null); A document can only be associated with one graphics tree at a time. When you 'print it' the association between the document and the Canvas is broken and it is reassociated with the print transcoder. > After having printed the SVG (Which works like it should) all changes I > try to do to the SVG generates a NullPointerException. > Oh, and another problem I have: How do you get the scrollbars in the > JSVGScrollPane to update themselves and correct the scrollbars? They should do this automatically. > When I load a new SVG and then add some elements to it that stretches > outside the visible area, it doesnt update the scrollbars. But as soon > as I press an arrow-key, it shows the scrollbars like it should. Are you taking care to only update the Document in the UpdateManager's RunnableQueue thread? It doesn't look like it: > at org.apache.batik.dom.AbstractElement.setAttribute(Unknown Source) > at JSvgCanvasEnh.setZoom(JSvgCanvasEnh.java:75) > at StandardToolbar.actionPerformed(StandardToolbar.java:225) If you just modify the Document "Bad things" will happen, you must only modify the document in the UpdateManager thread. > I've tried calling m_canvasScroll.reset(); in the OnLoadAction-method > that's executed when an SVG is loaded into the canvas, but it doesn't > seem to do anything. Make your changes in the UpdateManager thread and all should be well... --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
