Score:0

Is there something that crops or resizes the pdf page by its TrimBox?

US flag
user1701136

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.

Score:0
cn flag

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.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.