Bug 692170 - extraction of PDF subpages suggests clipping fault
Summary: extraction of PDF subpages suggests clipping fault
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Writer (show other bugs)
Version: 0.00
Hardware: Sun Solaris
: P4 normal
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-27 20:31 UTC by David Mathog
Modified: 2016-04-21 03:55 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
The script to slice subpages out of a PDF file (5.51 KB, application/postscript)
2011-04-27 20:31 UTC, David Mathog
Details
Corrected version of pdf_slice.ps (6.29 KB, application/postscript)
2016-04-21 03:54 UTC, Ken Sharp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Mathog 2011-04-27 20:31:34 UTC
Created attachment 7478 [details]
The script to slice subpages out of a PDF file

(Bug filed under PDFWriter, could easily be in PDFInterpreter)

Ken Sharp (yes, the one at Artifex) wrote a nice little script pdf_slice.ps
(attached) that extracts single pages from a PDF file where each page contains 2 or more pages.  That is, it undoes the "marked up" printer output, breaking a 4 slide per page PDF back down to a 1 slide per page PDF. 

The problem is that with the test file the output is somewhat corrupted.  About 1/6th of the pages show an issue. Ken thought this might be due to some problem
with the clipping not being offset along with the subpage selection window. 

Tested using ghostscript 9.02 on Solaris 8/Sparc, binary from sunfreeware.com. 

Thank you.
Comment 1 Ken Sharp 2016-03-08 01:20:12 UTC
Unfortunately the test file is not attached to this bug report. I had assumed that I had a copy of it, but I've searched my old systems and I cannot locate one.

If anyone reading this has a copy of the file please attach it and reopen the bug report.

Sadly, without the file, I'm going to have to close the bug.
Comment 3 Ken Sharp 2016-04-21 03:54:36 UTC
Created attachment 12455 [details]
Corrected version of pdf_slice.ps

Well the problem turns out to be the pdf_slice program. There was a clash of names due to simplistic naming (and sloppy programming on my part) and two conditional clauses missing the operator (no 'if').

I've uploaded a modified version here, where the variable declaration is secured inside its own dictionary to prevent the name scoping problem, and the missing 'if' operators have been added.

With the addition of those the program runs to completion, does not throw any warnings or errors, and the result appears (to me) to be correct. Certainly the extraneous clipped items are no longer present.