EaBengaluru
EaBengaluru

Reputation: 71

Why html2pdf generator is leaving gap and generating 1 extra page upon print

Hi i'm using html2pdf plugin.

1st problem is it is leaving gap and not occupying whole A4 size paper as shown in below image

enter image description here

2nd problem it is adding 1 more extra page upon print

Please click on Generate Pdf button to see the pdf

here is what i have tried:

https://codesandbox.io/s/interesting-shamir-8bdo2x?file=/src/components/A4.vue

Upvotes: 2

Views: 1486

Answers (1)

tuhin47
tuhin47

Reputation: 6058

For the first problem, you don't need to add CSS class for A4.vue. Rather then, you can add this CSS for A4 page :


@page {
  size: A4 portrait;
  margin: 16mm;
  font-family: Arial, sans-serif;
  font-size: 10pt;
}
@page landscape {
  size: A4 landscape;
}

@page portrait {
  size: A4 portrait;
}

For the 2nd problem, I don't get your question properly. I think you might not include the full A4_no2.vue

See the sandbox. It may help you.

Upvotes: 2

Related Questions