Sunday, May 12, 2024
 Popular · Latest · Hot · Upcoming
47
rated 0 times [  50] [ 3]  / answers: 1 / hits: 108748  / 13 Years ago, fri, september 23, 2011, 12:00:00

suppose i have many div's in my page but i want to print the content of specific div using jquery. i found there is a plugin for that.



jQuery Print Element



using this plugin we can easily print div content like below.



$('SelectorToPrint').printElement();


but what happen if my div is hidden in page. so then does it work. this plugin can print the content of hidden div?



what happen if printer is not attach with client machine. i want to show message if printer is not there to customer that Printer not found? how to handle this situation. so please advise me what would be the best approach to print the content of hidden div in page and as well as handle printer issue if printer is not attached.



thanks


More From » jquery

 Answers
22

If a hidden div can't be printed with that one line:


$('SelectorToPrint').printElement();

simply change it to:


$('SelectorToPrint').show().printElement();

which should make it work in all cases.


for the rest, there's no solution. the plugin will open the print-dialog for you where the user has to choose his printer. you simply can't find out if a printer is attached with javascript (and you (almost) can't print without print-dialog - if you're thinking about that).


NOTE:



The $.browser object has been removed in version 1.9.x of jQuery
making this library unsupported.



[#89957] Wednesday, September 21, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
harleyaleenag

Total Points: 678
Total Questions: 121
Total Answers: 105

Location: Papua New Guinea
Member since Thu, Jul 9, 2020
4 Years ago
harleyaleenag questions
Thu, May 5, 22, 00:00, 2 Years ago
Wed, Aug 19, 20, 00:00, 4 Years ago
;