Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have an ASP.Net page. I want to print that page 3 times, 2 copies should carry "COPY WORD, as a watermark".
I have written this code code to print three copies, but it's asking confirmation about the printer.

 $("#btnPrint").click(function () {
                var index = 0;
                for (index = 1; index <= 3; index++) {
                    if (index > 1) {
                        $("#test").css("background-color", "gray");
                        window.print();
                    }
                    else {
                        window.print();
                    }
                }
});

Please Help me.

share|improve this question

closed as off topic by maple_shaft Jul 14 '12 at 12:49

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

Quick Answer: It can't be done, with pure js library.

Rather than just telling you that it can't be done I thoght that an explanation of why such an option is not possible would be more useful.

Which print dialog box displays when someone presses the print button in their browser or the Javascript window.print() method runs depends on the operating system and what printers are installed on the computer.

However, you can Set default styles, some CSS, And preferences to the printer:

<style media = "print">
  @import url("css.css");
</style>

Setting preferences to the printer: CSS How-to: Optimize Pages for Printing Using CSS

Documentation

share|improve this answer
1  
+1. Explaining why, offering an alternative, linking to documentation. – S.L. Barth Jul 14 '12 at 10:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.