Aymkdn/html-to-pdfmake

Extra spaces added in the pdf from html?

Saad1379 opened this issue · 2 comments

Is there anyway to remove the extra spaces that are being caused by styling html elements. I have attached the screenshot of the issue. My HTML code is as follows:

<div class="heading_3_subsections" data-sectionid="3" data-subsectionid="1">
  <h3 class="section_3_subHeading"
    style="font-size: 16px; font-weight: 700;  color: #1F497D; text-align: left ;"><span class="headingNo">1.1</span> Lorem Ipsum</h3>
  <p class="subText" style="font-size: 14px; font-weight:300" contenteditable="true">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Optio deserunt eius in laboriosam quae, tempora quisquam nobis, modi unde, iste debitis nostrum rem esse perferendis harum minima? Nulla, eos dolore?
  </p>
</div>
<div class="heading_3_subsections" data-sectionid="3" data-subsectionid="1">
  <h3 class="section_3_subHeading"
    style="font-size: 16px; font-weight: 700;  color: #1F497D; text-align: left ;"><span class="headingNo">12</span> Lorem Ipsum</h3>
  <p class="subText" style="font-size: 14px; font-weight:300" contenteditable="true">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Optio deserunt eius in laboriosam quae, tempora quisquam nobis, modi unde, iste debitis nostrum rem esse perferendis harum minima? Nulla, eos dolore?
  </p>
</div>

image

Sorry I was off for the week-end, and quite busy today. I'll check this issue as soon as I can.

Update to v2.4.4 and try the removeExtraBlanks:true option (it's behind a flag because it could be resource consuming depending on how big is the provided HTML code):

var html = htmlToPdfmake(`YOUR HTML CODE`, {removeExtraBlanks:true});

image