Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sant527 opened this issue Oct 2, 2019 · 2 comments
Open

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

sant527 opened this issue Oct 2, 2019 · 2 comments
Labels

Comments

@sant527
Copy link

sant527 commented Oct 2, 2019

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 sant527 changed the title how to crop keeping 10bp margin all around how to crop and later add 10bp margin all around Oct 2, 2019
@sant527 sant527 changed the title how to crop and later add 10bp margin all around how to crop till text edge and later add 10bp margin all around Oct 2, 2019
@abarker
Copy link
Owner

abarker commented Oct 31, 2019

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.

@sant527
Copy link
Author

sant527 commented Nov 8, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants