1

I am developing an application that makes pdf files, but I am adding the trimbox values to the pdf pages with a different way, hence I need debug my pdf file to check trimbox values that I set with my way, working or not. But I don't have printer. Is there something that crops or resizes the pdf pages by their trimbox values, thus I can put my pdf file which is generated with my application to that app and being sure trimbox values that I set with my way works or not. Currently I have tried these applications:

Okular
qpdfview
Boomaga (as virtual printer)
CUPS-PDF (as virtual printer)

But I could not find any settings in okular and qpdfview to crop or resize the pdf pages by their trimbox values. I have printed my pdf file whose pages have trimbox values (with my way or ready pdf file that I know trimbox values properly added to the pages) as again pdf file in Boomaga and CUPS-PDF. But I could not see any change about page's dimensions or cropping.

1 Answer 1

1

Ghostscript can be used to rewrite PDF files with the pages cropped to the trim box, by using the following option (from https://ghostscript.com/docs/9.54.0/Use.htm#PDF_switches):

-dUseTrimBox
Sets the page size to the TrimBox rather than the MediaBox. The trim box defines the intended dimensions of the finished page after trimming. Some files have a TrimBox that is smaller than the MediaBox and may include white space, registration or cutting marks outside the CropBox. Using this option simulates appearance of the finished printed page.

There are also options to use the other bounding boxes.

Use the command line:

gs -sDEVICE=pdfwrite -dUseTrimBox -o $OUT.pdf $IN.pdf

It should already be installed, but if not can be with sudo apt install ghostscript.

0

You must log in to answer this question.