LODOP specified window and temporary default printer default printer

By following statement, you can specify the default windows printer
LODOP.SET_PRINT_MODE ( "WINDOW_DEFPRINTER", a printer name or serial number);
this means that the default printer is the default printer windows operating system.
A commonly prescribed method is to enter the windows control panel, and then enter the printer device-related options, windows printer list, select the default printer to be set, then right - selected as the default printer. This is the windows default printer, the printer has a check mark in the list is the default printer.
With this statement, you can modify windows default printer by the statement.

The method of modifying the default windows (not shown) of the printer

In addition, there are other methods to select the printer, such as access to the printer list in the page that allows the user to select (Related Bowen: LODOP page to allow customers to choose a printer , Lodop get the list of printers select the printer in the page preview , C-Lodop get the list of printers Create_Printer_List , LODOP set the printer does not exist does not print )
LODOP there is also a temporary default printer, the default printer and windows are different, a distinction.
Temporary default printer: LODOP.SELECT_PRINTER () ;, after such a default printer selected, refresh the page and other operations, the default printer will fail, need to re-select.
After setting the default printer temporarily by the statement, the page is no longer all code printing tasks specified printer will use the temporary default printer, refresh the page or close this temporary default printer becomes ineffective.

But it has been specifically developed for the task in the printer, if you select before temporary default printer, LODOP and C-LODOP performance is different.
Test procedures and results: (such as code and there are four methods)
Method 1: windows default printer settings.
Method 2: temporary default printer settings page
Method 3: a task not specified in the code of a particular printer.
Method 4: specifies a specific task xps printer in the code.

Test temporary default printer, the first printer 2 specify what method, then, the task is not specified and the specified printer tasks were to view the current printer.
LODOP effects:
1. not specified in the code of a particular printer, a temporary default printer is selected.
2. In the specific code specifies xps printer, the printer is xps.
C-LODOP effects:
1. not specified in the code of a particular printer, a temporary default printer is selected;
2. xps code specifies a particular printer, or choose a temporary default printer.
Note: that is, c-lodop, the page specified temporary default printer, even if reassigned a new printer in the code, there is no effect.

Before someone printer specified statement written correctly, the printer name also, but that the printer does not take effect, and later found out before specifying a specific printer, He first page, select the temporary default printer, and is taking the c-lodop way, resulting in how not to take effect.
Select the temporary default printer, and then specify the printer, with respect to the conflict, c-lodop then specify no effect, resulting in this phenomenon, so do not use this, select the printer still many methods, and have a certain priority will be back there Bowen introduced.

If the first with this temporary default printer, you can not specify a specific mission statement printer, because chose this temporary printer, all print jobs are equivalent to the page of this printer. Although the test again lodop can be reassigned, but c-lodop not, so if you use this temporary default printer, set back no longer specify a specific printer statement.
This temporary printer refresh the page Close, etc., will fail, so it can not select a printer of this method .

Test code:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>WEB打印控件LODOP</title>
<script language="javascript" src="LodopFuncs.js"></script>
</head>
<body>
<div id="d1">
内容
</div>
<a href="javascript:prn1_preview()">Set as Default Printer windows .... the HP </ A > < br > 
< A href = "JavaScript: prn2_preview ()" > page select temporary default printer </ A > < br > 
< A href = "JavaScript: prn3_preview ( ) " > code does not specify a printer </ a > < br > 
< a the href =" JavaScript: prn4_preview () " > code specifies the printer .. XPS </ a > < br > 
< Script Language =" JavaScript " type="text/javascript">   
        var LODOP; //声明为全局变量 
    function prn1_preview() {//windows默认打印机
        LODOP=getLodop();  
        LODOP.PRINT_INIT("");
        if (LODOP.CVERSION) CLODOP.On_Return=function(TaskID,Value){alert(Value);};
        var strResult=LODOP.SET_PRINT_MODE("WINDOW_DEFPRINTER","HP Color LaserJet 1600 Class Driver");
        if (!LODOP.CVERSION) alert(strResult);

    };
    functionprn2_preview () { // page temporary default printer 
        LODOP = getLodop ();  
         IF (LODOP.CVERSION) { 
            LODOP.On_Return = function (TaskID, Value) { IF (Value > = 0 ) Alert ( " choose success! " ); the else Alert ( " selection fails! " );}; 
            LODOP.SELECT_PRINTER (); 
            return ; 
        }; 
            IF (LODOP.SELECT_PRINTER () > = 0 ) 
            Alert ( " choose success! " ); the elseAlert ( " selection fails! " ); 

    }; 
    function prn3_preview () { // code does not specify any printer 
        LODOP = getLodop (); 
        LODOP.PRINT_INIT ( "" ); 
        LODOP.ADD_PRINT_HTM ( 0 , 0 , " 100% " , " 100% " , document.getElementById ( " D1 " ) .innerHTML); 
        LODOP.PRINTA (); 
        // LODOP.PREVIEW ();     
    };
     function prn4_preview () { // the specified printer specific code 
        LODOP=getLodop(); 
        LODOP.PRINT_INIT("");
        LODOP.SET_PRINTER_INDEX("Microsoft XPS Document Writer");//指定某虚拟打印机
        LODOP.ADD_PRINT_HTM(0,0,"100%","100%",document.getElementById("d1").innerHTML);
        LODOP.PRINTA();
        //LODOP.PREVIEW();    
    };

</script> 
</body>

Illustrated: FIG here is not the actual output, with Printa, the printer selection box will pop up directly, without modification, can view the current printer.

 

Guess you like

Origin www.cnblogs.com/huaxie/p/11242743.html