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

Extra spaces added in the pdf from html? #145

Closed
Saad1379 opened this issue Jun 25, 2022 · 2 comments
Closed

Extra spaces added in the pdf from html? #145

Saad1379 opened this issue Jun 25, 2022 · 2 comments

Comments

@Saad1379
Copy link

Saad1379 commented Jun 25, 2022

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

@Aymkdn
Copy link
Owner

Aymkdn commented Jun 27, 2022

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

Aymkdn added a commit that referenced this issue Jun 28, 2022
added option `removeExtraBlanks` to remove extra blank spaces (see issue #145)
Aymkdn added a commit that referenced this issue Jun 28, 2022
added option `removeExtraBlanks` to remove extra blank spaces (see issue #145)
@Aymkdn
Copy link
Owner

Aymkdn commented Jun 28, 2022

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

@Aymkdn Aymkdn closed this as completed Jun 29, 2022
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

2 participants