Forum Feature requests

SVG gradients and foreignObject...

NoMoreNicksLeft
What are the chances of these being implemented any time soon? I only stumbled across Prince today, after looking for all sorts of svg->pdf solutions. Firefox is wonky with its conversion, Inkscape was good until I needed to use foreignObject (for word wrapping), and the rest all suck.

Prince is nearly perfect. With those two features it looks as if it would render perfectly. I think that I might even convince my boss to purchase it if it were to include these.
NoMoreNicksLeft
The consensus of my coworkers is that the price tag is well within the spectrum of what they purchase. My own opinion is that (with these missing features added), nothing else will do what is needed consistently or quickly, if at all. The project that it would be used for is considered critical.

I can't promise a sale, but I'd bet money that it would happen if offered the wager. It'd be the non-academic server license.
mikeday
We do have at least partial support for SVG gradients in Prince, is there a particular type of gradient that you need?
NoMoreNicksLeft
Perhaps I'm doing somthing wrong then. All I need are linear gradients, I don't believe any of mine even use more than two colors. They show up correctly in all browsers except Opera, and also in Inkscape. But when I convert with Prince, the relevant elements just show up as black. If I've mispoken and I'm just using it incorrectly, I apologize. I did check first, and on this site it says gradients are unsupported.

Also, I don't truly know how difficult <foreignObject> would be, but since you already do xhtml, and this is all that the contents are, what are the chances for that one? Is it less trivial than it seems to the uninformed?
mikeday
We may be able to add support for <foreignObject>, but it does have some limitations, such as not being able to break long documents over multiple pages. What kind of use case for this element do you have in mind?
NoMoreNicksLeft
Usually, we're talking very small paragraphs, or even just titles that consist of 3 or 4 words. Never anything more than 3-5 lines worth.

Most things, I'm manually justifying text, but a few of the reports have dynamic elements where this isn't possible.
mikeday
Okay, so basically small snippets of XHTML included in SVG to handle things like short paragraphs, which SVG 1.1 bizarrely doesn't support. I'll add this to the roadmap.
NoMoreNicksLeft
During the draft of the spec, they had their own facility for handling word wrapping. Then it was dropped before it became a recommendation. Leaving no practical way in which to do it... I was actually contemplating coding up some php that would do enough math to know how wide characters were. Even with just one font, it would have been painful.

Inkscape has its own internal markup for the same effect, but nothing renders it save Inkscape.

Thanks for adding it to the roadmap.
steven_noble
Very interested in foreign object, mostly to include HTML text elements like h1, p, etc, as word wrapping in SVG is non-existent. What's the ETA on this?
mikeday
We are not working on this yet, current focus is SVG filters, and later opacity. But some of the changes we have made recently may make it easier to support foreignObject in the future.
joelmeador
We have seen a couple requests for support for this in DocRaptor. Specifically SVGs coming out of Chartist.js. Thanks for the recent update, Mike!

Try DocRaptor - PrinceXML web service and official PrinceXML partner

joelmeador
And one of our customers made a PR. Wondering if there is something Prince could do to help here. The PR.

Try DocRaptor - PrinceXML web service and official PrinceXML partner

mikeday
SVG opacity works now, next is support for the mask feature; progress! :)