Bug 705996 - New PDF interpreter disables link jumping from table of contents
Summary: New PDF interpreter disables link jumping from table of contents
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: 9.56.1
Hardware: PC All
: P4 normal
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-19 12:39 UTC by Wim Deblauwe
Modified: 2022-10-24 09:39 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
Zip file with 3 PDFs using 10.0.0 (746.38 KB, application/zip)
2022-10-20 06:40 UTC, Wim Deblauwe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wim Deblauwe 2022-10-19 12:39:40 UTC
I am using Asciidoctor PDF to generate a PDF which has a table of contents. I can click on any entry in that table of contents to jump to the relevant page in the PDF.

Now, there is an option to have an "optimized PDF" which uses Ghostscript under the hood. Using GS 9.54.0, the optimized PDF still has the correct behaviour of supporting jumping from the table of contents to the relevant page.

However, with GS 9.56.1, this is no longer the case. When viewing the PDF (on macOS, but this was also the case with other viewers) the jump no longer works.

The command that is used is something like this:

```
gs -dNOPAUSE -dBATCH -dNOPAGEPROMPT -sDEVICE=pdfwrite -sOutputFile=optimized.pdf original.pdf
```

It seems we can work around it by using `-dNEWPDF=false` but that does trigger a warning. It would be nice if this could be fixed instead.
Comment 1 Ken Sharp 2022-10-19 12:51:12 UTC
(In reply to Wim Deblauwe from comment #0)

> The command that is used is something like this:
> 
> ```
> gs -dNOPAUSE -dBATCH -dNOPAGEPROMPT -sDEVICE=pdfwrite
> -sOutputFile=optimized.pdf original.pdf
> ```

That's great, but you haven't supplied us with an example file to look at, so it's impossible for us to verify the problem, investigate it, or fix it.

 
> It seems we can work around it by using `-dNEWPDF=false` but that does
> trigger a warning. It would be nice if this could be fixed instead.

I suggest you try 10.00.0 which is the current version. See also bug #705986 :

https://bugs.ghostscript.com/show_bug.cgi?id=705986

If 10.00.0 fails to resolve the problem for you then please reopen the bug report, and attach an example file to reproduce the issue.
Comment 2 Wim Deblauwe 2022-10-19 18:47:50 UTC
Thank you for your quick reply. Running version 10.0.0 indeed fixes the issue.
Comment 3 Wim Deblauwe 2022-10-19 19:16:42 UTC
I am sorry, it seems I spoke too soon. The test pdf I worked with started working with Ghostscript 10.0.0. However, my actual book still has the issue using that version.

Is there any way I can privately send my book? I have 3 PDF's: One is the original PDF (47 Mb) and then I have 2 versions created with 10.0.0. One using the new interpreter and one using the old interpreter (using the -dNEWPDF=false flag).

I would rather not put my book for free in this bugtracker if possible.
Comment 4 Wim Deblauwe 2022-10-20 06:40:06 UTC
Created attachment 23344 [details]
Zip file with 3 PDFs using 10.0.0

I have found a smaller test so I don't have to send my whole book.

The attachment has 3 pdf files:

1) test.pdf -> This is the source PDF, the links in the table of contents work
2) test-optimized-new.pdf -> This was generated using Ghostscript 10.0.0 on macOS using this command: `gs -dNOPAUSE -dBATCH -dQUIET -dNOPAGEPROMPT -sDEVICE=pdfwrite -sOutputFile=test-optimized-new.pdf test.pdf`. The links in the TOC are broken here.
3) test-optimized-old.pdf -> This was generated with the -dNEWPDF=false flag. The links in the TOC are working.

I hope this will help identify the problem.
Comment 5 Ken Sharp 2022-10-24 09:39:48 UTC
Fixed in commit 073c1adebeef38317ae0e6cb0f6d366ddaadb38a

Thanks for the report!