Node.JS HTML to PDF - node.js

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

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

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

Related

Is there a way to generate PDF from specific HTML elements with CSS using Puppeteer?

I am trying to generate a PDF (as an A4 page) from a specific div in my HTML page along with it's style. Is there a way to do that without using addStyleTag? There is a lot of style and addStyleTag simply won't work.
Thank you.

I wanted to know what can I use to place objects anywhere in a website, like positioning a table in any part of the website? Thank you

I'm new to HTML and I would like to know how to place any object in any part of the website, for example, a table between the center and the left side. Thank you
HTML is about the structure of your website and webpage. Once you have the structure with all the elements written in HTML, you can customise their display and position through CSS (it's another language). Check this page to get a first understanding of how it looks like https://www.w3schools.com/css/.

Custom Jade Renderer

I would like to change the code before or after jade render HTML. I need to change the code to add some specific functions. For example
h4#headline Click to register
a(href="myLink", data-type="foo") Here
I would like to prepare all links or html tags with data-type by the value in the tag.
Is that possible or has anybody experience with that?
Thanks for help!

display only the content of a page in lightbox2 in drupal

I am using drupal.I have to display the content of a page in lightbox2.(only the content not header,footer,menubar,sidebar etc).The url of that content node is http://mysite.com/node/1.
I have included the lightbox2 module and used the below code
<li>click here to see node content</li>
But the lightbox displays the whole page not only the content.i need only the text content.
One more option in that you can pass a parameter in get method for lightbox2 content.
Based on the parameter add condition in page.tpl.php
Not the best of the solution, but achievable.
Create a new page.tpl for node/1 and print only $content in this.
this way you will make sure you only get content and nothing else
I Agree with Vaibhav Jain, you can create a theme for the page without the header, left and right, footer. only the content and call that page inside the lightbox

Printing a webpage with JSF

I have seen webpage with a PDF icon, where you could click on it to print the content of that webpage.
The page i am intending to add the print feature is designed in JSF, so is there anyway where i could add a print button, to get the webpage printed ?
No, you must do this yourself. Get some PDF library (for example iText), then get web page output (plain HTML). Then you will have to iterate thru HTML and create PDF version (for example build iText document). You will probably have to do this yourself, because some elements (javascript powered) will need to turn into static content. Nobody but you knows how the output should look like.

Resources