You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by ca...@apache.org on 2007/09/27 14:44:00 UTC

svn commit: r579992 - /xmlgraphics/batik/trunk/sources/org/apache/batik/apps/rasterizer/SVGConverter.java

Author: cam
Date: Thu Sep 27 05:44:00 2007
New Revision: 579992

URL: http://svn.apache.org/viewvc?rev=579992&view=rev
Log:
Rasterizer -cssUser command line argument resolved against current working
directory.  Fixes bug 42505.

Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/apps/rasterizer/SVGConverter.java

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/apps/rasterizer/SVGConverter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/apps/rasterizer/SVGConverter.java?rev=579992&r1=579991&r2=579992&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/apps/rasterizer/SVGConverter.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/apps/rasterizer/SVGConverter.java Thu Sep 27 05:44:00 2007
@@ -27,6 +27,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.List;
@@ -38,6 +39,7 @@
 import org.apache.batik.transcoder.image.ImageTranscoder;
 import org.apache.batik.transcoder.image.JPEGTranscoder;
 import org.apache.batik.transcoder.image.PNGTranscoder;
+import org.apache.batik.util.ParsedURL;
 
 /**
  * This application can be used to convert SVG images to raster images.
@@ -876,8 +878,15 @@
         }
 
         // Set user stylesheet
-        if (userStylesheet != null){
-            map.put(ImageTranscoder.KEY_USER_STYLESHEET_URI, userStylesheet);
+        if (userStylesheet != null) {
+            String userStylesheetURL;
+            try {
+                URL userDir = new File(System.getProperty("user.dir")).toURL();
+                userStylesheetURL = new ParsedURL(userDir, userStylesheet).toString();
+            } catch (Exception e) {
+                userStylesheetURL = userStylesheet;
+            }
+            map.put(ImageTranscoder.KEY_USER_STYLESHEET_URI, userStylesheetURL);
         }
 
         // Set the user language
@@ -893,12 +902,12 @@
 
         // Set validation
         if (validate){
-            map.put(ImageTranscoder.KEY_XML_PARSER_VALIDATING, Boolean.TRUE );
+            map.put(ImageTranscoder.KEY_XML_PARSER_VALIDATING, Boolean.TRUE);
         }
 
         // Set onload
         if (executeOnload) {
-            map.put(ImageTranscoder.KEY_EXECUTE_ONLOAD, Boolean.TRUE );
+            map.put(ImageTranscoder.KEY_EXECUTE_ONLOAD, Boolean.TRUE);
         }
 
         // Set snapshot time
@@ -913,7 +922,7 @@
 
         // Set constrain script origin
         if (!constrainScriptOrigin) {
-            map.put(ImageTranscoder.KEY_CONSTRAIN_SCRIPT_ORIGIN, Boolean.FALSE );
+            map.put(ImageTranscoder.KEY_CONSTRAIN_SCRIPT_ORIGIN, Boolean.FALSE);
         }
 
         return map;