Created attachment 10899 [details] Input file Bug 693427 commit introduced support for GoToR action. Unfortunately now it works even worse. When output file is opened in Acrobat, bookmarks with GoToR action are not visible and on close Acrobat suggests to save the changes which usually means that file is broken and Acrobat corrected it somehow. When looked into output file invisible bookmarks with GoToR actions are inside. GS command is: gswin32c.exe -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH "-sOUTPUTFILE=Out.File1.pdf" -c "64000000 setvmthreshold" -f File1.pdf Included test files Regards Jacek Bator
Created attachment 10900 [details] GS output - broken file
When I open the file using Acrobat X Pro it doesn't complain, nor does it offer to save the file when I close it. (this is using the PDF file you have supplied as an attachment) When I open the bookmarks pane I see three bookmarks 'Main'->Heading 1 - File1.pdf - Heading 1.1 - File1.pdf Ghostscript doesn't complain about the PDF file when asked to re-interpret it either. So I'm unable to reproduce any problem here, which version of Acrobat are you using ?
(In reply to Ken Sharp from comment #2) > When I open the file using Acrobat X Pro it doesn't complain, nor does it > offer to save the file when I close it. (this is using the PDF file you have > supplied as an attachment) > > When I open the bookmarks pane I see three bookmarks 'Main'->Heading 1 - > File1.pdf - Heading 1.1 - File1.pdf > > Ghostscript doesn't complain about the PDF file when asked to re-interpret > it either. > > So I'm unable to reproduce any problem here, which version of Acrobat are > you using ? I'm using Acrobat Pro 7. Anyway there should be much more bookmarks than dose you listed ex. "Heading 1.2.1 - GoToR - File2.pdf", "Appendices - GoToR - File3.pdf" (check input file - File1.pdf) and missing bookmarks are inside output file but Acrobat is not displaying them.
My mistake. I included file fixed by Acrobat. Attaching another one.
Created attachment 10902 [details] GS output file
I don't know what I have changed but Acrobat it's no longer asking me for save. Anyway half of the bookmarks is missing in outout file.
Created attachment 10921 [details] Input.pdf - test file with one GoToR bookmark and one GoToR link inside text
Created attachment 10922 [details] Output.pdf Output.pdf is broken file - result of processing Input.pdf by GhostScript. Bookmark item is missing when viewing with Acrobat Pro 7.0 and Reader XI. Inside text link is missing action target information and it's not working. When closing file in Acrobat Pro 7.0 it asks to save changes. Some "Preflight" actions as one of errors indicates "Document is damaged" warning. "General file format error" Preflight indicates "General file format error" warning.
Invisible/broken bookmark in output file was formated following way: 6 0 obj << /F<< /Type /Filespec /F (File2.pdf) >> /Title(Link to File2.pdf) /Dest [4 0 R /XYZ 9 817 0] /Count 1 /Parent 5 0 R /Next 9 0 R /First 8 0 R /Last 8 0 R >> endobj When I have updated it to: 6 0 obj << /Title(Link to File2.pdf) /A<< /S/GoToR /D [9/XYZ 9 817 0.0] /F<< /Type /Filespec /F (File2.pdf) >> >> /Count 1 /Parent 5 0 R /Next 9 0 R /First 8 0 R /Last 8 0 R >> endobj it was displayed and worked correctly.
Commit 099657a962e716658f20658051c9692b439ecf2dfixes this for me.
It works perfectly against bookmark link. But for annotation link inside text, GoToR link information is lost and file is treated as damaged. GS emits following error message for it GPL Ghostscript GIT PRERELEASE 9.15: ERROR: A pdfmark destination page 45 points beyond the last page 1. which is not true because this is a page in another document. Input.pdf: 18 0 obj<</Rect[69.0003 751.92 173.251 767.67]/Subtype/Link/BS<</S/S/W 1/Type/Border>>/A 30 0 R/H/I/Border[0 0 1]/Type/Annot>> endobj ******[SOME PDF CODES]******** 30 0 obj<</D[44/FitR -115 -29 727 423]/F 31 0 R/S/GoToR>> endobj 31 0 obj<</F(File2.pdf)/Type/Filespec>> endobj Output.pdf: 5 0 obj <</Type/Annot /BS<< /S /S /W 1 /Type /Border >> /Rect [69.0003 751.92 173.251 767.67] /Border [0 0 1] /Dest [6 0 R /FitR -115 -29 727 423] /Subtype/Link>>endobj Should I create another ticket for it as it's not bookmark but annotation link?
(In reply to Jacek Bator from comment #11) > But for annotation link inside text, GoToR link information is lost and file > is treated as damaged. GS emits following error message for it Currently we are only supporting GoToR in Outlines (/OUT pdfamrks) > Should I create another ticket for it as it's not bookmark but annotation > link? Its a different problem, so......
Ok I'll create new bug ticket for this. I did some development on this so I'll also propose some patches. But lest got back to outlines. With proposed update there is slight problem with GoTo action. Produced pdf code seems to be working but it's not 100% correct. This is how outline is produced with this patch: 6 0 obj << /Title(First page) /Action/GoTo /Dest [4 0 R /FitH 242.0] /Parent 5 0 R /Next 7 0 R >> correct form is: 1) 6 0 obj << /Title(First page) /Dest [4 0 R /FitH 242.0] /Parent 5 0 R /Next 7 0 R >> or 2) 6 0 obj << /Title(First page) /A<</S/GoTo /D [4 0 R /FitH 242.0]>> /Parent 5 0 R /Next 7 0 R >> GS 9.14 produces 1) form but I guess right one should be 2) because it's copy form source file. The problem is in gdevpdfm.c in pdfmark_put_ao_pairs function. Comment on it says " * /Action /GoTo => drop the Action key" but key is not dropped. So we have 2 choices as above 1) drop action key for GoTo action (more space effective aproach) 2) treat GoTo same as GoToR which means "/Action /GoTo /File xxx /Dest yyy => /A << /S /GoTo /F xxx /D yyy' >>" and this way have action copy from input file. I can submit patch for it if you like.
(In reply to Jacek Bator from comment #13) > With proposed update there is slight problem with GoTo action. Produced pdf > code seems to be working but it's not 100% correct. This is how outline is > produced with this patch: In the absence of an example file, I'm forced to work by inspection, so its always possible things are incorrect. > > 6 0 obj > << /Title(First page) > /Action/GoTo > /Dest [4 0 R /FitH 242.0] > /Parent 5 0 R > /Next 7 0 R > >> > > correct form is: > > 1) > > 6 0 obj > << /Title(First page) > /Dest [4 0 R /FitH 242.0] > /Parent 5 0 R > /Next 7 0 R > >> Why is this correct ? There is now no Action. > > or > > 2) > > 6 0 obj > << /Title(First page) > /A<</S/GoTo > /D [4 0 R /FitH 242.0]>> > /Parent 5 0 R > /Next 7 0 R > >> > > GS 9.14 produces 1) form but I guess right one should be 2) because it's > copy form source file. There is never any copying going on, just reconsctruction, and its not the same as the source anyway. > So we have 2 choices as above > 1) drop action key for GoTo action (more space effective aproach) > 2) treat GoTo same as GoToR which means "/Action /GoTo /File xxx /Dest yyy > => /A << /S /GoTo /F xxx /D yyy' >>" and this way have action copy from > input file. > > I can submit patch for it if you like. I would rather you open a bug report for it and attach a file with an example. Please don't add anything further to this bug thread unless its directly related to GoToR in Outlines, and even then I'd probably prefer a new report, bug threads that sprawl over topics are very hard to follow in the future.