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

BUG: Let PdfWriter.pages return PageObject after calling clone_document_from_reader() #1613

Merged
merged 4 commits into from
Feb 25, 2023

Conversation

pubpub-zz
Copy link
Collaborator

@pubpub-zz pubpub-zz commented Feb 6, 2023

Currently, the PdfWriter.pages attribute returns a DictionartyObject. With this fix, the attribute will return Iterable[PageObject].

Fixes #1595

See also:

@codecov
Copy link

codecov bot commented Feb 6, 2023

Codecov Report

Base: 92.27% // Head: 92.28% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (b55ae16) compared to base (2204fd6).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1613   +/-   ##
=======================================
  Coverage   92.27%   92.28%           
=======================================
  Files          33       33           
  Lines        6373     6377    +4     
  Branches     1271     1272    +1     
=======================================
+ Hits         5881     5885    +4     
  Misses        312      312           
  Partials      180      180           
Impacted Files Coverage Δ
pypdf/_writer.py 84.60% <100.00%> (+0.05%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

pypdf/_writer.py Outdated Show resolved Hide resolved
@MartinThoma
Copy link
Member

@pubpub-zz Could you maybe explain the title BUG: pages[] return PageObject after calling clone_document_from_reader() to me?

Does it mean that before this PR, the PdfWriter.pages was returning a single PageObject after calling clone_document_from_reader` and now it returns a list?

@pubpub-zz
Copy link
Collaborator Author

currently in PdfWriter pages[] returns DictionartyObject and not PageObjects

@MartinThoma MartinThoma changed the title BUG: pages[] return PageObject after calling clone_document_from_reader() BUG: Let PdfWriter.pages return PageObject after calling clone_document_from_reader() Feb 25, 2023
@MartinThoma MartinThoma merged commit a2a1275 into py-pdf:main Feb 25, 2023
@MartinThoma
Copy link
Member

Thank you!

MartinThoma added a commit that referenced this pull request Feb 26, 2023
New Features (ENH)
-  Add reader.attachments public interface (#1611, #1661)
-  Add PdfWriter.remove_objects_from_page(page: PageObject, to_delete: ObjectDeletionFlag) (#1648)
-  Allow free-text annotation to have transparent border/background (#1664)

Bug Fixes (BUG)
-  Allow decryption with empty password for AlgV5 (#1663)
-  Let PdfWriter.pages return PageObject after calling `clone_document_from_reader()` (#1613)
-  Invalid font pointed during merge_resources (#1641)

Robustness (ROB)
-  Cope with invalid objects in IndirectObject.clone (#1637)
-  Improve tolerance to invalid Names/Dests (#1658)
-  Decode encoded values in get_fields (#1636)
-  Let PdfWriter.merge cope with missing "/Fields" (#1628)

[Full Changelog](3.4.1...3.5.0)
@pubpub-zz pubpub-zz deleted the pages_clone_doc branch June 24, 2023 08:39
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.

page 2 blended with page 1 on output via append
2 participants