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

Blank line added below of every paragraph #238

Closed
paulosobrinho33 opened this issue Feb 10, 2025 · 1 comment
Closed

Blank line added below of every paragraph #238

paulosobrinho33 opened this issue Feb 10, 2025 · 1 comment

Comments

@paulosobrinho33
Copy link

Hello,

If you have a paragraph in html, html-to-pdfmake adds a blank line ({ "text": " "}) below it.

Example:
HTML
<p>This is an example paragraph</p>

PDFMAKE
var dd = { "content": [ { "text": " This is an example paragraph. ", "nodeName": "P", "margin": [ 0, 5, 0, 10 ], "style": [ "html-p" ] }, { "text": " " } ], "styles": {} }

Is there any way to switch off this behavior?

With this option I think would be easier to control the spacing between paragraphs.

Thanks in advance.

@Aymkdn
Copy link
Owner

Aymkdn commented Feb 11, 2025

It only adds an additional blank line because you put a blank line, like that:

<p>This is an example paragraph</p>
   <!-- the blank line is here -->

But I suppose your case is more complex than that? You can try the removeExtraBlanks, and you can remove the end blank space at the end of your HTML string:

htmlToPdfmake(`<p>This is an example paragraph</p>
    `.replace(/\s+$/, ''), { removeExtraBlanks:true })

@Aymkdn Aymkdn closed this as completed Feb 11, 2025
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