When specifying -dLastPage=740, I receive the error:
"GPL Ghostscript 8.62: ERROR: A pdfmark destination page 1203 points
beyond the last page 740."
I have scoured the Ghostscript documentation for how to disable
pdfmark entirely (I don't need links or bookmarks for a straight-to-
print pdf). -dDOPDFMARKS=false does not work.
I've scoured the internet for anyone reporting a similar error. I
haven't found a solution yet.
Please help!
For reference, the command I'm using is:
gs -dSAFER -dBATCH -sDEVICE=pdfwrite -DNOPAUSE -sPAPERSIZE=halfletter -
dFIXEDMEDIA -dEmbedAllFonts=true -sOutputFile=library.1of2.pdf -
dLastPage=740 -dPDFFitPage library.pdf
What's happening is that the bookmark in the original document is being
converted into a pdfmark (internally by the PDF interpreter) in order to
produce a matching bookmark in the output document.
Because you've set the device to be pdfwrite, it automatically sets
DOPDFMARKS to true, overriding what you've set on the command line.
I don't have an example document to try this on myself, but you could
try including a piece of PostScript which 'undefines' pdfmark. Create a
file (eg nopdfmark.ps) which contains:
%!
/pdfmark {cleartomakr} bind def
Then when converting your PDF file specify this file *before* the PDF
file in your command line. Eg:
gs -dSAFER -dBATCH -sDEVICE=pdfwrite -DNOPAUSE -sPAPERSIZE=halfletter -
dFIXEDMEDIA -dEmbedAllFonts=true -sOutputFile=library.1of2.pdf -
dLastPage=740 -dPDFFitPage nopdfmark.ps library.pdf
This may override the native GS implementation, if it does it will
disable *all* pdfmark processing. You could do a 'smarter'
implementation which would disable /Destination marks only, if this
works.
You might like to raise an enhancement request at
http://bugs.ghostscript.com to create a general solution to this. It
would be useful if you could share a (small!) document which exhibits
the problem. Probably the simplest solution is for pdfwrite not to
override the definition of DOPDFMARKS if it is explicitly set.
Ken
Thanks Ken. I tried your "nopdfmark.ps" method, and that did get rid
of the error. For anyone unfamiliar with postscript (like myself),
the keyword in braces has a typo, it should be "cleartomark".
Last night I realized that the error was not fatal and that a pdf /
was/ being created with /some/ valid links. Since I don't really need
links for my immediate purposes (straight to print), I can mostly
ignore the error for now. But in the future, I'm sure I'll want to be
able to split a PDF in 2 wile maintaining the validity of links and
bookmarks.
I'm brand new to using GS. I started reading the manuals (a few
times) and using it yesterday, in fact. I could very well be missing
something that solves this problem. But, just in case, I filed an
enhancement request anyway. I also attached a small sample pdf to the
bug report. http://bugs.ghostscript.com/show_bug.cgi?id=690253
Thanks for all your help!
- aj
> Thanks Ken. I tried your "nopdfmark.ps" method, and that did get rid
> of the error. For anyone unfamiliar with postscript (like myself),
> the keyword in braces has a typo, it should be "cleartomark".
Whoops, sorry, the perils of typing PostScript without being able to
execute it ;-)
> Last night I realized that the error was not fatal and that a pdf /
> was/ being created with /some/ valid links. Since I don't really need
> links for my immediate purposes (straight to print), I can mostly
> ignore the error for now. But in the future, I'm sure I'll want to be
> able to split a PDF in 2 wile maintaining the validity of links and
> bookmarks.
AH, I think that may not be possible using GS. Especially when actions
cross the two files, you would need to convert them into URI actions
instead (I think, I can't recall the details from the spec right now).
In any event it would require quite a lot of intelligence from the
splitting application.
> times) and using it yesterday, in fact. I could very well be missing
> something that solves this problem.
Well, I'm the maintainer for the pdfwrite code, and I don't know of
anything to do this ;-) However half the problem is in the PDF
interpreter, which isn't mine, so it is still possible there's
something.
> But, just in case, I filed an
> enhancement request anyway. I also attached a small sample pdf to the
> bug report. http://bugs.ghostscript.com/show_bug.cgi?id=690253
Great, that'll give me something to think about next week while the code
is frozen for release.
> Thanks for all your help!
Not a problem, always happy to help, I'm glad your problems are
resolved.
Ken
If you type in the PostScript file Prolog:
/pdfmark where {pop}{userdict /pdfmark /cleartomark load put} ifelse
then the links should appear in any PDF conversion but are ignored when
downloading the file to a PS interpreter, printer, or software emulator.
David B-W