Ghostscript removes links (regression from gs 9.18)

Bug #1806865 reported by Eberhard Beilharz on 2018-12-05
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ghostscript (Ubuntu)

Bug Description

I often reduce the size of pdf documents by running:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS="/default" -dNOPAUSE -dQUIET -dBATCH -sOutputFile="foo.pdf" "Document.pdf"

The latest ghostscript version 9.26 doesn't keep links in the pdf file and produces slightly larger pdf files compared to 9.18.

The size doesn't matter so much, but it's really bad that the links get removed.

The attached file GhostscriptBug.tar.bz2 contains four files:

- Scribus document with a link (PDF annotation)
- PDF file with a link, generated by Scribus
- foo9.26.pdf is the file resulting from running the above command with ghostscript 9.26 (-> links removed)
- foo9.18.pdf is the file resulting from running the above command with ghostscript 9.18 (-> links still there)

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: ghostscript 9.26~dfsg+0-0ubuntu0.16.04.1
ProcVersionSignature: Ubuntu 4.15.0-39.42~16.04.1-generic 4.15.18
Uname: Linux 4.15.0-39-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.18
Architecture: amd64
 E [05/Dec/2018:08:06:16 +0100] Unknown directive BrowseAddress on line 26 of /etc/cups/cupsd.conf.
 E [05/Dec/2018:08:06:16 +0100] Missing value on line 3543 of /var/cache/cups/job.cache.
CurrentDesktop: Unity
Date: Wed Dec 5 12:20:41 2018
InstallationDate: Installed on 2011-05-25 (2751 days ago)
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release amd64 (20110426)
 device for KyoceraTASKalfa356ci: socket://
 device for PDF: cups-pdf:/
MachineType: Dell Inc. Precision Tower 3620
Papersize: letter
 Error: command ['fgrep', '-H', '*NickName', '/etc/cups/ppd/PDF.ppd', '/etc/cups/ppd/KyoceraTASKalfa356ci.ppd'] failed with exit code 2: grep: /etc/cups/ppd/PDF.ppd: Permission denied
 grep: /etc/cups/ppd/KyoceraTASKalfa356ci.ppd: Permission denied
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-4.15.0-39-generic root=UUID=11d1e29d-6b9c-42d4-95ef-0c3bd947c636 ro quiet splash vt.handoff=7
SourcePackage: ghostscript
UpgradeStatus: No upgrade log present (probably fresh install) 12/11/2017
dmi.bios.vendor: Dell Inc.
dmi.bios.version: 2.6.1 0MWYPT
dmi.board.vendor: Dell Inc.
dmi.board.version: A01
dmi.chassis.type: 3
dmi.chassis.vendor: Dell Inc.
dmi.modalias: dmi:bvnDellInc.:bvr2.6.1:bd12/11/2017:svnDellInc.:pnPrecisionTower3620:pvr:rvnDellInc.:rn0MWYPT:rvrA01:cvnDellInc.:ct3:cvr: Precision Precision Tower 3620
dmi.sys.vendor: Dell Inc.

Same behaviour on bionic with 9.26

tags: added: bionic ghostscript
Marcel Partap (empee584) wrote :

TLDR fix: add `-dPrinted=false`

"This was a bug fix, the behaviour previously was incorrect, now it is as intended. The Annotations in your PDF file have no /Flags entry, in the absence of that, the default value (0) is used.

This means that bit 3 of the Flags value is 0, from the PDF Reference:

(PDF 1.2) If set, print the annotation when the page is printed. If clear, never print the annotation, regardless of whether it is displayed on the screen. This can be useful, for example, for annotations representing interactive pushbuttons, which would serve no meaningful purpose on the printed page. (See implementation note 83 in Appendix H.)

The default behaviour of the Ghostscript PDF interpreter is to be a printer. Since these annotations do not have any effect on a printer, they are dropped.

If you add to the command line -dPrinted=false then the PDF interpreter behaves as a display device instead. Because these annotations don't have NoView set, the PDF interpreter will process them, which means they will end up in the PDF file, when using pdffwrite."
from (Hyperlinks broken after conversion)

& several "duplicate" reports (PDF Anchor Links no longer working since version 25) (Clickable links lost when converting to pdf)

Yes, adding `-dPrinted=false` works. Thanks a lot!

Changed in ghostscript (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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