[cairo] SVG 2 PDF with rsvg-convert gradient and transparency problems
Adrian Jones
ajones at umces.edu
Thu Feb 25 10:54:53 PST 2010
Hi Carl,
I have created some simple examples for each problem in Illustrator:
http://ian.umces.edu/images/gradient_examples.zip
1) I saved each one directly to PDF1.4 (transparency_original.pdf and
two-color-gradient_original.pdf)
2) Then I saved each one to SVG from Illustrator (transparency.svg and
two-color-gradient.svg)
3) Then I used rsvg-convert to make transparency_converted.pdf and
two-color-gradient_converted.pdf
You'll notice that both the original PDFs and SVGs open in Illustrator fine.
However, both the converted PDFs have problems. The two-color-gradient
example has the "An unknown shading type was encountered." error and when it
opens up, the shape is no longer an editable vector.
4) Then I manually edited the SVG and duplicated the first stop in the
gradient (two-color-gradient-with-dup-stop.svg)
5) Then converted this with rsvg-convert to
two-color-gradient-with-dup-stop.pdf
You'll notice that this new PDF opens up fine in Illustrator and the shape
and gradients are fully editable.
As for the transparency example - the converted PDF loads without error, but
the transparency is no longer applied and there is a clipping mask on it.
Hopefully these examples will help you debug what is going on.
Thanks,
Adrian
-----Original Message-----
From: Carl Worth [mailto:cworth at cworth.org]
Sent: Friday, February 19, 2010 9:35 AM
To: Adrian Jones; cairo at cairographics.org
Subject: Re: [cairo] SVG 2 PDF with rsvg-convert gradient and transparency
problems
On Wed, 10 Feb 2010 14:37:25 -0800, "Adrian Jones" <ajones at umces.edu> wrote:
> In the following example I have duplicated the offset="0" stop which
> fixes things and means that if I convert the SVG to PDF with
> rsvg-convert the resulting shape is filled with this gradient and
> works fine. Without the duplicate declaration, the gradient is
> converted to an un-editable image with a clipping mask.
This workaround sounds quite bizarre.
With or without the duplicate color stop the gradient should be the same. So
I'm very curious to know what is being generated differently in the
resulting PDF (and that's ticking Illustrator in a bad way).
> 2) A shape that has an opacity that is less than "1".
...
> So, could rsvg-convert handle these conversions better, or is there
> something I can do with the original SVG code to make the opacity work
> ok in the final PDF?
I'm not sure on this one. What might be a good start is to post a PDF file
(converted from an SVG) that's as simple as possible while exhibiting this
bug. Then could you also generate and post a similar PDF file but that Adobe
Illustrator is happy to import?
If you're able to generate those then we should be able to see what we could
do differently in cairo's PDF backend, (which, yes, rsvg-convert is using).
-Carl
More information about the cairo
mailing list