Hi thomas,
 
i found a method to do a clipping and save it into an other svgFile.
it's to change the value of the rootElement of the svgFile
 
but i have a problem lol : ) :i do a "setAttribut( )" but i dont change my attribut into the svgFile.
how can i change the value ?
 
.../...
 
//METHODE DE CLIPPING
        String svgURS = new File(rep+Sortie).toURL().toString();
        System.out.println("svgURS = "+ svgURS);
        UserAgent userAgent1 = new UserAgentAdapter();
        DocumentLoader docload1 = new DocumentLoader(userAgent1);
        Document doc1 = docload1.loadDocument(svgURS);
       
        String parser = XMLResourceDescriptor.getXMLParserClassName();
        SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
        Document doc = f.createDocument(svgURS);
 
                
        
        Element elt1 = doc1.getDocumentElement();
        Element elt = doc.getDocumentElement();
       
        boolean res1 = elt1.hasAttributeNS(null, "width");
        boolean res2 = elt.hasAttributeNS(null, "width");
       
        System.out.println("res1 = "+res1);
        System.out.println("res2 = "+res2);
       
        String res = elt1.getAttributeNS(null, "width");
        String res3 = elt.getAttributeNS(null, "width");
       
        System.out.println("width = " + res);
        System.out.println("width = " + res3);
       
        //elt1.removeAttributeNS(null, "width");
       
       
        //elt1.removeAttributeNS(null, "viewBox");
        elt1.setAttributeNS(null, "width", "250");
        res = elt1.getAttributeNS(null, "width");
        System.out.println("width = " + res);
        elt.setAttributeNS(null, "width", "250");
        res3 = elt.getAttributeNS(null, "width");
        System.out.println("width = " + res3);
        res3 = elt.getAttributeNS(null, "viewBox");
        System.out.println("width = " + res3);
       
        elt1.setAttributeNS(null, "viewBox", "100 100 100 100");
       
        GVTBuilder builder = new GVTBuilder();
        BridgeContext ctx = new BridgeContext(userAgent1,docload1);
        GraphicsNode gn = builder.build(ctx,elt1);
       

Reply via email to