marcbachmann / node-html-pdf

This repo isn't maintained anymore as phantomjs got dreprecated a long time ago. Please migrate to headless chrome/puppeteer.
MIT License
3.56k stars 545 forks source link

Pdf #521

Closed angeltg83 closed 5 years ago

angeltg83 commented 5 years ago

after executing my html with html-pdf version 2.2.0 it was deformed in the style, before I used html-pdf version 1.5 but updated it by the updated version of node v10.16.0

attack de file ODA.pdf

Serhioromano commented 5 years ago

Please make your title self explanatory.

angeltg83 commented 5 years ago

yes, when I invoke the html-pdf function with the new version of the library, the resulting pdf is displayed outside the margins !!

angeltg83 commented 5 years ago

in the previous version of 1.5 it does not give that error and the resulting pdf is displayed correctly

Serhioromano commented 5 years ago

Add to HTML <table style="max-width: 500px">.

angeltg83 commented 5 years ago

the solution is to modify the html source?

Serhioromano commented 5 years ago

Yes. I had the same problem with images. Those were clipped out. I added this style tag and it worked. I just replace HTML text before passing to create PDF

while (str.match(/(<img src="\.\.\/)/ig)) {
    str = str.replace('<img src="../', '<img style="max-width:400px" src="../');
}
angeltg83 commented 5 years ago

It is a mistake that should be corrected, it cannot be that when updating the version the final pdf overflows even everything enlarges letters and margins and images.

please!!

Serhioromano commented 5 years ago

It is quite normal way to make adjustments to your document before conversion. Do not you expect to get HTML to PDF converter that simply convert into documents you immediately like? This does not exists. That is why this tool have parameters for borders, fonts, ....

angeltg83 commented 5 years ago

ok..

rubenheymans commented 4 years ago

It is quite normal way to make adjustments to your document before conversion. Do not you expect to get HTML to PDF converter that simply convert into documents you immediately like? This does not exists. That is why this tool have parameters for borders, fonts, ....

This does exist though, we can now generate pdf files in a headless chrome with puppeteer. It just takes your html page 1 on 1, no more pdf hell!