Exporting patterns and gradients doesn't work for PDF / EMF

Bug #168610 reported by Djmitchella
100
This bug affects 12 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
Unassigned
Poppler
Fix Released
Medium
cairo (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Create a pattern in Inkscape.
 Fill a shape with it
 Save the file as PDF or EMF
 The pattern doesn't show up in the resulting file.

 See attached SVG for an example.

Tags: exporting
Revision history for this message
Djmitchella (djmitchella) wrote :
Revision history for this message
Djmitchella (djmitchella) wrote :

Originator: YES

This is with version 0.45.1.

Presumably related to bug 1208874.

Also, as in that bug, gradients don't export to PDF or EMF either.

Revision history for this message
Djmitchella (djmitchella) wrote :

Originator: YES

Further update -- exporting gradients creates PDFs that only show up
correctly in Acrobat Reader; using Foxit PDF reader, the gradient fill
shows up as solid.

Patterns don't show up in either viewer, though.

Revision history for this message
In , Carlos Garcia Campos (carlosgc) wrote :

Bug forwarded from Evince: http://bugzilla.gnome.org/show_bug.cgi?id=438386

"Please describe the problem:
While making a scientific poster evince showed annoying stripes in color
gradients. xpdf (version 3.01) and acrobat render the document correctly.

Steps to reproduce:
It should be possible to reproduce the bug by compiling following file with
pdflatex.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{color}
\usepackage{tikz}
\usepackage[a0paper,margin=2cm,nohead,nofoot,paperheight=110cm,
paperwidth=95cm]{geometry}

\definecolor{botcol}{rgb}{0.890625, 0.88671875, 0.99609375}
\definecolor{topcol}{rgb}{1.0, 1.0, 1.}

\pagestyle{empty}
\pagecolor{black}

\begin{document}

\begin{tikzpicture}
\draw (0,0) node[shade, color=topcol, bottom color=botcol] {
\parbox{1.\textwidth}{
\Large Test
\vspace{30cm}
}};
\end{tikzpicture}

\end{document}"

It's only reproducible with cairo backend, with splash it's rendered correctly.

Revision history for this message
In , Carlos Garcia Campos (carlosgc) wrote :

Created an attachment (id=9961)
pdf file showing spurious stripes

Revision history for this message
In , Alfredo Matos (alfmatos) wrote :

Created an attachment (id=10483)
presentation pdf with stripes on gradients

I also see this on two separate setups:
- using evince 0.8.1 and libpoppler 0.5.4, on Ubuntu Feisty.
- using evince 0.9.1 and libpoppler 0.5.9, on Ubuntu Gutsy.

For me the procedure is:

1. Create a presentation with openoffice
2. Change the background to a gradient
3. Export as PDF
4. Open in evince

Test case file is attached.

Revision history for this message
In , Nathaniel Smith (njs) wrote :

This may be related to bug#11165

Revision history for this message
In , Freedesktop (freedesktop) wrote :

I'm seeing the same bug in PDF generated by latest cairo.

Revision history for this message
In , Kristian Hoegsberg (krh-bitplanet) wrote :

*** Bug 11165 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Kristian Hoegsberg (krh-bitplanet) wrote :

The problem is that the builtin splash rendering backend doesn't support gradient patterns. The higher level poppler rendering logic breaks a gradient filled polygon into a series of solid color polygons corresponding to the color bands in the gradient. When these polygons are rendered in several passes with anti-aliasing, seams occur between the polygons.

Revision history for this message
Rockstar1707 (rockstar1707) wrote :

Originator: NO

Pattern export still doesn't work even in latest win32 build of Inkscape
(Inkscape 0.46dev+devel, built Sep 13 2007) with Cairo PDF export.

Furthermore, the rendering of patterns is still not good as it can be seen
on the pictures.

Samples:

PNG export: http://shrani.si/f/3f/9F/1ipXdEHk/patternandgradie.png
Cairo PDF export: http://shrani.si/f/1m/uy/26Eu4UH1/patternandgradie.pdf

Revision history for this message
In , Tfc-duke-gmail (tfc-duke-gmail) wrote :

The bug is also present with poppler 0.6 on Ubuntu Gutsy. A bit annoying for Beamer presentations...

Revision history for this message
Zetoken (zetoken) wrote :

Originator: NO

As said before, gradients aren't exporting at all to EMF format (tested
with last dev build).
I'm very interested in it as Inkscape is THE tool I use to make all
drawings for slides, particularly with Powerpoint. Will this capability be
implemented?

prkos (prkos)
Changed in inkscape:
status: New → Confirmed
nightrow (jb-benoit)
Changed in inkscape:
importance: Undecided → Medium
Revision history for this message
rockstar1707 (rockstar1707-gmail) wrote :

