Print specific parts of an html page

Hello !

Well, i am working on an app where a part of it, consists on generating bills for clients.
I am using autoform and tabular.
The bill contains certain information presented in a table.
I only need to print this table (on the html page) to PDF or docx.

Thanks

In the past I solved the exact same problem by sending the inner html of the table to the server (if I remember correctly, I used Meteor.methods for this). On the server, inside the handler I merged the inner html with the CSS(Bootstrap), which was read at startup and gave the result to phantomjs.

1 Like

There are lots of jquery and pure javascript solutions that basically take an element, create a temporary iframe (or popup) with the contents of the frame, inject in a print.css or page’s own css, and then call the browser’s print method.

Here’s an example:

You can do something like this or use any one of the hundreds of plugins/scripts that turn out for a google search on “print part of page with javascript”

1 Like

Thank you guys for your replies
I will try the solutions you proposed
Hope they’ll help :smile: