pdfCropMargins
pdfCropMargins copied to clipboard
how to crop till text edge and later add 10bp margin all around
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
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.
thanks, amazing pdf tool. searching for such a thing since last few years