SVG to PDF - gradient and transparency problems

Post questions on how to use or achieve an effect in Inkscape.
adrianbj
Posts: 4
Joined: Thu Feb 11, 2010 6:05 am

SVG to PDF - gradient and transparency problems

Postby adrianbj » Thu Feb 11, 2010 6:19 am

I have problems using the Save As PDF option. Ultimately I am wanting to convert SVG to AI via the command line interface on our server. But when I open the PDF in Illustrator I get this message:
"An unknown shading type was encountered" and the offending shapes are un-editable "images" with a clipping mask over them.

There are two circumstances that result in problems for me.

1) A gradient with only 2 stops.

In the following example I have duplicated the offset="0" stop which fixes things and means that the resulting shape that is filled with this gradient works fine. Without the duplicate declaration, the gradient is converted to an un-editable image with a clipping mask when the PDF is viewed in Illustrator.

Code: Select all

  <linearGradient id="ian_symbols_b8a58aafc1f12e74492e9e865b7f569b" gradientUnits="userSpaceOnUse" x1="113.7275" y1="136.9414" x2="197.0259" y2="136.9414">
    <stop offset="0" style="stop-color:#927A62" id="stop1472" />
    <stop offset="0" style="stop-color:#927A62" id="stop1472_dup" />
    <stop offset="1" style="stop-color:#93866F" id="stop1474" />
  </linearGradient>



2) A shape that has an opacity that is less than "1". I don't know how to fix this one and still maintain the look of the original. I understand that there are some issues with transparency and the PDF format, but obviously the full AI version of the PDF format these days supports transparency.

So, could Inkscape 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?

Thanks

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: SVG to PDF - gradient and transparency problems

Postby brynn » Thu Feb 11, 2010 6:38 am

In general, Inkscape is not able to export gradients and some other features properly to PDF. And I will admit that I don't understand what you're asking (not because of the grammar but because I know very little about XML). But there are some good alternatives to using Inkscape to convert to PDF in this topic: viewtopic.php?f=5&t=4256 This member ultimately found a simple solution, but the other advice offered in the thread I found quite informative.

Also, you might search Launchpad for the current state of development, as well as more technical discussions about Inkscape SVG to PDF. Maybe you would even want to contribute your ideas?

adrianbj
Posts: 4
Joined: Thu Feb 11, 2010 6:05 am

Re: SVG to PDF - gradient and transparency problems

Postby adrianbj » Thu Feb 11, 2010 9:09 am

Hi brynn,

Thanks for your thoughts. I have posted a reply to a fairly relevant topic over at launchpad. As for the other post - unfortunately rasterizing the elements is what I am trying to avoid, so that users particular solution won't suit. I have also tried as many other converters as I can find. Since many use Cairo, the results are often identical, but I have also tried Batik, PrinceXML, Scribus, Uniconverter, and some others (incl. Klecks, which gave unrecognizable results), all of which gave worse conversions. So far, the only program that works, is Illustrator itself - it renders "all" SVG code perfectly - if only there was a linux version and a cli for it :)

At least I can avoid most of the issues by ensuring there are always at least three stops for each gradient definition, although I feel like cairo should be able to properly deal with only having two.

The opacity issue seems more complicated and may require a specific SVG to AI converter, since the SVG to PDF converters don't seem to handle all the options available in the standard.

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: SVG to PDF - gradient and transparency problems

Postby microUgly » Tue Feb 16, 2010 9:09 pm

The problem is simply that PDF and AI formats do not support opacity within gradients. It's been a few years since I used Illustrator, but the process of producing such an effect was simply too complicated to be worth the effort even in Illustrator itself. You basically had to define a gradient, then apply a mask to it. In most cases it was easier to just create the illusion of transparency by manually blending colours.

The argument, by more informed Illustrator users than myself, was that transparency is an issue when printing so Adobe does not make it easy to achieve to prevent novice mistakes. Although I was never convinced since Corel did not shy away from transparency.

adrianbj
Posts: 4
Joined: Thu Feb 11, 2010 6:05 am

Re: SVG to PDF - gradient and transparency problems

Postby adrianbj » Wed Feb 17, 2010 7:12 am

microUgly,

I am not trying to support opacity within gradients. The two issues I have are:

1) Gradients with only two stops won't convert from SVG to PDF, but if I duplicate one of the stops so that there are three, then the PDF works perfectly when opened in AI. It seems to me that the SVG to PDF conversion should be able to work even with only 2 stop gradients.

2) Opacity of less than 1 in a single color shape does not convert to PDF. I can easily create both single-colored shapes with transparency as well as gradients with transparency in Illustrator CS4. I know that single color transparency has been around for ever, but can't be certain about transparency in gradients. Either way, they are definitely supported now and it would be great to be able to convert SVG to PDF so that these worked.

I know I must be mis-understanding the issues somewhere here - would you mind explaining what I am missing please?

I also emailed the cairo mailing list, but didn't get any response, so I feel like maybe I am not getting my point across properly.

Thanks,
Adrian

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: SVG to PDF - gradient and transparency problems

Postby brynn » Wed Feb 17, 2010 7:52 am

so I feel like maybe I am not getting my point across properly.

Your messages seem clear enough to me. I think this forum probably doesn't have a lot of members who can capabley discuss this issue. It may take some time before the person(s) with the right knowledge see the topic here. I'm sorry if you need answers right away. But maybe an Adobe forum, would be another good resource. On this page, on the right hand side, in the top half of the page (in my browser), is a list of forums.

Not that I'm trying to send you away :P , but just to offer you some other ideas.

adrianbj
Posts: 4
Joined: Thu Feb 11, 2010 6:05 am

Re: SVG to PDF - gradient and transparency problems

Postby adrianbj » Wed Feb 17, 2010 7:59 am

Hi brynn,

Thanks for your thoughts - even I don't think it is an adobe issue since native Illustrator files can definitely handle two color (two stop) gradients and transparency, I'll give it a go - someone over there might be of help.

Cheers,
Adrian


Return to “Help with using Inkscape”