Skip to content

Refactor CLI structure and improve PDF merge/split robustness with metadata preservation and safer object handling#1

Open
PhotoDotPi wants to merge 2 commits into
syedinsaf:mainfrom
PhotoDotPi:main
Open

Refactor CLI structure and improve PDF merge/split robustness with metadata preservation and safer object handling#1
PhotoDotPi wants to merge 2 commits into
syedinsaf:mainfrom
PhotoDotPi:main

Conversation

@PhotoDotPi
Copy link
Copy Markdown

Description

This PR cleans up the CLI structure and makes the merge/split logic more robust.

Main changes:

  • Added a dedicated info subcommand instead of relying on implicit behavior.
  • Improved recursive directory handling and added protection against directory loops.
  • Reworked object ID remapping during merge to be safer and more predictable.
  • Added metadata preservation (Info, ID, Encrypt) when merging and splitting.
  • Built a proper hierarchical page tree for larger merged PDFs.
  • Improved object reference traversal and added basic protection against runaway graphs.
  • Minor cleanup and safer handling when cloning objects.

Overall this makes merging and splitting more reliable, especially for larger or more complex PDFs.

Refactor collect_pdfs_recursive to track visited directories and handle errors more robustly. Update PDF metadata handling and improve page tree creation.
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

Successfully merging this pull request may close these issues.

1 participant