I am trying to print my div content using printElement plugin. The div has a lot of text with in so there is a scrollbar. The problem is that plugin prints only the part of text which is actually on the screen. How can I print all of the text?
EDIT:
I need a solution which will print this div with styles which are in external css.
To print the content of div in JavaScript, first store the content of div in a JavaScript variable and then the print button is clicked. The contents of the HTML div element to be extracted.
jQuery Code:click(function(){ window. print(); return false; });
The jQuery syntax is tailor-made for selecting HTML elements and performing some action on the element(s). Basic syntax is: $(selector).action() A $ sign to define/access jQuery. A (selector) to "query (or find)" HTML elements. A jQuery action() to be performed on the element(s)
Have a look at this:
http://www.bennadel.com/blog/1591-Ask-Ben-Print-Part-Of-A-Web-Page-With-jQuery.htm
https://github.com/jasonday/printThis
Configurable with additional css files, and other options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With