I'm just wondering if something has been done on this bug lately. In the nightly build I'm currently using (from 1st of February 2008) patterns and gradients still don't export in PDF.

Revision history for this message
In , Jeff Muizelaar (jeff-infidigm) wrote :

The patch in bug 14408 may help with this.

Revision history for this message
Rygle (rygle) wrote :

The 0.46 dev build from Feb 26 08 for Windows seems to export gradients and transparency (but not blurs) to PDF just fine. I suspect this is because of upgrades to the version of Cairo. I think it's now at 1.5.10. Only tested with Acrobat Reader 8.1, not Foxit.

EMF still exports everything with a gradient as black, but flat colours OK. The shape is still there, but needs to be recoloured.

Revision history for this message
TritonMan (ch3pjw) wrote :

I'm using:
Inkscape 0.45.1, built Mar 21 2007, on Fedora 7.0
installed from my package manager. I know this is quite an old version, so things have likely moved on, but I thought it was worth reporting anyway.

I have some text with a gradient fill, and have saved my .svg file to .pdf. The gradients *are* present in the output in KPDF 0.5.9 and Evince 0.8.2, although they are blocky (as if they have been formed from other image elements, rather than native PDF gradients?). But the main problem is that objects that are filled with gradients are completely the wrong shape - they obliterate nearly all of my document! The best way to describe them might be something like: "very large random polygons". Some of the original text is still visible over the top.

The artifacts don't seem to appear in ghostview - indeed one word of my text appears to be rendered correctly - but there are other problems in the output. Have not as yet tested on windows and adobe reader.

Revision history for this message
sam tygier (samtygier) wrote :

the gradient rendering is a bug in the poppler cairo backend. hence xpdf renders the gradient fine.

Changed in poppler:
status: Unknown → Confirmed
Revision history for this message
madworm (madworm-de-inkscape) wrote :

it's not just that gradients get messed up or displayed incorrectly, the hole document gets pixelized during pdf export.
unfortunately this also includes text. this affects print quality quite significantly if text gets rastered. (cmyk problem adds to that as well).

attached demo files (svg/pdf). best viewed with acroread (more zoom possible).

Revision history for this message
Duck Tayp (ducktayp) wrote :

