views:

1057

answers:

3

I am trying to split a PDF into 2 smaller PDF's using gs (Ghostscript version 8.62 on Debian Lenny). I only have Debian Linux on hand, so please don't offer Windows or Mac solutions.

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
+1  A: 

Give CAM::PDF a try (note: I'm the author). The syntax would be:

deletepdfpage.pl library.pdf 741- library.1of2.pdf
deletepdfpage.pl library.pdf -740 library.2of2.pdf

or programmatically, it would be roughly like this:

use CAM::PDF;
my $pdf = CAM::PDF->new('library.pdf') || die;
$pdf->deletePages('741-');
$pdf->cleanoutput('library.1of2.pdf');

It's open source and it's pretty fast, too.

Chris Dolan
A: 

As it turns out, the error is not fatal. The pdf is generated anyhow, and since I do not care about pdf links or bookmarks functioning, this problem is solved for me.

In general, though, it would be good to know why pdfmark or ghostscript is failing, and how to generate a valid pdf with functioning links. If anyone has an answer, I'd still like to hear.

drfloob
It's a known bug in Ghostscript. See here: http://bugs.ghostscript.com/show_bug.cgi?id=690253
pipitas
that's my bug report :)
drfloob
A: 

You should ask a new question which details exactly how and where you want to generate what kind of "PDFs with functioning links".

pipitas