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

Page centering for --samePageSize #58

Open
ybeltukov opened this issue Apr 9, 2024 · 3 comments
Open

Page centering for --samePageSize #58

ybeltukov opened this issue Apr 9, 2024 · 3 comments

Comments

@ybeltukov
Copy link

ybeltukov commented Apr 9, 2024

pdfCropMargins has a great option --samePageSize which can be used to obtain same page sizes by adding margins. However, it uses the largest bounding box, which covers all pages. However, some documents have different bounding box placements, resulting in uneven margins. Here is the output with options -s -u for such a document:

Screenshot_20240409_150645
One can see enormous bottom-left margins on the first page and enormous top-right margins on the second page.

It would be nice to have the option to "center" all the pages while applying --samePageSize.

With this option, pdfCropMargins will be the best choice to answer this question:
https://superuser.com/questions/434063/how-can-i-make-all-pages-in-a-pdf-the-same-size

@abarker
Copy link
Owner

abarker commented Apr 13, 2024

Check out the new version 2.1.2. It now has the options --centerText, --centerTextHoriz,
--centerTextVert, and --centeringStrict.

@ybeltukov
Copy link
Author

@abarker Thank you for the update! It works, but it centers the page after making the crops. It results in large margins for the book under discussion:

pdfcropmargins -s -u --centerText book.pdf

Screenshot_20240417_194645

Right now I can make the second pass with -u option only

pdfcropmargins -u book_cropped.pdf

Screenshot_20240417_194942

Is it possible to center the page while making --samePageSize before calculating the crops? If it has drawbacks, the two-pass method is also great.

@abarker
Copy link
Owner

abarker commented Apr 17, 2024

It looks like you used --centerTextHoriz since --centerText is supposed to center pages both vertically and horizontally.

You can always just crop more off using the -p, -p4, -a, or -a4 options. With the GUI option -gui you can visually select the values.

There's also a --setSamePageSize option where you can pass in a page size directly, but you'd need to know the numbers. The --samePageSizeOrderStat option might help, but it depends on the document.

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

No branches or pull requests

2 participants