Use pdf page numbers with ghostscript

I want to extract pages from a PDF file that has its own pagination, for example. there are pages with the numbers C1, C2, C3, and after that starts 1,2,3,4, etc.

When i use

$ gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \ -dFirstPage=22 -dLastPage=36 \ -sOutputFile=outfile_p22-p36.pdf 100p-inputfile.pdf 

FirstPage and LastPage is the page index starting to count on the first page - this is not what I want

How can I tell GhostView to use "real" page numbers?

+4
source share
1 answer

You can, given a lot of knowledge about internal Ghostscript PDF interpreters, access page numbers. This will require a lot of attention in the files Resource / Init / pdf * .ps (mostly just pdf_main.ps) and an understanding of PostScript, but it is possible. Just not for the faint of heart.

To see an example of a PS program that is viewed inside PDF for information, look at toolbin / pdf_info.ps.

If someone comes up with a patch to allow FirstPage / LastPage to take names as labels, then we will consider this. Part of this patch should be a change, add the pdf_info.ps option to print labels and real page numbers.

+3
source

All Articles