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

When using the as_pdf() method of a bundle, add parameter to ensure an odd or even number of pages #837

Merged
merged 4 commits into from
Mar 26, 2024

Conversation

nonprofittechy
Copy link
Member

Adds a parameter ensure_parity to the ALDocumentBundle.as_pdf(), and default_parity as an attribute of the bundle.

parity means odd or even number of pages. When either parameter or attribute is set, the as_pdf() method of the bundle may pad the output with an additional page, if needed to match the desired parity.

The purpose is primarily to assist with double-sided printing.

  • ALDocumentBundle.default_parity: can be "odd", "even", or None.
  • ALDocumentBundle.as_pdf(ensure_parity) can be "odd", "even", or None. Overrides default_parity.

Test document: test_bundle_parity.yml.

Example usage:

---
objects:
  - even_bundle: ALDocumentBundle.using(
          title="Even bundle",
          filename="the_bundle",
          elements=[
            the_doc
          ],
          default_parity="even",
          enabled=True
      )

Fix #828

Copy link

@samglover samglover left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spotted one typo in the documentation. Setting aside punctuation errors in the code, which I'm not yet confident I would spot, it seems like it should do what it is supposed to!

docassemble/AssemblyLine/al_document.py Outdated Show resolved Hide resolved
@nonprofittechy nonprofittechy merged commit 55a6ef6 into main Mar 26, 2024
5 checks passed
@nonprofittechy nonprofittechy deleted the make-pages-odd-or-even branch August 13, 2024 13:08
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.

Make it possible to ensure that a bundle has an even number of pages
2 participants