2

I want to convert the HTML to PDF for which I am using this package (https://www.npmjs.com/package/html-pdf).

But in this HTML I am also getting tables and that tables can come in any position in HTML. So I want to copy the table thead to another page if the table in the HTML exceeds more than 1 page.

Can you please help me on this.

Thanks in advance

Ravi Badoni
  • 67
  • 2
  • 5

2 Answers2

0

You're going to have to modify the CSS of the page to properly handle a printable view.

See also: Repeat table headers in print mode

Brad
  • 146,404
  • 44
  • 300
  • 476
  • Hello Brad, I have already checked this, Node.Js is not accepting this. – Ravi Badoni Mar 22 '18 at 05:43
  • @RaviBadoni Node.js doesn't have to "accept" anything... you need to inject the CSS into the page for PhantomJS to render it. That's what your package is using. – Brad Mar 22 '18 at 05:57
  • I have injected the thead css in HTML and sent the request to node, still I am getting pdf but thead is not copied to another page – Ravi Badoni Mar 22 '18 at 06:04
0

Try to use Puppeteer to create PDF from HTML

Example from here https://github.com/chuongtrh/html_to_pdf

Or https://github.com/GoogleChrome/puppeteer

Chuong Tran
  • 1,923
  • 11
  • 20