Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

page-break not working #717

Open
za1sle opened this issue Aug 23, 2024 · 0 comments
Open

page-break not working #717

za1sle opened this issue Aug 23, 2024 · 0 comments

Comments

@za1sle
Copy link

za1sle commented Aug 23, 2024

Hi, I'm using the package in Django framework. This is the element I'd like to transfer to PDF:

{% for action_item in action_items_data %}
<div class="{{ action_item.category }} care-plan content" style="break-inside: auto; break-after: auto; break-before: auto;">
  <h4>{{ action_item.category_display }} - {{ action_item.title }}</h4>
  {% for sentence in action_item.text %}
    <span>{{ sentence | safe }}</span>
  {% endfor %}
</div>
{% endfor %}
var opt = {
    margin: [-0.5, 0, 0, 0],
    image: { type: 'jpeg', quality: 0.98 },
    html2canvas: { scale: 4 },
    jsPDF: { unit: 'in', format: 'a4', orientation: 'portrait' },
    pagebreak: {mode: "css"}
}
html2pdf().set(opt).from(element).save();

When the content of an element exceeds one page, the extra content is not displayed in the PDF after conversion.
image

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

No branches or pull requests

1 participant