I would like to know what the actual difference between BoundingBox and CropBox in a Postscript file is. I want to crop a PDF file and display only the cropped part of it as another PDF file. I converted the PDF file to postscript using pdftops from the xpdf library. I plan to edit the BoundingBox/CropBox parameters so that only a particular part of the original file is displayed. But when I open the file I still see the original file. Which parameter should I change to crop a PDF?
Asked
Active
Viewed 4,010 times
2 Answers
3
PostScript doesn't have a BoundingBox or CropBox at all, just the media request which is equivalent to the MediaBox in a PDF file. (you could convert the CropBox to a page level clip which would have a similar effect)
Its not obvious to me what you are trying to do, if you want a PDF file with a modified CropBox then you just alter the CropBox in the PDF file, I can't see why you are converting to PostScript.
If you want a cropped area from the original file, copy it and alter the CropBox in the copied file.

KenS
- 30,202
- 3
- 34
- 51
-
Thank you for the reply. I plan to write a program where the user selects a particular area of the PDF file to be cropped and the cropped area is displayed as another PDF file. Is it possible to edit the CropBox values of PDF via a program? I assumed I would need to edit the values in the corresponding Postscript file and then display the .ps file as a PDF file. Please correct me if I am wrong. – user1512781 Jul 12 '12 at 18:33
-
The CropBox is a simple entry, one entry for the whole document or one for each page. In most PDF files these are easy enough to find. There are many applications which will modify the CropBox and I would suggest that you try to do that rather than using Ghostscript to 'refry' the PDF. – KenS Jul 13 '12 at 07:11
-
Can I use iTextSharp to modify the CropBox parameters of the PDF? – user1512781 Jul 13 '12 at 17:37
-
I have no idea, I know nothing about itextSharp – KenS Jul 14 '12 at 09:34
0
I managed to get the code working to crop the pdf. It was just a simple script in ghostscript which generated the new cropped pdf. The solution is here: Cropping a PDF using Ghostscript 9.01

Community
- 1
- 1

user1512781
- 73
- 3
- 8