Closed Islamation closed 5 months ago
If the standard print format is working, there must be some problem in the custom format's code itself.
We tested in v15 latest with custom print format, but there is no issue found. Please share the code.
`
/ arabic / @font-face { font-family: 'Cairo'; font-style: normal; font-weight: 600; src: url(https://fonts.gstatic.com/s/cairo/v10/SLXLc1nY6Hkvalr-ao6O59ZMaA.woff2) format('woff2'); unicode-range: U+0600-06FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE80-FEFC; } / latin-ext / @font-face { font-family: 'Cairo'; font-style: normal; font-weight: 600; src: url(https://fonts.gstatic.com/s/cairo/v10/SLXLc1nY6Hkvalr-ao6F59ZMaA.woff2) format('woff2'); unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } / latin / @font-face { font-family: 'Cairo'; font-style: normal; font-weight: 600; src: url(https://fonts.gstatic.com/s/cairo/v10/SLXLc1nY6Hkvalr-ao6L59Y.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } .print-format table, .print-format tr, .print-format td, .print-format div, .print-format p { font-family: 'Cairo'; line-height: 90%; vertical-align: middle;
}
@media print {
body{
font-family: 'Cairo';
width: 220mm;
height: 300mm;
margin: 5mm 5mm 10mm 5mm;
/* change the margins as you want them to be. */
} } @media screen { .print-format { width: 200mm; padding: 5mm; min-height: 300mm; footer {page-break-after: always;} } } table.no-border, table.no-border td{
margin-top: -20px !important;
}
.table .table-condensed .table-hover .table-bordered .print-format td, .print-format th{ background-color: whitesmoke !important; } .print-format td, .print-format th {
}
.print-heading {
float: left !important;
border-bottom: 1px solid #d1d8dd !important; width: 45% !important ; }
.alert-logo { padding: 0px !important; margin-bottom: .5px !important; border: 0px solid transparent !important; border-radius: 4px !important; text-align: left !important; color: red !important; }
.cr{ width: 60% !important; margin-top: -5px !important; display: block; margin-left: auto; margin-right: auto;
} .logo-div1{
text-align: right !important; width: 40% !important;
margin-right: 160px !important;
}
.logo-div2 { font-family: Arial !important; color: darkblue !important; text-align:center !important; font-size:18px !important; } .logo-div3 { font-family: 'Cairo'; font-weight:700 !important; color: darkblue !important; font-size:14px !important; margin-top:5px; margin-bottom: -29px !important; margin-left: 5px !important; }
.logo-div4{ font-family: Arial !important; color: darkblue !important; font-size:14px !important; margin-bottom: -32px !important; margin-top: -50px !important; } .logo-div8{ font-family: Arial !important; color: darkblue !important; font-size:14px !important; margin-bottom: -15px !important; margin-top: -38px !important; }
.logo-div5{
width: 35% !important;
margin-top: 15px !important;
display: block;
margin-left: auto;
margin-right: auto;
}
.logo-div6{ text-align:center !important; margin-top: 3px !important; font-family: Arial !important; color: darkblue !important;
text-align:center !important; font-size:14px !important; } .logo-div7{
width: 65% !important;
max-height: 45px !important;
margin-top: 19px !important;
display: block;
margin-left: auto;
margin-right: auto;
}
.table-bordered, .table-bordered>tbody>tr>td, .table-bordered>tbody>tr>th, .table-bordered>tfoot>tr>td, .table-bordered>tfoot>tr>th, .table-bordered>thead>tr>td, .table-bordered>thead>tr>th { border: 0.5px solid #d1d8dd !important; }
.td1 {
border-bottom: 0.5px solid #d1d8dd !important; }
.si {
color: darkblue !important;
margin-top: -5px !important;
}
.table-no-b {
border-top: 0 !important; margin-top: -5px !important; }
.space {
margin-top: -12px !important;
}
.ql-editor.read-mode {
padding:6px !important ; }
.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
font-weight: 600 !important;
}
.w1 { margin-right: 115px !important; } .w2 { border-top: 3px solid #d1d8dd !important; padding-top: 10px !important; }
<div id="footer-html" class="visible-pdf" style=" display: block !important; position: fixed; bottom: 0; width:100%;
">
<table class="table table-condensed">
<tr>
<td style="text-align: center; border: none;">
<b>{{ _("المستلم ") }}</b>
</td>
<td style="text-align: center; border: none;">
<b>{{ _("المخزن ") }}</b>
</td>
<td style="text-align: center; border: none;">
<b>{{ _("يعتمد ") }}</b>
</td>
</tr>
<tr>
<td style="text-align: center; border: none;">
<b> .............................. </b>
</td>
<td style="text-align: center; border: none;">
<b> .............................. </b>
</td>
<td style="text-align: center; border: none;">
<b> .............................. </b>
</td>
</tr>
</table>
<div class="letter-head-footer">
{{ footer }}
</div>
<p class="text-center small page-number visible-pdf">
Page <span class="page"></span> of <span class="topage"></span>
</p>
</div>
{{ doc.company }}{{ "الشركة المتحدة للبطاريات السائلة" }}{{ _("رقم السجل التجاري : 655 ") }} {{ _("رقم البطاقة الضريبية : 481688080 ") }} |
{{ letter_head }} |
{{ _("الغرض ") }}: {{ _(doc.material_request_type ) }} {{ _("الحالة ") }}: {{ _(doc.status ) }} |
|
م | كود الصنف | اسم الصنف | كمية |
---|---|---|---|
{{ row.idx }} | {{ row.item_code }} | {{ row.custom_item_name_in_arabic }} | {{ row.qty }} {{ row.uom or row.stock_uom }} |
الاجماليات : | {{ doc.items|sum(attribute= 'qty') }} |
{{ doc.terms or "" }} |
Please provide the code in the below style. and your code shows a mismatch.
And code is long, so you have to test it yourself one by one.
<style>
/* arabic */
@font-face {
font-family: 'Cairo';
font-style: normal;
font-weight: 600;
src: url(https://fonts.gstatic.com/s/cairo/v10/SLXLc1nY6Hkvalr-ao6O59ZMaA.woff2) format('woff2');
unicode-range: U+0600-06FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE80-FEFC;
}
/* latin-ext */
@font-face {
font-family: 'Cairo';
font-style: normal;
font-weight: 600;
src: url(https://fonts.gstatic.com/s/cairo/v10/SLXLc1nY6Hkvalr-ao6F59ZMaA.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Cairo';
font-style: normal;
font-weight: 600;
src: url(https://fonts.gstatic.com/s/cairo/v10/SLXLc1nY6Hkvalr-ao6L59Y.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
.print-format table, .print-format tr,
.print-format td, .print-format div, .print-format p {
font-family: 'Cairo';
line-height: 90%;
vertical-align: middle;
}
@media print {
body{
font-family: 'Cairo';
width: 220mm;
height: 300mm;
margin: 5mm 5mm 10mm 5mm;
/* change the margins as you want them to be. */
}
}
@media screen {
.print-format {
width: 200mm;
padding: 5mm;
min-height: 300mm;
footer {page-break-after: always;}
}
}
table.no-border, table.no-border td{
margin-top: -20px !important;
}
.table .table-condensed .table-hover .table-bordered .print-format td, .print-format th{
background-color: whitesmoke !important;
}
.print-format td, .print-format th {
}
.print-heading {
float: left !important;
border-bottom: 1px solid #d1d8dd !important;
width: 45% !important ;
}
.alert-logo {
padding: 0px !important;
margin-bottom: .5px !important;
border: 0px solid transparent !important;
border-radius: 4px !important;
text-align: left !important;
color: red !important;
}
.cr{
width: 60% !important;
margin-top: -5px !important;
display: block;
margin-left: auto;
margin-right: auto;
}
.logo-div1{
text-align: right !important;
width: 40% !important;
margin-right: 160px !important;
}
.logo-div2 {
font-family: 'Cairo';
color: darkblue !important;
text-align:center !important;
font-size:18px !important;
}
.logo-div3 {
font-family: 'Cairo';
font-weight:700 !important;
color: darkblue !important;
font-size:14px !important;
margin-top:5px;
margin-bottom: -29px !important;
margin-left: 5px !important;
}
.logo-div4{
font-family: 'Cairo';
color: darkblue !important;
font-size:14px !important;
margin-bottom: -32px !important;
margin-top: -50px !important;
}
.logo-div8{
font-family: 'Cairo';
color: darkblue !important;
font-size:14px !important;
margin-bottom: -15px !important;
margin-top: -38px !important;
}
.logo-div5{
width: 35% !important;
margin-top: 15px !important;
display: block;
margin-left: auto;
margin-right: auto;
}
.logo-div6{
text-align:center !important;
margin-top: 3px !important;
font-family: 'Cairo';
color: darkblue !important;
text-align:center !important;
font-size:14px !important;
}
.logo-div7{
width: 65% !important;
max-height: 45px !important;
margin-top: 19px !important;
display: block;
margin-left: auto;
margin-right: auto;
}
.table-bordered, .table-bordered>tbody>tr>td, .table-bordered>tbody>tr>th, .table-bordered>tfoot>tr>td, .table-bordered>tfoot>tr>th, .table-bordered>thead>tr>td, .table-bordered>thead>tr>th {
border: 0.5px solid #d1d8dd !important;
}
.td1 {
border-bottom: 0.5px solid #d1d8dd !important;
}
.si {
color: darkblue !important;
margin-top: -5px !important;
}
.table-no-b {
border-top: 0 !important;
margin-top: -5px !important;
}
.space {
margin-top: -12px !important;
}
.ql-editor.read-mode {
padding:6px !important ;
}
.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
font-weight: 600 !important;
}
.w1 {
margin-right: 115px !important;
}
.w2 {
border-top: 3px solid #d1d8dd !important;
padding-top: 10px !important;
}
</style>
<div id="footer-html" class="visible-pdf" style="
display: block !important;
position: fixed;
bottom: 0;
width:100%;
">
<div class="letter-head-footer">
{{ footer }}
</div>
<p class="text-center small page-number visible-pdf">
Page <span class="page"></span> of <span class="topage"></span>
</p>
</div>
<br>
<div>
<div id="footer-html" class="visible-pdf">
{% if not no_letterhead and footer %}
<div class="letter-head-footer">
{{ footer }}
</div>
{% endif %}
<p class="text-center small page-number visible-pdf">
{{ _("Page {0} of {1}").format('<span class="page"></span>', '<span class="topage"></span>') }}
</p>
</div>
<table class = "table table-condensed table-no-b">
<tr class="table-no-b" >
<td class="table-no-b" style="width:50%" >
<h1 class="si">{{ doc.company }}</h1>
<b> {{ "الشركة المتحدة للبطاريات السائلة" }} </b><br>
<b>{{ _("رقم السجل التجاري : 655 ") }}</b><br>
<b>{{ _("رقم البطاقة الضريبية : 481688080 ") }}</b><br>
</td>
<td class="table-no-b si" style="width:50%" >
<div class="logo-div1">{{ letter_head }}</div><br>
</td>
</tr>
</table>
<table class = "table table-condensed no-border">
<tr>
<td style="width: 50%;">
<br><br>
<b>{{ _("Supplier Name ") }}:</b> {{ doc.supplier_name }}<br><br>
</td>
<td style="width: 50%;">
<table class="table table-condensed table-bordered">
<tbody>
<tr>
<h5 class="logo-div3">{{ _("امر شراء") }}</h5><br>
<td class="text-left" style="width: 50%">
{{ _(" Invoice number ") }} :
</td>
<td class="text-left">
{{ doc.name}}
</td>
</tr>
<td class="text-left" style="width: 50%">
{{ _(" تاريخ المستند ") }} :
</td>
<td class="text-left">
{{ doc.get_formatted("transaction_date", doc) }}
</td>
<tr>
<td class="text-left" style="width: 50%">
{{ _(" تاريخ الاستلام ") }} :
</td>
<td class="text-left">
{{ doc.get_formatted("schedule_date", doc) }}
</td>
</tbody>
</table>
</td>
</tr>
</table>
<br>
<table class = "table table-condensed table-bordered">
<tr>
<table class="table table-condensed table-hover table-bordered">
<tbody>
<tr>
<h5 class="logo-div4">{{ _("Service & product ") }}</h5><br><br>
</tr>
<tr>
<th style= "text-align: center;">م</th>
<th style= "text-align: center;">كود الصنف</th>
<th style= "text-align: center;">اسم الصنف</th>
<th style= "text-align: center;">كمية</th>
<th style= "text-align: center;">الكميةالمستلمة</th>
<th style= "text-align: center;">سعر</th>
<th style= "text-align: center;">اجمالي</th>
</tr>
{%- for row in doc.items -%}
<tr>
<td style="width: 3%;">{{ row.idx }}</td>
<td style="width: 22%;">{{ row.item_code }}</td>
<td style="width: 30%;">{{ row.item_name }}</td>
<td style="width: 10%; text-align: center;">{{ row.qty }} {{ row.uom or row.stock_uom }}</td>
<td style="width: 10%; text-align: center;">{{ row.received_qty }}</td>
<td style="width: 10%; text-align: center;">{{
row.get_formatted("rate", doc) }}</td>
<td style="width: 15%; text-align: center;">{{
row.get_formatted("amount", doc) }}</td>
</tr>
{%- endfor -%}
</tbody>
</table>
<table class="table table-condensed no-border">
<tbody>
<tr>
{% if doc.flags.show_inclusive_tax_in_print %}
<td class="text-right" style="width: 65%">
{{ _("Total Excl. Tax") }}
</td>
<td class="text-right">
{{ doc.get_formatted("net_total", doc) }}
</td>
{% else %}
<td class="text-right" style="width: 65%">
{{ _("Total") }}
</td>
<td class="text-right">
{{ doc.get_formatted("total", doc) }}
</td>
{% endif %}
</tr>
{%- for row in doc.taxes -%}
{%- if (not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print) and row.tax_amount != 0 -%}
<tr>
<td class="text-right" style="width: 65%">
{% if '%' in row.description %}
{{ row.description }}
{% else %}
{{ row.description }}@{{ row.rate }}%
{% endif %}
</td>
<td class="text-right">
{{ row.get_formatted("tax_amount", doc) }}
</td>
<tr>
{%- endif -%}
{%- endfor -%}
{%- if doc.discount_amount -%}
<tr>
<td class="text-right" style="width: 65%">
{{ _("Discount") }}
</td>
<td class="text-right">
{{ doc.get_formatted("discount_amount") }}
</td>
</tr>
{%- endif -%}
<tr>
<td class="text-right" style="width: 65%">
<b>{{ _("Grand Total") }}</b>
</td>
<td class="text-right">
{{ doc.get_formatted("grand_total") }}
</td>
</tr>
{%- if doc.rounded_total -%}
<tr>
<td class="text-right" style="width: 65%">
<b>{{ _("Rounded Total") }}</b>
</td>
<td class="text-right">
{{ doc.get_formatted("rounded_total") }}
</td>
</tr>
{%- endif -%}
{%- for row in doc.payments -%}
<tr>
<td class="text-right" style="width: 65%">
{{ row.mode_of_payment }}
</td>
<td class="text-right">
{{ row.get_formatted("amount", doc) }}
</td>
<tr>
{%- endfor -%}
{%- if doc.change_amount -%}
<tr>
<td class="text-right" style="width: 65%">
<b>{{ _("Change Amount") }}</b>
</td>
<td class="text-right">
{{ doc.get_formatted("change_amount") }}
</td>
</tr>
{%- endif -%}
</tbody>
</table>
<br><br><br><br>
<table class="table table-condensed table-hover table-bordered">
<tbody>
<tr>
<h5 class="logo-div4">{{ _("Payment Terms") }}</h5><br><br>
</tr>
<tr>
<th style= "text-align: center;">م</th>
<th style= "text-align: center;">بيان الدفعة</th>
<th style= "text-align: center;">تاريخ الاستحقاق</th>
<th style= "text-align: center;">النسبة</th>
<th style= "text-align: center;">مبلغ الدفعة</th>
</tr>
{%- for row in doc.payment_schedule -%}
<tr>
<td style="width: 2%; text-align: center">{{ row.idx }}</td>
<td style="width: 38%; text-align: right;">{{ row.payment_term }}</td>
<td style="width: 20%; text-align: center;">{{row.get_formatted("due_date", doc) }}</td>
<td style="width: 20%; text-align: center;">{{row.get_formatted("invoice_portion", doc) }}</td>
<td style="width: 20%; text-align: center;">{{row.get_formatted("payment_amount", doc) }}</td>
</tr>
{%- endfor -%}
</tbody>
</table>
<br><br>
{%- if doc.terms -%}
<table class="table table-condensed table-hover table-bordered">
<tbody>
<tr>
<h5 class="logo-div4">{{ _("الملاحظات و الشروط و الاحكام") }}</h5><br><br>
</tr>
<tr>
<td>
<p class="cr">{{ doc.terms or "" }}</p>
</tr>
</td>
</tbody>
</table>
{%- endif -%}
Issue is in the style (CSS), because some style do not support in PDF, or something wrong in css.
https://github.com/frappe/erpnext/assets/141945075/4b9ff8e8-cc4f-4cca-afd1-91b9964a9e2f
Thanks for your help @Nihantra-Patel ☺
Information about bug
Hello guys, While I'm printing more than one material request, the system opens a blank PDF although I was printing with the same print format as pdf in v14 FYI The print format is customed not standard
Thanks for you all
Module
buying, other
Version
ERPNext: v15.22 Frappe: v15.25
Installation method
FrappeCloud
Relevant log output / Stack trace / Full Error Message.
No response