This bug (possibly two separate bugs) still exists in the latest SVN Head. I can't get Inkscape to output patterns at all to PS, EPS or PDF. I tried the following versions:
1. on a debian unstable x86_64 system (cairo version I'm using is 1.6.4; debian unstable package 1.6.4-1+b1). I tried both the native debian package for 0.46.0 and
the latest SVN Head (18590).
2. on an ubuntu hardy x86 system (cairo version 1.6.0). I tried the latest native 0.46-0ubuntu2 package

In all cases, pattern fills did not appear at all in the output (I used the builtin stripes 1:1 fill). Transparency was visible in Acrobat reader, but in kpdf and xpdf the transparent objects were completely invisible.

I've attached a test file together with its output in pdf/ps/eps formats.

Revision history for this message
In , Elvis Stansvik (elvstone) wrote :

I can reproduce this by creating a PDF with a gradient that has transparency in it using Scribus 1.3.3.11 running on Kubuntu Hardy and viewing it in either Okular 0.7 or KPDF 0.5.9.

It seems it adds one stripe for each span between gradient points that are transparent or something.

I'm attaching stripes-from-scribus-gradient.pdf which shows the issue.

Revision history for this message
In , Elvis Stansvik (elvstone) wrote :

Created an attachment (id=18078)
Rect with gradient from Scribus 1.3.3.11

Revision history for this message
Michelle Butler (gmichellebutler) wrote :

Is there any news on a bugfix for this issue (seeing that it's already September)?. Would just like to know...

Revision history for this message
Tormod Volden (tormodvolden) wrote :

It seems to be no progress on it upstream (and same problem in Intrepid with inkscape 0.46-2ubuntu1 and libcairo2 1.7.4-0ubuntu1).

Revision history for this message
mahfiaz (mahfiaz) wrote :

Tormodo Volden, the Intrepid version is latest stable 0.46. To test SVN version (the one which is "upstream") follow guide at http://www.inkscape.org/wiki/index.php/CompilingUbuntu

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Thanks, I think anyway the problem is in cairo, and there's no recent activity on the upstream bug nor in the other bug referenced in the first.

Revision history for this message
Mark Chernev (mchernev) wrote :

As of the Inkscape in svn both patterns and gradients seem to be exported correctly to PDF.

However, please note that you may need to use acroread to view the PDFs, since other PDF viewers may not be capable of viewing these files.

For example, a PDF viewer called evince uses the poppler library to for its PDF capability, and poppler had a bug that won't let it render text with a pattern:

https://bugs.freedesktop.org/show_bug.cgi?id=14577

Any other PDF viewers that use poppler will have this problem.

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Thanks for the news. Do you have any pointer to the changes that fixed this issue in Inkscape? If these changes can be backported to the stable version, it would be very valuable for Intrepid.

Changed in cairo:
importance: Undecided → Low
status: New → Triaged
Revision history for this message
In , Tfc-duke-gmail (tfc-duke-gmail) wrote :

*** Bug 19831 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Tfc-duke-gmail (tfc-duke-gmail) wrote :

*** Bug 18025 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Tfc-duke-gmail (tfc-duke-gmail) wrote :

*** Bug 16235 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Tfc-duke-gmail (tfc-duke-gmail) wrote :

*** Bug 15501 has been marked as a duplicate of this bug. ***

Revision history for this message
Kjohrf (kjohrf) wrote :

I too am running into problems saving as PDF files with gradients. I spent two evenings tracking to problem to gradients (a basic feature of Inkscape, no?). I am only using PDF because other bugs prevent direct printing of my SVG file. Now I can't print via PDF either. That led me to find this bug report. Many hours and hours wasted, so please consider this a high priority bug. Thanks!

Revision history for this message
Kjohrf (kjohrf) wrote :

I should be clearer. When I save my file (reduced to a simple design) to a PDF file, if it has a gradient, and I open it in Acrobat Reader, then Reader HANGS. I cannot view or print the PDF from Inkscape.

Revision history for this message
Kjohrf (kjohrf) wrote :

More info:

Inkscape 0.46
WinXP
Acrobat Reader 8.1.3

Revision history for this message
jean-denis DECHET (jeandenis-dechet) wrote : RE: [Bug 168610] Re: Exporting patterns and gradients doesn't work forPDF / EMF

Sorry, I have not seen the previous bug report
On other hand I am a bit surprise, when I use gradients i.e. colour continuously from red to yellow for example (sorry I'm French, and my English is not 100% OK)
I have no problem to save it in .pdf and to print from the pdf file, or to print from the svg file. (here attached an example)
Problem only with pattern (Stripe / Dot and so on)
I use Windows XP professional, adobe 8 and INKSCAPE .46

Thank you for your hard work, it's great!

___________________________________

Jean-Denis Dechet
technico-commercial
inner sales
ABS FRANCE

296 Av PASTEUR
33185 LE HAILLAN

Tel +33 5 57 92 35 40
Fax +33 5 56 34 41 46
e-mail : <email address hidden>

Visit us at www.absgroup.com

___________________________________
Afin de contribuer au respect de l'environnement, merci de n'imprimer ce mail qu'en cas de nécessité.

-----Message d'origine-----
De : <email address hidden> [mailto:<email address hidden>] De la part de Kjohrf
Envoyé : mercredi 22 avril 2009 03:53
À : Dechet, Jean Denis
Objet : [Bug 168610] Re: Exporting patterns and gradients doesn't work forPDF / EMF

I too am running into problems saving as PDF files with gradients. I
spent two evenings tracking to problem to gradients (a basic feature of
Inkscape, no?). I am only using PDF because other bugs prevent direct
printing of my SVG file. Now I can't print via PDF either. That led me
to find this bug report. Many hours and hours wasted, so please
consider this a high priority bug. Thanks!

--
Exporting patterns and gradients doesn't work for PDF / EMF
https://bugs.launchpad.net/bugs/168610
You received this bug notification because you are a direct subscriber
of a duplicate bug.

Status in Inkscape: A Vector Drawing Tool: Confirmed
Status in Poppler: Confirmed
Status in "cairo" source package in Ubuntu: Triaged

Bug description:
Create a pattern in Inkscape.
 Fill a shape with it
 Save the file as PDF or EMF
 The pattern doesn't show up in the resulting file.

 See attached SVG for an example.

Revision history for this message
jazzynico (jazzynico) wrote :

The pattern bug seems to be fixed in the last Inkscape dev builds (tried with 21203, Ubuntu, and a slightly older one on Windows XP).
The PDF shows the stripes as expected. I don't know if it's fixed in cairo or inkscape, but I suggest we consider (at least) the inkscape report as fix committed. Fell free to change it back to another status if you still have these issues with the dev builds.

Jean-Denis, could you please reply directly from the launchpad form. Replying by email adds lots of unnecessary text. Anyway thanks to it, I now know we're neighbors (my workplace is just about 10 km from yours...).

Mark, the exported PDF now works well with evince (which uses poppler 0.8.7 in my Ubuntu 8.10).

Changed in inkscape:
milestone: none → 0.47
status: Confirmed → Fix Committed
Revision history for this message
Kjohrf (kjohrf) wrote : Re: [Bug 168610] Re: Exporting patterns and gradients doesn't work forPDF / EMF
Download full text (3.2 KiB)

Thank you for the reply! If you work on Inkscape (or related)
development, thank you!
It is wonderful to work with, BUT most of my bigger project show bugs
and I cannot print correctly! This is so frustrating - it is so
close. I hope the bugs are fixed before more and more features are
added...

Regards,
Brad ("Kjohrf")

On Wed, Apr 22, 2009 at 10:24 AM, jean-denis DECHET
<email address hidden> wrote:
> Sorry, I have not seen the previous bug report
> On other hand I am a bit surprise, when I use gradients i.e. colour continuously from red to yellow for example (sorry I'm French, and my English is not 100% OK)
> I have no problem to save it in .pdf and to print from the pdf file, or to print from the svg file. (here attached an example)
> Problem only with pattern (Stripe / Dot and so on)
> I use Windows XP professional, adobe 8 and INKSCAPE .46
>
> Thank you for your hard work, it's great!
>
>
> ___________________________________
>
> Jean-Denis Dechet
> technico-commercial
> inner sales
> ABS FRANCE
>
> 296 Av PASTEUR
> 33185 LE HAILLAN
>
> Tel +33 5 57 92 35 40
> Fax +33 5 56 34 41 46
> e-mail : <email address hidden>
>
> Visit us at www.absgroup.com
>
> ___________________________________
> Afin de contribuer au respect de l'environnement, merci de n'imprimer ce mail qu'en cas de nécessité.
>
>
> -----Message d'origine-----
> De : <email address hidden> [mailto:<email address hidden>] De la part de Kjohrf
> Envoyé : mercredi 22 avril 2009 03:53
> À : Dechet, Jean Denis
> Objet : [Bug 168610] Re: Exporting patterns and gradients doesn't work forPDF / EMF
>
> I too am running into problems saving as PDF files with gradients.  I
> spent two evenings tracking to problem to gradients (a basic feature of
> Inkscape, no?).  I am only using PDF because other bugs prevent direct
> printing of my SVG file.  Now I can't print via PDF either.  That led me
> to find this bug report.  Many hours and hours wasted, so please
> consider this a high priority bug.  Thanks!
>
> --
> Exporting patterns and gradients doesn't work for PDF / EMF
> https://bugs.launchpad.net/bugs/168610
> You received this bug notification because you are a direct subscriber
> of a duplicate bug.
>
> Status in Inkscape: A Vector Drawing Tool: Confirmed
> Status in Poppler: Confirmed
> Status in "cairo" source package in Ubuntu: Triaged
>
> Bug description:
> Create a pattern in Inkscape.
>  Fill a shape with it
>  Save the file as PDF or EMF
>  The pattern doesn't show up in the resulting file.
>
>  See attached SVG for an example.
>
>
> ** Attachment added: "ESSAIS.svg"
>   http://launchpadlibrarian.net/25859432/ESSAIS.svg
>
> ** Attachment added: "ESSAIS.pdf"
>   http://launchpadlibrarian.net/25859433/ESSAIS.pdf
>
> --
> Exporting patterns and gradients doesn't work for PDF / EMF
> https://bugs.launchpad.net/bugs/168610
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in Inkscape: A Vector Drawing Tool: Confirmed
> Status in Poppler: Confirmed
> Status in “cairo” source package in Ubuntu: Triaged
>
> Bug description:
> Create a pattern in Inkscape.
>  Fill a shape with it
>  Save the file as PDF or EMF
>  The pat...

Read more...

Revision history for this message
In , Carlos Garcia Campos (carlosgc) wrote :

Created an attachment (id=26402)
Implement axialShadedFill() in cairo backend using cairo linear gradient patterns

 poppler/CairoOutputDev.cc | 297 +++++++++++++++++++++++++++++++++++++++++++++
 poppler/CairoOutputDev.h | 6 +
 2 files changed, 303 insertions(+), 0 deletions(-)

This patch implements linear gradients in cairo backend. I'm not a cairo guru so I'm not sure it's completely right, it fixes the problem with the first attachment.

Revision history for this message
In , Adrian Johnson (ajohnson-redneon) wrote :

(In reply to comment #15)
> Created an attachment (id=26402) [details]
> Implement axialShadedFill() in cairo backend using cairo linear gradient
> patterns
>
> poppler/CairoOutputDev.cc | 297 +++++++++++++++++++++++++++++++++++++++++++++
> poppler/CairoOutputDev.h | 6 +
> 2 files changed, 303 insertions(+), 0 deletions(-)
>
> This patch implements linear gradients in cairo backend. I'm not a cairo guru
> so I'm not sure it's completely right, it fixes the problem with the first
> attachment.
>

The use of cairo looks fine. Would it be better to avoid duplicating the bisection code from Gfx and instead add a new axial shading OutputDev function that provides the coordinates of each stop?

Revision history for this message
In , Albert Astals Cid (aacid) wrote :

Yeah man, duplicating the code is BAD

Why the current Gfx code is not enough for the Cairo backend?

Revision history for this message
In , Adrian Johnson (ajohnson-redneon) wrote :

(In reply to comment #16)
> (In reply to comment #15)
> > Created an attachment (id=26402) [details] [details]
> > Implement axialShadedFill() in cairo backend using cairo linear gradient
> > patterns
> >
> > poppler/CairoOutputDev.cc | 297 +++++++++++++++++++++++++++++++++++++++++++++
> > poppler/CairoOutputDev.h | 6 +
> > 2 files changed, 303 insertions(+), 0 deletions(-)
> >
> > This patch implements linear gradients in cairo backend. I'm not a cairo guru
> > so I'm not sure it's completely right, it fixes the problem with the first
> > attachment.
> >
>
> The use of cairo looks fine. Would it be better to avoid duplicating the
> bisection code from Gfx and instead add a new axial shading OutputDev function
> that provides the coordinates of each stop?
>

On closer inspection the use of cairo is less than ideal. It would be better to use the actual stops in the shading in the case of linear interpolation (Type 2 Exponential functions with N=1) and fallback to bisection for other cases. This would allow cairo to do the linear interpolation where possible.

Revision history for this message
In , Carlos Garcia Campos (carlosgc) wrote :

(In reply to comment #16)
>
> The use of cairo looks fine. Would it be better to avoid duplicating the
> bisection code from Gfx and instead add a new axial shading OutputDev function
> that provides the coordinates of each stop?
>

yes, sure, this patch is just a quick hack to see whether it works. I'll rework the patch and try to implement radial gradients too.

Revision history for this message
In , Carlos Garcia Campos (carlosgc) wrote :

(In reply to comment #17)
> Why the current Gfx code is not enough for the Cairo backend?
>

I don't know exactly, but the thing is that it doesn't work, see comment #6. Here is a screenshot showing the difference:

http://people.freedesktop.org/~carlosgc/poppler-cairo-patterns.png

The evince window is using poppler without the patch while the glib demo is using the patch.

Revision history for this message
In , Adrian Johnson (ajohnson-redneon) wrote :

(In reply to comment #17)
> Yeah man, duplicating the code is BAD
>
> Why the current Gfx code is not enough for the Cairo backend?
>

Cairo does a poor job of drawing adjacent polygons due to the antialising causing visible seams. I am not aware of any easy fix.

It is a useful optimization for all backends that can natively draw gradients to be able to get a list of gradient stops to draw the gradient instead of drawing a very large number of solid fills.

Revision history for this message
In , Carlos Garcia Campos (carlosgc) wrote :

Created an attachment (id=26432)
Implement axial/radial ShadedFill in cairo backend using cairo gradients

 poppler/CairoOutputDev.cc | 34 ++++++++++++++++++
 poppler/CairoOutputDev.h | 8 ++++
 poppler/Gfx.cc | 86 ++++++++++++++++++++++++++++++++-------------
 poppler/OutputDev.h | 1 +
 4 files changed, 104 insertions(+), 25 deletions(-)

This patch removes duplicated code and implements radial gradients too.

Revision history for this message
In , Carlos Garcia Campos (carlosgc) wrote :

*** Bug 4330 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Adrian Johnson (ajohnson-redneon) wrote :
Revision history for this message
In , Albert Astals Cid (aacid) wrote :

You mean they fail with new patch or failed with old patch work with new one?

Both work on Splash BTW

Also

@@ -2751,12 +2763,13 @@ void Gfx::doRadialShFill(GfxRadialShading *shading) {
   ya = y0 + sa * (y1 - y0);
   ra = r0 + sa * (r1 - r0);
   if (ta < t0) {
- shading->getColor(t0, &colorA);
+ tt = t0;
   } else if (ta > t1) {
- shading->getColor(t1, &colorA);
+ tt = t1;
   } else {
- shading->getColor(ta, &colorA);
+ tt = ta;
   }
+ shading->getColor(tt, &colorA);

   // fill the circles
   while (ia < radialMaxSplits) {

looks like an unneeded change

Revision history for this message
In , Carlos Garcia Campos (carlosgc) wrote :

(In reply to comment #25)
> You mean they fail with new patch or failed with old patch work with new one?

yes, they don't work with the patch.

> Both work on Splash BTW

sure

> Also
>
> @@ -2751,12 +2763,13 @@ void Gfx::doRadialShFill(GfxRadialShading *shading) {
> ya = y0 + sa * (y1 - y0);
> ra = r0 + sa * (r1 - r0);
> if (ta < t0) {
> - shading->getColor(t0, &colorA);
> + tt = t0;
> } else if (ta > t1) {
> - shading->getColor(t1, &colorA);
> + tt = t1;
> } else {
> - shading->getColor(ta, &colorA);
> + tt = ta;
> }
> + shading->getColor(tt, &colorA);
>
> // fill the circles
> while (ia < radialMaxSplits) {
>
> looks like an unneeded change
>

tt is used again below, without this change I would have to check again if ta < t1 or ta > t1, and so on.

I think the problem with the patch is the offset calculation for cairo_pattern_add_color_stop but I don't know how to do it right yet.

Revision history for this message
In , Carlos Garcia Campos (carlosgc) wrote :

Created an attachment (id=26583)
Implement axialShadedFill in cairo backend using cairo gradients

I only managed to fix linear patterns (thanks to adrianj), so this patch contains only the implementation of axialShadedFill.

Albert, ok to push this one?

Revision history for this message
In , Carlos Garcia Campos (carlosgc) wrote :

Created an attachment (id=26589)
Attempt to implement radial patterns

Following the same approach than previous patch I've tried to implement radial patterns, but it still doesn't work with the test case provided by Adrian

Revision history for this message
In , Albert Astals Cid (aacid) wrote :

I'd say this can break PSOutputDev, PSOutputDev::axialShadedFill also returns false in some cases and i'd bet it needs the calls to updateFillColor, fill etc. in this cases to get a correct output, but that would not happen in your case.

Can you please check?

Revision history for this message
In , Carlos Garcia Campos (carlosgc) wrote :

sure, I thought no other backed implemented shaded fills :-( I forgot PSOutputdev.

Revision history for this message
Primoz Princic (primoz-princic) wrote :

Just stumbled upon this bug. I would only add that my first try was to print the document with pattern. Unfortunately only background color of the document was printed (red background with vhite stripes 1:1). After several tries to get my drawing somehow to output, I did it by exporting page to PNG format. PDF exort did the same, also printing to PDF using external PDF printer (PDF creator)
Printing patterns does not work for me. Using Inkscape 0,46 on windows. (XP/VIsta)

Revision history for this message
jean-denis DECHET (jeandenis-dechet) wrote :

I agree with you, we could export the drawing as a bitmap, and then print it or save it as a pdf file using pdf995 or Inkscape, but this is not usefull for technical drawing that we intend to modify later on, lines are no longer modified by the path tool, and I try (but uncessfully) to export it in .dxf for example.
may be I use Inkscape in a special way.

Revision history for this message
In , Carlos Garcia Campos (carlosgc) wrote :

Created an attachment (id=27495)
Implement axialShadedFill in cairo backend using cairo gradients

I've added a method useFillColorStop() specific to decide whether to use updateFillColorStop or not, instead of using useShadedFills().

Revision history for this message
In , Carlos Garcia Campos (carlosgc) wrote :

(In reply to comment #31)
> Created an attachment (id=27495) [details]
> Implement axialShadedFill in cairo backend using cairo gradients

applied to git master :-)

Revision history for this message
In , Carlos Garcia Campos (carlosgc) wrote :

Created an attachment (id=28167)
Radial gradients using cairo

This is an updated patch to implement radial gradients using cairo.

Revision history for this message
In , Albert Astals Cid (aacid) wrote :

Forgot to update radialShadedFill in PSOutputDev

Revision history for this message
In , Carlos Garcia Campos (carlosgc) wrote :

Fixed in git master.

Changed in poppler:
status: Confirmed → Fix Released
Revision history for this message
Kjohrf (kjohrf) wrote :

Not sure what the current status of the gradient / PDF problem is, but I just ran into it again. I have a simple test case that when saved as PDF will hang Adobe Reader. I'm on Win XP running 0.47pre4.

My PDF save settings are:

  Convert text: NO
  Rasterize filter effects: YES
  Resolution: 300
  Export area is drawing: NO
  Export area is page: YES

Revision history for this message
su_v (suv-lp) wrote :

Not reproduced with Inkscape 0.46+devel r22540 on OS X 10.5.8 (cairo 1.8.8)
OS X native PDF viewer has no problems with the exported PDF file.

You could try and cleanup the <defs> section first ('File > Vaccum Defs') and remove all empty (flow) text elements (look at the SVG file with Firefox: all black boxes are empty flowText boxes) in the XML Editor. Save SVG and then as PDF again.

I'm attaching the PDF file of the cleaned-up version, could you test if it still crashes Adobe Reader?

Revision history for this message
Kjohrf (kjohrf) wrote :

Adobe Reader refulses to open your test PDF file. I just upgraded to the latest version of Reader this morning. Thanks for looking at this.

Revision history for this message
su_v (suv-lp) wrote :

I don't have any Adobe software installed to test the file. Besides Apple's 'Preview.app' I have tested '168610-Dart-LeWitt-3.pdf ' with gs (Ghostscript 8.70) and gv (3.6.7): both load and display the file without any error messages or rendering bugs.

Can someone else test & confirm whether this is an issue related to AR and/or win32 only?

Revision history for this message
Pablo Trabajos (pajarico) wrote :

suv: hope this is what you asked for, because I don't have time to read the whole thread. I've Acrobat Pro v9 and the file refuses to open (it crashes). Foxit opens it but is not rendered correctly (only a blank page with small gray stain).

Revision history for this message
su_v (suv-lp) wrote :

@Pablo - yes, thanks for testing. Foxit renders the file correctly - it only contains a tiny gray dart with a gradient.
This seems to have turned into an AR problem only. Should it go into a new, separate bug?

Revision history for this message
Kjohrf (kjohrf) wrote :

Thanks for checking. Appreciate the work on this and other bugs!

Revision history for this message
Adrian Johnson (ajohnson-redneon) wrote :

I've reported the AR freezing problem to Adobe.

Looking at the PDF file there are 2535 gradient stops while the SVG only has about 30 stops. The explosion in the number of gradient stops looks like an Inkscape bug.

Revision history for this message
su_v (suv-lp) wrote :

Re-opening the PDF file in Inkscape and saving as SVG gives a similar result:

LeWitt:bug suv$ grep 'id="stop' 168610-Dart-LeWitt-3-pdf-reimported.svg | wc -l
    2537
LeWitt:bug suv$ grep 'stop-color' 168610-Dart-LeWitt-3-pdf-reimported.svg |wc -l
    2537
LeWitt:bug suv$ grep 'stop-color' 168610-Dart-LeWitt-3-pdf-reimported.svg | sort | uniq
         style="stop-opacity:1;stop-color:#636363"
         style="stop-opacity:1;stop-color:#bbbbbb"
LeWitt:bug suv$ grep 'spreadMethod' 168610-Dart-LeWitt-3-pdf-reimported.svg
LeWitt:bug suv$

The original SVG has:

LeWitt:bug suv$ grep 'id="stop' 168610-Dart-LeWitt.svg | wc -l
       3
LeWitt:bug suv$ grep 'stop-color' 168610-Dart-LeWitt.svg | wc -l
       3
LeWitt:bug suv$ grep 'stop-color' 168610-Dart-LeWitt.svg | sort | uniq
         style="stop-color:#636363;stop-opacity:1;" />
         style="stop-color:#a1a1a1;stop-opacity:1;"
         style="stop-color:#bbbbbb;stop-opacity:1;" />
LeWitt:bug suv$ grep 'spreadMethod' 168610-Dart-LeWitt.svg
       spreadMethod="reflect"

Revision history for this message
su_v (suv-lp) wrote :

both spreadMethods 'reflect' and 'repeat' (in Inkscape 'Repeat: reflect' and 'Repeat: direct') produce an increased number of stops and overall greater distance between start and end stop on export to PDF. Only spreadMethod 'pad' (in Inkscape 'Repeat: none') keeps the the same number of stops on export to PDF and is correctly rendered after re-import to Inkscape.

The gradient in each exported PDF is visually rendered the same way as in Inkscape (PDF Viewer: Apple Preview).

(testcase: square with gradient from blue to red, 2 stops, no transparency, Inkscape r22544, cairo 1.8.8)

Revision history for this message
Kjohrf (kjohrf) wrote :

suv - So are you saying Inkscape is or is not doing something wrong?

Revision history for this message
su_v (suv-lp) wrote :

@Khorf - it looks like gradients with 'repeat' settings other than 'none' are exported in a way that lets Adobe Reader crash. That's a bug in AR (even if the PDF is bad it shouldn't crash) that Adrian has reported to Adobe. You could confirm that it is limited to 'reflect' or 'direct' by recreating the dart gradient without 'Repeat: reflect' but with several stops that simulate the 'reflect' effect and testing if AR still crashes when opening the new PDF (or by trying to open the three PDFs included in my previous attachment with AR).

Other than that I'm not expert enough to determine what causes the issue - I don't know the PDF file format (how it defines reflected or repeated linear gradients) and I trust Adrian if he says it looks like a bug in Inkscape.

[ side note: I'm unsure whether this is a new issue and should better be filed separately or if it warrants to re-open this report (which was from the beginning a mixed bag of pattern and gradient issues?). Personally I would have filed a new one I guess, because it looks like it's limited to the export of two types of linear gradients, independent of transparency issues or other known difficulties with PDF export. Of course this is an assumption I can't verify without having Adobe software installed - but if AR would crash on every PDF with gradients created by Inkscape, I'd assume the bug tracker would be 'flooded' with duplicate reports?

Could some else from the Bug Team have a closer look at this? ]

Revision history for this message
Adrian Johnson (ajohnson-redneon) wrote :

I used cairo-trace while converting Dart.svg to pdf and can confirm the huge number of stops is caused by cairo. It is the reflect that is causing it. I need to find a more optimal way to make cairo repeat/reflect gradients.

I highly recommend using the cairo-trace tool when debugging cairo export problems.

For example:

cairo-trace inkscape -A Dart.pdf Dart.svg

then open the inkscape.nnnnn.trace file to see all the calls to cairo. There are only 3 calls to cairo_pattern_add_color_stop_rgba().

Revision history for this message
su_v (suv-lp) wrote :

@Adrian - I have cairo 1.8.8 installed via MacPorts - AFAIU it doesn't include cairo-trace. I will try if I can install 'cairo-devel @1.9.2' and get Inkscape to build with the newer dev version.

Revision history for this message
Adrian Johnson (ajohnson-redneon) wrote :

There are some bugs in 1.9.2 (and in 1.9.4 which was released 2 weeks ago) but for the purpose of getting a cairo-trace it should work.

Revision history for this message
su_v (suv-lp) wrote :

@Adrian - I installed 1.9.2 but cairo-trace doesn't get built on OS X. It looks like cairo-bug 23864 "Enable cairo-trace on Mac" needs to be solved first (I had hoped to trace a sample file from bug #388257 to be sure it's an Inkscape bug).

ScislaC (scislac)
Changed in inkscape:
status: Fix Committed → Fix Released
Revision history for this message
Filip van Laenen (f-a-vanlaenen) wrote :

I wonder whether this bug has been fixed completely. I use Inkscape 0.47 on Ubuntu 9.10, and I still have problems exporting patterns and gradients to PDF in Inkscape (and using rsvg-convert). In particular, I have a problem when I use the pattern or gradient in the stroke attribute, not in the fill attribute. Things are fine when I export to PNG though.

Revision history for this message
su_v (suv-lp) wrote :

The issue with reflected gradients turned out to be the cause of a recently filed bug report (not yet verified with cairo-trace, but after changing all gradients from 'Repeat: reflect' to 'Repeat: none' the SVG file exports to PDF without issues):

Bug #511791 “PDF export fails with reflected gradients”
<https://bugs.launchpad.net/inkscape/+bug/511791>

Revision history for this message
adrianbj (adrianbjones) wrote :

Thought some of my observations might be useful to this discussion.

I have been using Inkscape and also rsvg-convert in an attempt to convert a few thousand SVGs to PDF.

When I open certain PDFs 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 if I convert the SVG to PDF 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.

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/rsvg-convert/cairo 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

Revision history for this message
Adrien Cordonnier (adrien-cordonnier) wrote :

About exporting gradients to EMF files, it does not seem to be implemented in Inkscape. According to Microsoft specifications, it is possible to use gradient with both EMF and EMF+.

EMF specification: http://msdn.microsoft.com/en-us/library/cc230514(PROT.10).aspx (see also pdf at the top of the page)
EMF+ specification: http://msdn.microsoft.com/en-us/library/cc230826(PROT.13).aspx (see also pdf at the top of the page)

Changed in poppler:
importance: Unknown → Medium
Changed in poppler:
importance: Medium → Unknown
Changed in poppler:
importance: Unknown → Medium
Revision history for this message
David Catmull (uncommon-z) wrote :

Is this supposed to be fixed in Inkscape 0.47? I'm seeing it in 0.48.

Revision history for this message
Daniel J Blueman (watchmaker) wrote :

When importing a PDF with inkscape 0.48.4, cairo 1.12.2 and poppler 0.20.5 (Ubuntu 12.10 with these upgraded packages), I am still seeing gradients being incorrectly imported.

Revision history for this message
Daniel J Blueman (watchmaker) wrote :

Evince correctly displays this and other PDFs that have gradients that fail to import correctly into inkscape, so the remaining issue looks like it's not with poppler (which evince uses).

Revision history for this message
Daniel J Blueman (watchmaker) wrote :

It turns out this has been fixed in the trunk version of inkscape:
https://bugs.launchpad.net/inkscape/+bug/530895

Installing inkscape-trunk fixed the issue:
https://launchpad.net/~inkscape.dev/+archive/trunk

Revision history for this message
Ramiro (ramirovelazco) wrote :

I have this issue with Inkscape 0.91pre2 r13516
some times pattern displays incorrectly in pdf, sometimes not at all.
tried with pdf reader and sumatra pdf on windows 7.

Revision history for this message
Sebastien Bacher (seb128) wrote :

That bug should be fixed so closing it, if you still see issues please open a new report that's going to be easier to handle

Changed in cairo (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.