0

I created a PDF file using the PyX Python package, showing a black stroked rectangle filled in red. When I preview the PDF file using Evince it looks as expected (Evince screenshot). However when I preview it using Ghostscript either the fill does not extend to the bottom of the rectangle or the bottom line is too thick (Ghostscript screenshot). Why might this be, please?

If I omit the black outline or omit the red fill then Ghostscript previews the image correctly. I'm using PyX 0.15, Python 3.8.6, Ghostscript 9.52 and Evince 3.38.0 under Ubuntu 20.10.

Here's my Python code:

#!/usr/bin/env python3
import pyx
canvas = pyx.canvas.canvas()
canvas.draw(pyx.path.rect(2, 1, .5, 8),
            [pyx.deco.stroked(),
             pyx.deco.filled([pyx.color.rgb(1, 0, 0)]),
             pyx.style.linewidth(0.05)])
page = pyx.document.page(canvas, paperformat = pyx.document.paperformat(10, 10))
doc = pyx.document.document([page])
doc.writePDFfile('rectangle.pdf')
  • Maybe a ghostscript bug?! Trying to reproduce using the compiled version 9.52 from https://github.com/ArtifexSoftware/ghostpdl-downloads/releases ... unfortunately it has no x11 device, so I render it to png by `gs-952-linux-x86_64 -sDEVICE=png16m -orectangle.png rectangle.pdf` and it does not show the artifact. – wobsta Jan 20 '21 at 10:59
  • With my version of Ghostscript, using -sDEVICE=pngalpha shows the artifact but -sDEVICE=png16m does not. Perhaps this supports the suggestion that it's a Ghostscript bug. Thanks for checking. – Thomas Bending Jan 20 '21 at 19:20
  • I could reproduce, that is happens for the output device pngalpha, but not for png16m. However, using ghostscript from my distribution, which happens to be 9.27 (debian 10), it does not show the artifact even for pngalpha. In addition, when using the latest release 9.53.3, downloaded the same as my test with 9.52, the problem is resolved as well. So seems some bug in some of the ghostscript releases, which is already resolved upstream. – wobsta Jan 21 '21 at 06:16

1 Answers1

0

Using Ghostscript 9.53.3 solves the problem for me, so as @wobsta says I'm going to assume that this was a Ghostscript bug which has been fixed.