Bug 696838

Summary: Preserve /Dests when not named
Product: Ghostscript Reporter: klo <klonuo>
Component: PDF InterpreterAssignee: Ken Sharp <ken.sharp>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P4    
Version: 9.19   
Hardware: PC   
OS: Windows NT   
Customer: Word Size: ---
Attachments: 2 pdf samples

Description klo 2016-06-14 10:49:12 UTC
Created attachment 12600 [details]
2 pdf samples

When I process some pdf files with gs, bookmarks get lost.

I noticed this behavior for all files published by Apress, and for some Springer books. I'm attaching 2 examples.

Regardless if these bookmarks does not follow pdf standards, they work in any viewer (including mupdf) so please provide option to preserve bookmarks as is.


Thanks
Comment 1 Ken Sharp 2016-06-14 11:32:32 UTC
OK the first thin to be clear on is that the pdfwrite debice is not intended as a general purpose PDF manipulation tool. Its intended purpose is to create a PDF file which has the same visual appearance as the input (in whatever format), any additional extras are a bonus. This includes metadata of all sorts.

Now, smaller examples would be helpful here, 268 pages and 9 MB for the first one, 158 or so and 11 MB for the second...... If I really have to wade through all that its going to take weeks.

Can you possibly find an example with two pages ?

Also, what command line are you using ?
Comment 2 klo 2016-06-14 12:40:20 UTC
(In reply to Ken Sharp from comment #1)
> Now, smaller examples would be helpful here, 268 pages and 9 MB for the
> first one, 158 or so and 11 MB for the second...... If I really have to wade
> through all that its going to take weeks.
> 
> Can you possibly find an example with two pages ?
> 
> Also, what command line are you using ?


I can not find example with 2 pages. I can find book with least pages published by Apress, if that helps.


I used this command:

gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -sOutputFile=out.pdf in.pdf
Comment 3 Ken Sharp 2016-06-15 00:42:33 UTC
So, the title here is misleading. Ghostscript does not 'wipe bookmarks'. However, while processing the file a number of warnings are issued, indicating that some outlines (and link annotations) could not be processed. The resulting file *does* have Outlines, but many are missing.

The PDF interpreter (not the pdfwrite output device) only handles named destinations, this file uses a different form of the Dest syntax which the PDF interpreter does not handle. Since the PDF interpreter discards these, naturally they are not present in the output. Obviously this is only going to affect PDF output, not rendering.

As I mentioned in comment #1, the goal of he pdfwrite device is to reproduce the visual appearance of the output, which it does do, and anything else is a secondary target at best.

Altering to an enhancement, as this is a missing feature, not a bug.
Comment 4 Ken Sharp 2016-06-21 06:43:29 UTC
Commit b4fc7327fa0c792a7b218610b86d9fa4533d3e0b resolves this.