pdfCropMargins icon indicating copy to clipboard operation
pdfCropMargins copied to clipboard

how to crop till text edge and later add 10bp margin all around

Open sant527 opened this issue 5 years ago • 2 comments

I was deperately looking for such an appliction.

i found it at https://tex.stackexchange.com/a/447756.

I was looking for this kind of application

I have a pdf with the margins are not same on each side. I have a pdf after cropping it i want to have 10dp all around croped/cliped text.

How to do it.

In pdfcrop we do pdfcrop -m 10 filename.pdf output.pdf

ANSWER: (this worked)

pdf-crop-margins -v -a -6 -p 0 input.pdf

sant527 avatar Oct 02 '19 04:10 sant527

Thanks for the report. To get 10bp all around the command would be:

pdf-crop-margins -a -10 -p 0 input.pdf

There are 72bp/inch, which is the unit PDF files use and which pdfCropMargins uses. You wrote that you want 10dp, but that conversion depends on the dpi density value of a given device. The pdfcrop program uses bp, too. The Pillow bounding-box algorithm can differ slightly from the GhostScript one (which pdfcrop uses), so a little adjustment might still be needed for similar results.

Assuming 10bp, the equivalent of the pdfcrop command above, with the output file specified and in verbose mode, would be:

pdf-crop-margins -v -a -10 -p 0 input.pdf -o output.pdf

I've added an example in the help page of adding a constant amount past the bounding boxes. With regard to the tex.stackexchange link, I added a new feature that the threshold value can now be negative. This inverts the test of foreground vs. background, for images with dark backgrounds and light foregrounds.

abarker avatar Oct 31 '19 03:10 abarker

thanks, amazing pdf tool. searching for such a thing since last few years

sant527 avatar Nov 08 '19 05:11 sant527