Skip to content

feat: Allow keep_aspect_ratio flag for images in templates - #1893

Merged
andersonhc merged 3 commits into
py-pdf:masterfrom
prateek-dagar:template-keep-aspect-ratio
Jul 24, 2026
Merged

feat: Allow keep_aspect_ratio flag for images in templates#1893
andersonhc merged 3 commits into
py-pdf:masterfrom
prateek-dagar:template-keep-aspect-ratio

Conversation

@prateek-dagar

@prateek-dagar prateek-dagar commented Jul 21, 2026

Copy link
Copy Markdown

Fixes #1118

This PR adds support for the keep_aspect_ratio flag to image elements inside fpdf2 templates (FlexTemplate). This allows templates to preserve the original aspect ratio of images without stretching or distortion.

This work is based on the previous PR #1119 by @Clock-Speed, with additional fixes to the CSV parsing validation types, unit tests using assert_pdf_equal, and documentation.

Checklist:

  • A unit test is covering the code added / modified by this PR
  • In case of a new feature, docstrings have been added, with also some documentation in the docs/ folder
  • A mention of the change is present in CHANGELOG.md
  • This PR is ready to be merged

By submitting this pull request, I confirm that my contribution is made under the terms of the GNU LGPL 3.0 license.

@andersonhc

Copy link
Copy Markdown
Collaborator

@allcontributors please add @prateek-dagar for code

@allcontributors

Copy link
Copy Markdown

@andersonhc

I've put up a pull request to add @prateek-dagar! 🎉

@andersonhc andersonhc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

PR is ready to merge
Thanks for the contribution @prateek-dagar

@andersonhc
andersonhc merged commit c03aefc into py-pdf:master Jul 24, 2026
23 checks passed
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.

keep_aspect_ratio support for images in templates

2 participants