fix: right-align letter head with the document

Text block flex-fills remaining width and right-aligns its text, so it sits at
the document's right edge with or without a company logo. Drop the fixed 500px
width; keep -webkit-box fallbacks for wkhtmltopdf.
This commit is contained in:
2026-09-10 02:40:46 +00:00
parent 9091caffab
commit a6620d3743
@@ -1,7 +1,7 @@
[
{
"align": "Left",
"content": "<style>\n .bpt-title{\n display: -webkit-box !important;\n -webkit-box-align: center !important;\n -webkit-box-pack: justify !important;\n }\n</style>\n{% set company = get_letter_head_company(doc) %}\n{% if company %}\n<div class=\"bpt-title\">\n {% if company.company_logo %}\n <img alt=\"{{ company.company_name }}\" height=\"125\" src=\"{{ company.company_logo }}\">\n {% endif %}\n <div class=\"text-right\" style=\"width: 500px; margin-right: 1px;\">\n <h1>{{ company.company_name }}</h1>\n <small>\n {% if company.tax_id %}<div>ID: {{ company.tax_id }}</div>{% endif %}\n {% if company.address %}<div>{{ company.address }}</div>{% endif %}\n {% if company.phone_no %}<div>Phone: {{ company.phone_no }}</div>{% endif %}\n {% if company.email %}<div>Email: {{ company.email }}</div>{% endif %}\n </small>\n </div>\n</div>\n{% endif %}\n",
"content": "<style>\n .bpt-title {\n display: -webkit-box;\n display: flex;\n -webkit-box-align: center;\n align-items: center;\n width: 100%;\n }\n .bpt-title img {\n margin-right: 1em;\n }\n .bpt-title .bpt-company {\n -webkit-box-flex: 1;\n flex: 1;\n text-align: right;\n }\n</style>\n{% set company = get_letter_head_company(doc) %}\n{% if company %}\n<div class=\"bpt-title\">\n {% if company.company_logo %}\n <img alt=\"{{ company.company_name }}\" height=\"125\" src=\"{{ company.company_logo }}\">\n {% endif %}\n <div class=\"bpt-company\">\n <h1>{{ company.company_name }}</h1>\n <small>\n {% if company.tax_id %}<div>ID: {{ company.tax_id }}</div>{% endif %}\n {% if company.address %}<div>{{ company.address }}</div>{% endif %}\n {% if company.phone_no %}<div>Phone: {{ company.phone_no }}</div>{% endif %}\n {% if company.email %}<div>Email: {{ company.email }}</div>{% endif %}\n </small>\n </div>\n</div>\n{% endif %}\n",
"disabled": 0,
"docstatus": 0,
"doctype": "Letter Head",
@@ -18,7 +18,7 @@
"image_width": 0.0,
"is_default": 1,
"letter_head_name": "Default Letter Head",
"modified": "2026-09-09 17:12:12.886614",
"modified": "2026-09-10 09:39:18.313192",
"name": "Default Letter Head",
"source": "HTML"
}