Custom Print Format - PDF - No page break, bug?

Hi guys

I have a strange behavior, I create a new custom print format with this code

<!-- HEAD -->
<div  id="header-html" class="hidden-pdf" >
    {% set letter_head_name = frappe.get_all('Letter Head', filters={'is_default': 1}, fields=['name']) %}
    {% if letter_head_name %}
      {% set letter_head = frappe.get_doc("Letter Head", letter_head_name[0]) %}
      {% if letter_head %}
        {{ letter_head.content }}
      {% else %}
        <p>Defalut letter head not found.</p>
      {% endif %}
    {% else %}
      <p>No default letter head found. Please define a default letter head.</p>
    {% endif %}
</div>


<div class="row section-break">
<div class="page-break"></div>
<div class="col-xs-12 column-break">
    	<div style="padding: 10px 0px" data-fieldname="terms" data-fieldtype="Text Editor">
		{{ doc.terms }}
	</div>
</div>

<!-- page footer -->
<div id="footer-html" class="visible-pdf">
   <!-- center><p style="font-size: 8pt !important;">{{ _("Page") }} <span class="page"></span> {{ _("of") }} <span class="topage"></span></p></center -->
   {% if letter_head %}
     {{ letter_head.footer }}
   {% else %}
     <p>No letter head found. Please define a letter head under print settings and mark it as default</p>
   {% endif %}</span></p>
</div>

and I get this preview

but when I generate the pdf

There is something wrong in my code ?.

This are the version numbers
image

Thank you in advance
Best Regards

Can you try to remove the div-nesting? The page break tag is correct

<div class="page-break"></div>

and it should work in the given version without issues.

And make sure that it is marked as custom format (not simply an html block in the print format builder, that will not work):

Hi @lasalesi

I already have the custom format check and already try the break page as you recomend me with no look :disappointed_relieved:

I’m really lost … the test is running in a VM downloaded from erpnext and updated a few days ago.

Thank you again.

I have some news,

I create a new example with this code
http://erpnexttutorial.blogspot.com/2017/02/erpnext-sample-print-format-for.html

And add the page break just before the {{ doc.terms }}

and voila, works like a charm

I suppose that some css create a conflict with page break, perhaps something related to the seccions.

I’ll wait for someone that can figure out the real problem.

Thank you in advance

1 Like