Bug 699874

Summary: ps2pdf removes links from PDF files
Product: Ghostscript Reporter: Vincent Lefevre <vincent-gs>
Component: PDF WriterAssignee: Ken Sharp <ken.sharp>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P4    
Version: 9.25   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---
Attachments: test.pdf

Description Vincent Lefevre 2018-10-04 10:58:21 UTC
Created attachment 15765 [details]
test.pdf

ps2pdf removes links from PDF files. This is a regression.

For instance, run

  ps2pdf test.pdf out.pdf

on the attached PDF file. The out.pdf file has no links.

The bug occurs with the Debian/unstable packages (ghostscript 9.25~dfsg-2), but I've also tested that it is reproducible with Ghostscript 9.25 for Linux x86 (64 bit) downloaded from https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs925/ghostscript-9.25-linux-x86_64.tgz and run in firejail after I copied the ps2pdf* scripts from ghostscript 9.20~dfsg-3.2+deb9u5 (hence making sure that the issue comes from gs and not from the scripts):

$ ll firejail-private/bin
total 20332
-rwxr-xr-x 1 vinc17 vinc17 20798682 2018-09-13 12:28:46 gs*
-rwxr-xr-x 1 vinc17 vinc17      272 2018-09-14 17:27:34 ps2pdf*
-rwxr-xr-x 1 vinc17 vinc17      215 2018-09-14 17:27:34 ps2pdf12*
-rwxr-xr-x 1 vinc17 vinc17      215 2018-09-14 17:27:34 ps2pdf13*
-rwxr-xr-x 1 vinc17 vinc17      215 2018-09-14 17:27:34 ps2pdf14*
-rwxr-xr-x 1 vinc17 vinc17     1097 2018-09-14 17:27:34 ps2pdfwr*
Comment 1 Ken Sharp 2018-10-04 11:08:22 UTC

*** This bug has been marked as a duplicate of bug 699830 ***
Comment 2 Vincent Lefevre 2018-10-04 12:36:13 UTC
In bug 699830, the user was using gs directly. Here, I'm using ps2pdf, which is described as a conversion tool:

  Convert PostScript to PDF using ghostscript

(actually, the description is a bit incorrect since it can take PDF files in input, not just PostScript files).

As a conversion tool, it should neither lose information, nor assume anything about what will be done with the PDF file. Thus -dPrinted=false should be passed to gs by the ps2pdfwr script.

If this is not intended to be a conversion tool, the description should be fixed.
Comment 3 Vincent Lefevre 2018-10-04 12:47:51 UTC
BTW, I don't know which component should be used for ps2pdf issues.
Comment 4 Ken Sharp 2018-10-04 12:50:36 UTC
(In reply to Vincent Lefevre from comment #2)
> In bug 699830, the user was using gs directly. Here, I'm using ps2pdf, which
> is described as a conversion tool:
> 
>   Convert PostScript to PDF using ghostscript
> 
> (actually, the description is a bit incorrect since it can take PDF files in
> input, not just PostScript files).

Ghostscript accepts both PostScript and PDF input. If you are going to be pernickity about the documentation then I will point out that it says it *converts* *PostScript* to PDF.

If you send it PDF as an input then you are outside the parameters of the description, and you aren't doing a conversion.

 
> As a conversion tool,

Which clearly isn't the way you are using it, since you started with a PDF file and ended up with a PDF file.


> it should neither lose information, nor assume
> anything about what will be done with the PDF file. Thus -dPrinted=false
> should be passed to gs by the ps2pdfwr script.

The bash script simply invokes Ghostscript, it is not magic. The PDF interpreter is where the Printed flag exists, and is used to control what the *interpreter* does with annotations. If the interpreter does not process the annotation, then the device will not see it.

You should read ghostpdl/doc/VectorDevice.htm, the Overview explains how this works.

*** This bug has been marked as a duplicate of bug 699830 ***