Dear all,
 
I try to print a SVG document from an applet using PrintTranscoder. It works but when the printing is finished, all the interactive features of my svg document are lost and I get some error messages when an event is fired.
 
Here is the piece of code :
 
    class OnClickPrintAction implements EventListener {
       
        public void handleEvent(Event evt) {
            EventTarget evtTarget = ((DOMMouseEvent)evt).getTarget() ;
            Element target = (Element)evtTarget ;
            SVGDocument svgDoc = (SVGDocument)target.getOwnerDocument() ;
            PrintTranscoder pt = new PrintTranscoder() ;
            TranscoderInput ti = new TranscoderInput(svgDoc) ;
            pt.transcode(ti, null) ;
            try {
                    pt.print() ;
            } catch(PrinterException pe) {
                    pe.printStackTrace() ;
            }
        }
       
    }
 
Error messages :
 
java.lang.NullPointerException
 
 at org.apache.batik.bridge.TextUtilities.convertTextAnchor(Unknown Source)
 
 at org.apache.batik.bridge.SVGTextElementBridge.getAttributeMap(Unknown Source)
 
 at org.apache.batik.bridge.SVGTextElementBridge.fillAttributedStringBuffer(Unknown Source)
 
 at org.apache.batik.bridge.SVGTextElementBridge.buildAttributedString(Unknown Source)
 
 at org.apache.batik.bridge.SVGTextElementBridge.computeLaidoutText(Unknown Source)
 
 at org.apache.batik.bridge.SVGTextElementBridge.handleDOMAttrModifiedEvent(Unknown Source)
 
 at org.apache.batik.bridge.BridgeContext$DOMAttrModifiedEventListener.handleEvent(Unknown Source)
 
 at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown Source)
 
 at org.apache.batik.dom.events.EventSupport.dispatchEvent(Unknown Source)
 
 at org.apache.batik.dom.AbstractNode.dispatchEvent(Unknown Source)
 
 at org.apache.batik.dom.AbstractElement.fireDOMAttrModifiedEvent(Unknown Source)
 
 at org.apache.batik.dom.AbstractAttr.setNodeValue(Unknown Source)
 
 at org.apache.batik.dom.AbstractAttr.setValue(Unknown Source)
 
 at org.apache.batik.dom.AbstractElement.setAttribute(Unknown Source)
 
 at SpeciesApplet.showTip(SpeciesApplet.java:319)
 
 at SpeciesApplet.access$100(SpeciesApplet.java:43)
 
 at SpeciesApplet$OnMouseOverNextAction.handleEvent(SpeciesApplet.java:827)
 
 at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown Source)
 
 at org.apache.batik.dom.events.EventSupport.dispatchEvent(Unknown Source)
 
 at org.apache.batik.dom.AbstractNode.dispatchEvent(Unknown Source)
 
 at org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Unknown Source)
 
 at org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Unknown Source)
 
 at org.apache.batik.bridge.BridgeEventSupport$Listener.mouseEntered(Unknown Source)
 
 at org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(Unknown Source)
 
 at org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(Unknown Source)
 
 at org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(Unknown Source)
 
 at org.apache.batik.gvt.event.AWTEventDispatcher.mouseMoved(Unknown Source)
 
 at org.apache.batik.swing.svg.JSVGComponent$1$MouseMovedRunnable.run(Unknown Source)
 
 at org.apache.batik.util.RunnableQueue.run(Unknown Source)
 
 at java.lang.Thread.run(Unknown Source)
 
 
 
java.lang.NullPointerException
 
 at org.apache.batik.dom.svg.SVGStylableElement$StyleDeclaration.<init>(Unknown Source)
 
 at org.apache.batik.dom.svg.SVGStylableElement.getStyle(Unknown Source)
 
 at SpeciesApplet.hideTip(SpeciesApplet.java:335)
 
 at SpeciesApplet.access$200(SpeciesApplet.java:43)
 
 at SpeciesApplet$OnMouseOutNextAction.handleEvent(SpeciesApplet.java:879)
 
 at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown Source)
 
 at org.apache.batik.dom.events.EventSupport.dispatchEvent(Unknown Source)
 
 at org.apache.batik.dom.AbstractNode.dispatchEvent(Unknown Source)
 
 at org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Unknown Source)
 
 at org.apache.batik.bridge.BridgeEventSupport$Listener.mouseExited(Unknown Source)
 
 at org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(Unknown Source)
 
 at org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(Unknown Source)
 
 at org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(Unknown Source)
 
 at org.apache.batik.gvt.event.AWTEventDispatcher.mouseMoved(Unknown Source)
 
 at org.apache.batik.swing.svg.JSVGComponent$1$MouseMovedRunnable.run(Unknown Source)
 
 at org.apache.batik.util.RunnableQueue.run(Unknown Source)
 
 at java.lang.Thread.run(Unknown Source)
 
Does anybody know why ? Thank you in advance,
 
Best regards,
 
Johan Duflost
 
Johan Duflost
Analyst Programmer
Belgian Biodiversity Information Facility (BeBIF)
Universite Libre de Bruxelles (ULB)
Boulevard du Triomphe - campus de la plaine
B-1050 Bruxelles
http://gis.bebif.be

Reply via email to