1

Usually if we print a page it will print the whole page and we have option to print number of copies. Here is the problem, for my erp application i don't want to give number of copies in the print dialog, somehow that option should disable through program (or) my page should print with only one copy without going to the print dialog box itself.

So, the print option should be available, but I want the user to be only able to print one copy of my page. How to achieve this?

Yaakov Ellis
  • 40,752
  • 27
  • 129
  • 174
Raki
  • 361
  • 2
  • 13

4 Answers4

3

Forget about it, nothing you can do except building your own browser :D and force users to use only that one.

simply-put
  • 1,068
  • 1
  • 11
  • 20
  • K that's fine. Is this possible to do how to print only one copy and user cant operate on number of copies.(I think for every problem there is a solution right). – Raki Feb 27 '13 at 07:01
  • 2
    Every problem do have solution if you are up for it for eg. build your own drivers, browsers and forcing your users(client) to use them instead of standard one. – simply-put Feb 27 '13 at 07:03
1

You can not force a browser to allow only one copy to be printed of your page. That is impossible.

Also, disabling the print dialog (to avoid the page of being printed at all) is not possible in HTML/Javascript. So, there is nothing you can do about this.

However you can define different CSS for print layout, so you could "hide" all elements and your users will not be able to print your page (however that can be annoying):

@media screen {
    body { /* css */}
}
@media print {
    body { display: none; }
}
Uooo
  • 6,204
  • 8
  • 36
  • 63
  • If so, could you tell me how to disable the number of copies appear on the print dialog – Raki Feb 27 '13 at 06:43
  • Disabling number of copies is also not possible. I added an alternative to avoid printing to my answer (this will only print an empty page). – Uooo Feb 27 '13 at 06:44
  • Actually my page must print with one copy.i don't want to avoid printing also – Raki Feb 27 '13 at 06:50
  • 2
    I fear this is not possible. Even if it was, the user could still use the one copy that was printed, go to a copier and copy it how often he wants to ;-) – Uooo Feb 27 '13 at 06:54
  • 1
    @w4rumy, haha, very true i like the part go to a copier and copy it – simply-put Feb 27 '13 at 07:05
  • quite hard making a copy if we're talking about stuff out of a thermal receipt printer that gets printed on branded paper... – Nick M Feb 02 '19 at 20:29
0

If you're running the page from a CD, you could use the .bat trick to silently print from the command line. But from the web browser, you cannot bypass the print dialog. Advertisers would be printing out flyers to your printer if this was possible.

However, you may use this HTML / Javascript One Click Print (no dialogs) and force users to use Internet Explorer. This is not recommended unless absolutely necessary.

Community
  • 1
  • 1
Samuel Liew
  • 76,741
  • 107
  • 159
  • 260
0

You can do it, but only for intranet and for IE (as i know).

You won't do it for public website as it demands manipulating ActiveX on a page and also you have to decrease the security level of you browser (it was IE in my case) which is only possible for controlled environment and increase security risks.

Georgii Gonchar
  • 436
  • 2
  • 4