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

Modify original without backup #62

Open
samuelbradshaw opened this issue Jul 24, 2024 · 3 comments
Open

Modify original without backup #62

samuelbradshaw opened this issue Jul 24, 2024 · 3 comments

Comments

@samuelbradshaw
Copy link

samuelbradshaw commented Jul 24, 2024

Thanks for this library! Is it possible to modify the original without creating backup files?

If I use this command:

pdfcropmargins --percentRetain4 100 100 100 0 --pages 1 --modifyOriginal my-file.pdf

I get a bunch of backup files that I then need to clean up.

When I try this command:

pdfcropmargins --percentRetain4 100 100 100 0 --pages 1 --modifyOriginal --outfile my-file.pdf my-file.pdf

I get this error:

Error in pdfCropMargins: The input file is the same as
the output file.
@abarker
Copy link
Owner

abarker commented Aug 9, 2024

The output file with --outfile cannot be the same as the input file because as currently implemented the original file is needed when writing out the new file. Also, the GUI allows for multiple crops which may need to access the original.

The --modifyOriginal option works as the very last step so it does not have that problem. For the next release I've added the option --replaceOriginal which implies --modifyOriginal but removes the original file instead of moving it to a backup filename. It can still work in conjunction with the gui, preview, and --queryModifyOriginal options.

@samuelbradshaw
Copy link
Author

Awesome, thank you!

@abarker
Copy link
Owner

abarker commented Aug 14, 2024

The new version has been pushed to PyPI as 2.1.4.

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

No branches or pull requests

2 participants