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

Add margins by scaling down content only (not MediaBox) #756

Closed
liojacqs opened this issue Dec 14, 2023 · 2 comments
Closed

Add margins by scaling down content only (not MediaBox) #756

liojacqs opened this issue Dec 14, 2023 · 2 comments
Assignees

Comments

@liojacqs
Copy link

liojacqs commented Dec 14, 2023

Hello,

It would be useful to be able to add margins by scaling down content while preserving the document size.

Unless I missed something, I didn't find a way to achieve that, at least in a simple way.
(I could by running 'pdfcpu poster -u mm "f:A4, margin: 5" a4file.pdf dir', with a 1 page "a4file.pdf", creating a 2 pages file "dir/a4file_page_1.pdf" in which second page has such 5mm margins, but that's not quite simple...)

I have made a quick and dirty test by modifying resize.go as below, but it may not properly work with other stuff like background color, and it's probably not the best way to achieve that.
(It could also be something like an additional "fit" options to pdfcpu crop, resizing and positioning visible content to the new crop size, with or without preserving aspect ratio)

Any comments / suggestions about the way to do this would be appreciated, possibly the occasion for a first contribution on my side.

image

@hhrutter
Copy link
Collaborator

👍🏻 This is cropping while preserving page dimensions.

Would most probably be something like a preservePageSize or fit option for the crop command.

There are different ways to achieve the scaling that's part of this.
Will be taken into consideration.

@hhrutter
Copy link
Collaborator

hhrutter commented Mar 5, 2024

This fixed with https://github.com/pdfcpu/pdfcpu/releases/tag/v0.7.0
You can use the new zoom command to achieve this.

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