Skip to content

Keep wide logos inside the logo box on portrait templates - #189

Merged
kittendevv merged 1 commit into
kittendevv:mainfrom
Bouni:fix/logo-sizing-portrait-templates
Nov 22, 2026
Merged

kittendevv merged 1 commit into
kittendevv:mainfrom
Bouni:fix/logo-sizing-portrait-templates

Conversation

@Bouni

@Bouni Bouni commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #173

On Minimalist Clean (the default) and Professional Modern, a wide logo covers the company name and details in both the PDF and the HTML view.

The logo box is 140px wide, but the image was sized by height (height: 100%; width: auto; max-width: 220px). Scaled to the height of the company details, a wide logo (e.g. 1072×714) comes out wider than the box and spills over the text. In the HTML view a small fit script set the height in pixels with width: auto, which has the same effect. Slate and Nova cap the logo with fixed limits and are not affected.

Changes

backend/static/templates/minimalist-clean.html and professional-modern.html:

  • The image fills its box (width: 100%; height: 100%) and the logo is scaled inside it with object-fit: contain, aligned left/top. Wide logos shrink to fit; tall or small logos still match the height of the company details.
  • Removed the fit script, so the HTML view and the PDF lay out the same way (WeasyPrint does not run scripts).
  • Removed a duplicate .brand .logo rule in Professional Modern that still set max-width: 220px.

Existing installs pick this up at startup, since built-in templates are re-synced from these files into the database.

Verification

Rendered both templates with a 1072×714 logo in WeasyPrint 57.2 (the version in the Docker image):

Template Logo right edge before after Company details start at
Minimalist Clean 237px 192px 208px
Professional Modern 247px 192px 208px

Also compared the rendered PDF pages before and after: the overlap is gone and the logo sits next to the company details. The HTML view was not checked in a browser.

🤖 Generated with Claude Code

In Minimalist Clean and Professional Modern the logo box is 140px wide,
but the image was sized by height (height: 100%; width: auto;
max-width: 220px). A wide logo scaled to the height of the company
details came out wider than the box and covered the company name and
address. A fit script did the same in the HTML view.

Let the image fill its box and scale the logo inside it with
object-fit: contain, and drop the fit script so the HTML view and the
PDF lay out the same way.

Fixes kittendevv#173

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kittendevv
kittendevv merged commit dcb11a1 into kittendevv:main Nov 22, 2026
4 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.

Logo not resizing properly on portrait invoice templates

2 participants