Muhammad Irfan
Muhammad Irfan

Reputation: 1457

How to test window.print function of JavaScript when printer is not available?

Well, i am using JavaScript window.print() method and has no printer attached so can i get the output as an image or pdf to be sure that i am getting the desired output??

Upvotes: 1

Views: 713

Answers (3)

awe
awe

Reputation: 22452

In most new browsers, you have a print preview function that you can use to see if you get desired output based on your media:print setup in the css. window.print in Javascript is just to trigger the print function in the browser, and really have nothing to do with how the print looks.

Upvotes: 0

Andrei G
Andrei G

Reputation: 1590

try installing a print-to-pdf program like this one CutePDF

Upvotes: 1

Darin Dimitrov
Darin Dimitrov

Reputation: 1038990

You can't do this. You cannot test if a printer is available or not on the client machine unless you use some browser plugin.

Upvotes: 1

Related Questions