kempsteven / vue-html2pdf

vue-html2pdf converts any vue component or element into PDF, vue-html2pdf is basically a vue wrapper only and uses html2pdf.js behind the scenes.
https://www.npmjs.com/package/vue-html2pdf
MIT License
432 stars 75 forks source link

Use html2pdf__page-break only if necessary #140

Closed JacquesJahnichen closed 1 year ago

JacquesJahnichen commented 2 years ago

First of all thanks for this plugin.

How can I add a break (html2pdf__page-break for example) only if an element is cut ? The size of my document is variable. Exemple :

image

JacquesViviarto commented 2 years ago

A little reminder on this subject

JacquesViviarto commented 2 years ago

If anyone has an idea to solve this problem, I welcome it.

JacquesJahnichen commented 1 year ago

One way to solve this is to use section

  <section class="pdf-item">
    <OrderDiscount />
  </section>
  <section class="pdf-item">
    <OrderConditionPrice />
  </section>
.pdf-item {
  page-break-inside: avoid;
}

You can also find options in : https://ekoopmans.github.io/html2pdf.js/#page-breaks