Bug 688542

Summary: Bookmarks Get Lost In PDF
Product: Ghostscript Reporter: Jeffrey Gruda <jdgruda>
Component: PDF InterpreterAssignee: Ken Sharp <ken.sharp>
Status: RESOLVED FIXED    
Severity: normal CC: alex, htl10, Robert_Hartmann
Priority: P4    
Version: 8.50   
Hardware: HP   
OS: Linux   
Customer: Word Size: ---
Bug Depends on: 688829    
Bug Blocks:    
Attachments: first file in pdf
first file in ps
second file in pdf
second file in ps
results 1
results 2
pdfmarkhook.ps
pdfmarkhook.stdout.txt

Description Jeffrey Gruda 2006-02-07 06:54:39 UTC
Sorry if this is not the way to go about this.

I am using the following command to combine files that have bookmarks in them.
gs -dBATCH -sDEVICE=pdfwrite -dNOPAUSE -sOUTPUTFILE=junk2.pdf temp.pdf temp.pdf
The bookmarks get corrupted.  

If I use the following:
gs -dBATCH -sDEVICE=pdfwrite -dNOPAUSE -sOUTPUTFILE=junk2.pdf temp.ps temp.ps
The bookmarks work.
Comment 1 Alex Cherepanov 2006-02-07 09:32:12 UTC
Please attach the sample files. Although the problem looks general enough to be
reproducible with any files we cannot be sure that the problem you report is
fixed without your sample files.
Comment 2 Jeffrey Gruda 2006-02-07 10:21:02 UTC
Created attachment 2005 [details]
first file in pdf
Comment 3 Jeffrey Gruda 2006-02-07 10:21:30 UTC
Created attachment 2006 [details]
first file in ps
Comment 4 Jeffrey Gruda 2006-02-07 10:22:06 UTC
Created attachment 2007 [details]
second file in pdf
Comment 5 Jeffrey Gruda 2006-02-07 10:22:46 UTC
Created attachment 2008 [details]
second file in ps
Comment 6 Jeffrey Gruda 2006-02-07 10:23:38 UTC
Created attachment 2009 [details]
results 1

results of using

gs -dBATCH -sDEVICE=pdfwrite -dNOPAUSE -sOUTPUTFILE=try1.pdf graph_results.ps
processor_compare.ps
Comment 7 Jeffrey Gruda 2006-02-07 10:24:14 UTC
Created attachment 2010 [details]
results 2

Results of using

gs -dBATCH -sDEVICE=pdfwrite -dNOPAUSE -sOUTPUTFILE=try2.pdf graph_results.pdf
processor_compare.pdf
Comment 8 Jeffrey Gruda 2006-02-07 10:25:12 UTC
All,
I have attached all the files.  Here are the two commands I used.

gs -dBATCH -sDEVICE=pdfwrite -dNOPAUSE -sOUTPUTFILE=try1.pdf graph_results.ps 
processor_compare.ps

gs -dBATCH -sDEVICE=pdfwrite -dNOPAUSE -sOUTPUTFILE=try2.pdf graph_results.pdf 
processor_compare.pdf
Comment 9 leonardo 2006-02-10 03:06:29 UTC
This is a PDF interpreter problem. Then 2 or more PDFs are concatenated, the 
PDF interpreter sends pdfmark commands to the PS interpreter. Doing so it uses 
page numbers through current document. It must either use global page numbers 
through the document set, or associate them with current page (and issue in the 
appropriate moment).

Note that when PSs are concatenated (maybe with PDFs), if the PS files issue 
pdfmark with local page numbers, they should be replaced with globals.

Passing the bug to Dan who handles the PDF interpreter.
Comment 10 leonardo 2006-02-10 03:53:55 UTC
Created attachment 2023 [details]
pdfmarkhook.ps

A hook for studying pdfmark structure in documents. Execute it before running a
document.
Comment 11 leonardo 2006-02-10 03:56:01 UTC
Created attachment 2024 [details]
pdfmarkhook.stdout.txt

The pdfmark trace logged when running the 2 PDFs.
Comment 12 Jeffrey Gruda 2006-02-13 05:10:41 UTC
All,
Sorry for not understanding where this is.  It appears from your emails that 
it is a bug.  Does anyone know if there is a workaround?  I tried converting 
the pdf to ps and then combining but that did not work either.
Thanks.
Comment 13 Henry Stiles 2008-02-26 10:31:51 UTC
back to support for dispatch.
Comment 14 Ray Johnston 2008-08-21 13:45:38 UTC
Assigning to Alex as a PDF interp issue
Comment 15 Hin-Tak Leung 2009-01-19 22:39:55 UTC
Hmm, it seems that "ps then ps" and "pdf then ps" already work, and 
"pdf then pdf" is covered by the patch in bug 688829 .


The one case that still doesn't work after the patch for bug 688829  is "ps then
pdf". While it would be nice that "ps then pdf" works, is fixing bug 688829
considered "good enough"? There is some ambiguity in what the reporter wants -
is it for merging pdfs or any arbitrary mixture of ps+pdf in any order?
Comment 16 Hin-Tak Leung 2009-01-19 22:46:14 UTC
There is another ambiguity - the two result pdfs also differ by default view
(i.e. whether to show bookmarks on open). I think not making any effort copying
the default view might be also considered a small bug. 

(there is already a bug filed by somebody for not copying metadata of pdf's)
Comment 17 Ken Sharp 2013-08-07 05:19:46 UTC
commit 073f460af5bb37edb1849c5d6235048598100437 resolves this problem for me. Please see the commit log for more information.