xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Bockermann <christian.bockerm...@udo.edu>
Subject Re: Problem including user-css
Date Fri, 16 Jul 2010 13:25:53 GMT
Hi Peter!

thanks for your quick response. Your example works fine here as well, so
it's definitely me failing to set up my "real" example the right way.

What I am trying to achive:

   Convert the WorldMap.svg  which has countries identified by a class
   attribute into a png and use a style-sheet for highlighting a specific 
   country. Adding

       .fr {
           fill: red;
       }

   directly into the .svg-file correctly highlights France.

   Specifying the same css-lines into a hightlight-fr.css and using the
   rasterizer with -cssUser does not work.

I have bundled all the stuff into a zip-file at

	https://secure.jwall.org/download/batik-test.zip

Within the folder contained in the file above, I run

    java -jar batik-rasterizer.jar -cssUser highlight-fr.css WorldMap.svg

which somehow does not work. I'm not a CSS expert, though. Maybe I'm doing
something completely stupid - but I don't see it :-)

Version of batik is 1.7 on MacOS here.


Regards,
    Chris
    


Am 16.07.2010 um 14:53 schrieb Peter Hull:

> I tried it with the rasterizer and it seemed to work:
> === me.svg ===
> <?xml version="1.0" standalone="no"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
> "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
> <svg xmlns="http://www.w3.org/2000/svg" width="4cm" height="3cm"
> viewBox="0 0 400 300">
> <text id="sample" x="0" y="150">Hello, World</text>
> </svg>
> 
> === me.css ===
> #sample {font-size: 48px; fill: red}
> 
> and the command:
> java -jar batik-rasterizer.jar -cssUser me.css me.svg
> gave me large red text as expected. This is batik-1.7 on Windows/Java 1.6
> 
> Pete
> 
> 
> 
> On Fri, Jul 16, 2010 at 11:37 AM, Christian Bockermann
> <christian.bockermann@udo.edu> wrote:
>> Hi list,
>> 
>> I am trying to convert a single SVG file into a PNG with a user-based CSS.
>> 
>> Without the user-based CSS everything works fine - using batik-rasterizer as
>> well as embedding the Transcoder into my Java code.
>> 
>> Then I added:
>> 
>>        log.info( "cssURL: {}", cssURL );
>>        t.addTranscodingHint( ImageTranscoder.KEY_USER_STYLESHEET_URI, cssURL );
>> 
>> where "t" is the PNGTranscoder and "cssURL" is:
>> 
>>        file:///Users/chris/sample.css
>> 
>> Unfortunately, I don't see any effects of the sample.css in the resulting PNG.
>> If I copy&paste the contents of the sample.css into a   <style>...</style>
section
>> of the SVG file, the styles are correctly applied.
>> 
>> I get the same behaviour, when using the batik-rasterizer:
>> 
>>     java -jar batik-rasterizer.jar -cssUser /Users/chris/sample.css  sample.svg
>> 
>> I tried to use "-cssUser file:///Users/chris/sample.css" or the like. Nothing worked.
>> 
>> Any ideas?
>> 
>> Best regards,
>> 
>>   Chris
>> ---------------------------------------------------------------------
>> 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


Mime
View raw message