Bug 690253 - "pdfmake destination page" error while splitting a PDF: confusing output and invalid links.
"pdfmake destination page" error while splitting a PDF: confusing output and ...
Product: Ghostscript
Classification: Unclassified
Component: PDF Writer
PC Linux
: P4 enhancement
Assigned To: Ken Sharp
Bug traffic
Depends on:
  Show dependency treegraph
Reported: 2009-01-23 13:00 PST by drfloob
Modified: 2013-08-09 05:51 PDT (History)
0 users

See Also:
Word Size: ---

howto-doanddont.pdf (30.45 KB, application/pdf)
2009-01-23 13:02 PST, drfloob

Note You need to log in before you can comment on or make changes to this bug.
Description drfloob 2009-01-23 13:00:29 PST
While attempting to split a PDF in two using ghostscript, specifying
-dLastPage=N where N is smaller than document's last final page number, I
receive the error:

"GPL Ghostscript 8.62: ERROR: A pdfmark destination page M points
beyond the last page N."

where M is some destination page.

Specifically, I am trying to split any of the Python Documentation pdf's, and
this error occurs on all that I try.  The result, as best I can describe, is a
pdf document with some functional links & bookmarks, and others that do nothing.

The problem is that the Error output led me to believe that the process was
failing completely when it was not.  I was also not able to find any
documentation about this problem.

The enhancements I'd like to suggest are: 

A) that this be a (minimally) documented scenario, 

B) that the error output be more helpful (explaining that a semi-functional pdf
was created), and 

C) that the invalid links be removed from the output document (links not
hilighted or clickable in pdf viewers).

I will attach a small example pdf so you can test for yourself.  The full
command I am using is:

gs -dSAFER -dBATCH -sDEVICE=pdfwrite -DNOPAUSE -sPAPERSIZE=halfletter
-dFIXEDMEDIA -dEmbedAllFonts=true -sOutputFile=test.pdf -dLastPage=740
-dPDFFitPage howto-doanddont.pdf
Comment 1 drfloob 2009-01-23 13:02:28 PST
Created attachment 4757 [details]

This is a test file that produces the error.  It is from the official Python
Documentation at http://docs.python.org/
Comment 2 Ray Johnston 2009-01-29 09:53:26 PST
I agree that the message should be a 'WARNING:' (not ERROR) and that it should
say that the PDF produced will have links connected to non-existent pages (or
something similar)

As far as removing the links, that's up to Ken. Can a link that is broken just
point to its own page location (effectively no-op)? 
Comment 3 Ken Sharp 2009-01-30 00:11:51 PST
I'm sure we could point the broken link to its own page, but I was hoping to
remove it altogether. Bit more complex, and I haven't really figured out whether
its possible. 

I also think that we should make -dDOPDFMARKS=false work in this case too, which
it doesn't... It seems that the presence of the pdfwrite device overrides even
an explicit declaration.
Comment 4 Ken Sharp 2013-08-09 05:51:33 PDT
I believe this is completely resolved in current code with commit 010e9990d734a8a2361663338b1fbd605d0ca052