Take the actual bill length is 23.9, and the height is 5cm as an example:
1. The printer attributes are set based on the actual length and height of the ticket.
2. measure the offset of each ticket in the vertical direction. (If the first ticket is correctly located, the offset will be increased by 0.4 for each incoming ticket. This value varies slightly with the actual situation)
3. If the data of each ticket is moved up according to the actual printing result, the width of the report ticket is adjusted to 5 cm + 0.4 = 5.4.
4. If the data of each ticket is moved down, the width of the report ticket is adjusted to 5 cm-0.4 = 4.6 when the report is drawn.
5. if the value of the first credential coordinate [0, 0] is not immediately followed by the page line output, but is offset downward, the printer page pointer is directed to the top 2mm of the actual page line, then, in offline mode, click the page button.
Conclusion: two problems need to be solved in order to precisely set and connect. 1) rotate the knob of the printer to locate the correct page, so that the value of the first credential coordinate [0, 0] is output in the correct position; 2) locate the offset between creden, set lodop in the code correctly. set_print_pagesize.
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Title> lodop </title>
<Script language = "JavaScript" src = "lodopfuncs. js"> </SCRIPT>
<Object ID = "lodop_ob" classid = "CLSID: 2105c259-1e0c-4534-8141-a753534cb4ca" width = 0 Height = 0>
<Embed id = "lodop_em" type = "application/X-print-lodop" width = 0 Height = 0 pluginspage = "install_lodop32.exe"> </embed>
</Object>
<Script language = "JavaScript">
Function Preview (){
VaR lodop = getlodop (document. getelementbyid ('lodop _ ob'), document. getelementbyid ('lodop _ em '));
Lodop. print_init ("");
// Set the ticket length and width
Lodop. set_print_pagesize (1, "239", "54mm ","");
For (I = 0; I <= 10; I ++ ){
Lodop. Newpage ();
Lodop. add_print_text (, 20, "coordinate []:" + I );
Lodop. add_print_text (30,0, 100,20, "test" + I );
}
Lodop. Preview ();
};
Function Design (){
VaR lodop = getlodop (document. getelementbyid ('lodop _ ob'), document. getelementbyid ('lodop _ em '));
Lodop. print_design ();
}
</SCRIPT>
</Head>
<Body>
<P>
<Input type = "button" onclick = "Preview ()" value = "print preview" name = "B1">
<Input type = "button" onclick = "design ()" value = "report design" name = "B2">
</P>
</Body>
</Html>