Printing | Solving problems about solving printing problems in a page
/*
Tofu production is a boutique
Http://www.asp888.net Tofu Technology Station
If reproduced please retain the full copyright information
*/
We all know that today's B/s application more and more, we do the procedure often encounter needs to print the report of the situation, but
We know that it is difficult to control the client printer of IE, except for the Window.print control. No
Any other way, and sometimes we have to be preview first, then print, sometimes we also have to page setup after
To print, how to do?
Some friends may have found that, under IE's File menu, these are all available, but how to invoke these menus through scripting programs?
After Cafecat sample's hint, finally found that the use of an ActiveX control can achieve this function, please see the following code
<object classid=clsid:8856f961-340a-11d0-a96b-00c04fd705a2 height=0 ID=WB width=0></object>
This object is actually Iewebbrowser set Width and Height, we can not see the shape of the control in the interface
Then we can use this object to implement our paper selection and preview function.
<script language= "JavaScript" >
function Doprintsetup () {
Print settings
WB. EXECWB (8,1)
}
function DoPrintPreview () {
Print Preview
WB. EXECWB (7,1)
}
</script>
Of course, this does not completely solve the problem of client printing, tofu will be in the future article on this issue for further discussion