Return-Path: Delivered-To: apmail-xmlgraphics-batik-users-archive@www.apache.org Received: (qmail 9322 invoked from network); 11 Apr 2006 14:54:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 Apr 2006 14:54:06 -0000 Received: (qmail 71087 invoked by uid 500); 11 Apr 2006 14:54:04 -0000 Delivered-To: apmail-xmlgraphics-batik-users-archive@xmlgraphics.apache.org Received: (qmail 71078 invoked by uid 500); 11 Apr 2006 14:54:04 -0000 Mailing-List: contact batik-users-help@xmlgraphics.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: batik-users@xmlgraphics.apache.org Delivered-To: mailing list batik-users@xmlgraphics.apache.org Received: (qmail 71066 invoked by uid 99); 11 Apr 2006 14:54:04 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Apr 2006 07:54:04 -0700 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=NO_REAL_NAME,SPF_PASS,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of thomas.deweese@kodak.com designates 192.232.121.200 as permitted sender) Received: from [192.232.121.200] (HELO smtp1.kodak.com) (192.232.121.200) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Apr 2006 07:54:00 -0700 Received: from roc-us-e1000-112.kodak.com (roc-us-e1000-112.kodak.com [192.232.121.192]) by smtp1.kodak.com (8.11.3/8.11.1) with SMTP id k3BErc007255 for ; Tue, 11 Apr 2006 10:53:38 -0400 (EDT) Received: from (150.221.122.53) by roc-us-e1000-112.kodak.com via smtp id 3ede_f587488e_c96a_11da_95ad_0002b3c946b6; Tue, 11 Apr 2006 10:53:37 -0400 In-Reply-To: <003701c65d76$ef268140$160aa8c0@dbrowne> To: batik-users@xmlgraphics.apache.org Cc: batik-users@xmlgraphics.apache.org Subject: RE: CSS ignored when exporting to JPG MIME-Version: 1.0 X-Mailer: Lotus Notes Release 6.5.4 March 27, 2005 Message-ID: From: thomas.deweese@kodak.com Date: Tue, 11 Apr 2006 10:53:32 -0400 X-MIMETrack: Serialize by Router on KNOTES2/ISBP/EKC(Release 6.5.4FP1|June 19, 2005) at 04/11/2006 10:53:38 AM, Serialize complete at 04/11/2006 10:53:38 AM Content-Type: text/plain; charset="US-ASCII" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi Dylan, "Dylan Browne" wrote on 04/11/2006 10:48:01 AM: > Is there anyway I can keep my existing code which imports my stylesheet, > which is - > > ProcessingInstruction pi = > doc.createProcessingInstruction("xml-stylesheet","C:\svg\style.css"); > doc.insertBefore(pi, doc.getDocumentElement()); > > I don't quite see why this is picked up ok in the browser and renders the > SVG fine, but the stylesheet is not found when I choose to export the file > to JPG using the transcoder classes. "C:\svg\style.css" is a relative URL, you need to make it absolute. When the browser renders the file it provides the base url of the document (which is likely a 'file:' URL) which is used to turn the relative URL into an absolute URL. I suspect all you need to do is use: "file:///C:/svg/style.css" Typically I will use the JDK provided functionality new File("C:\svg\style.css").toURL() Which almost always gives the 'expected' behavior for files... > Thanks in advance again for any help, > > Regards, > Dylan. > > > -----Original Message----- > From: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] > Sent: 11 April 2006 14:13 > To: batik-users@xmlgraphics.apache.org > Cc: batik-users@xmlgraphics.apache.org > Subject: RE: CSS ignored when exporting to JPG > > Hi Dylan, > > "Dylan Browne" wrote on 04/11/2006 07:12:20 > AM: > > > So Im guessing the stylesheet is not being found now? > > org.w3c.dom.DOMException: Null Document reference: Invalid CSS document. > > Correct, most likely Batik can't find your CSS style sheet. Commonly > this is cause by using a relative reference when a Document without a > knowable base url is used. In this case the problem is that you haven't > properly set the xlink:href attribute: > > > > css.setAttributeNS(null, "xlink:href", > > "http://localhost:7001/SVGWeb/style.css"); > > This needs to be: > String XLINK_NAMESPACE_URI = "http://www.w3.org/1999/xlink"; > css.setAttributeNS(XLINK_NAMESPACE_URI , "xlink:href", > "http://localhost:7001/SVGWeb/style.css"); > > Assuming you have an HTTP server on local host at port 7001 > with a document at that location... > > > > -----Original Message----- > > From: Dylan Browne [mailto:dbrowne@mango-solutions.com] > > Sent: 11 April 2006 11:13 > > To: batik-users@xmlgraphics.apache.org > > Subject: CSS ignored when exporting to JPG > > > > Hi, > > > > I have a problem when attempting to rasterize an SVG document created > using > > the Batik DOM classes. It looks like the rasterize process is not > picking up > > the stylesheet I am importing. > > > > I include my stylesheet like this (this works fine in so far as > rendering > > SVG in the browser goes): > > > > ProcessingInstruction pi = null; > > // import the stylesheet > > pi = doc.createProcessingInstruction("xml-stylesheet", > Config.CSS); > > doc.insertBefore(pi, doc.getDocumentElement()); > > > > When I am creating my JPG, I use the following code. This does generate > the > > jpg, but any elements which are styled are not picked up so I end up > with a > > largely black image with a few shapes visible: > > > > public void streamSVGIntoImageFormat(SVGDocument doc) { > > try { > > // create a JPEG transcoder > > JPEGTranscoder t = new JPEGTranscoder(); > > // set the transcoding hints > > t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new > Float(.8)); > > // create the transcoder input > > TranscoderInput input = new TranscoderInput(doc); > > // create the transcoder output > > OutputStream ostream = new FileOutputStream("c:\\out.jpg"); > > TranscoderOutput output = new TranscoderOutput(ostream); > > // save the image > > t.transcode(input, output); > > // flush and close the stream then exit > > ostream.flush(); > > ostream.close(); > > } catch (Exception e) { > > e.printStackTrace(); > > } > > } > > > > Does this look like an issue with how I import my stylesheet, or an > issue > > with how I am calling the Transcoder code? > > > > Thanks in advance for any help, > > > > Kind regards, > > > > Dylan > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org > > For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org > > For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org > For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org > For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org