Reputation:
How can we print using print document so that we can control the printer paper size?
Upvotes: 2
Views: 4901
Reputation: 6401
Maybe too late but I'm adding for future reference; you could use a kind of download/print manager utility. Imagine the torrent magnet links, you click a link and a .torrent file opened by torrent client, it reads the necessary info and do the rest at client site.
So you have to write a little utility which one recognizes these 'print jobs' from your web site. You click a [Print Invoice] link and browser downloads a unique .print file and the utility captures it.
The .print file has two parts: 1. Header and 2. The file (pdf/jpg/any). Header contains predefined printer/paper size/orientation/etc or just asks for user input. And then prints the file from 2. part/body.
You may also queue the print jobs and manage them as well.
You have to install that utility; define a protocol like http:// or ftp:// to capture print links from the utility. And set printers/papers/etc for specific jobs like invoices/color printings/etc.
These will be what I'll do when I port our winforms app to web. Plus If you are on a LAN environment then you would print the things from the web server to network printers.
Upvotes: 1
Reputation: 24634
Your best option is to generate PDF-files with the appropriate siez in it. A printer should choose the correct page-size based on that unless the user manually changes it in the print-dialog.
Cirrcumventing the print-dialog is a security-restriction, ActiveX or a firefox-extension is your only alternative then, which might be okay on an intranet-based webapplication.
Upvotes: 4
Reputation: 5963
I have looked into this before, and the only way to force things like portrait/landscape etc, is to get the user to install an ActiveX control (or similar).
Javascript or CSS alone cannot do it.
Upvotes: 0
Reputation: 5620
I believe a Java applet has the ability to set paper size if you grant it the proper privileges. I think your users will almost certainly have to jump through hoops for this to work...
Upvotes: 1
Reputation: 12936
The only way that I've been able to have this amount of control over the printer client side is to create an ActiveX component that would handling the printing interface and go from there. It's not cross-broswer not the cleanest solution; however, it's the only way that I've been able to manage paper size. I looked into a CSS @print options but was not able to find one that could truly control the size.
The only other possibility is to look to see what printing capabilities something like Flash or Silverlight have. I'm not familiar enough to say if they do or don't have what you're looking for; however, it may be another option.
Upvotes: 2
Reputation: 1227
As a user I don't want that when I enter a site someone to change my printer's settings or to take control over my printer.
For security reasons I hope this is not possible.
Upvotes: 4