A. What is Lodop
Lodop from "Load or print" is an excellent web printing control.
In the B/s system, the traditional print control is always "page see what can print what", lack of flexibility, so that printing slightly inflexible. And the use of LODOP can do "only see, print want to play", not only developers can set the output of the printed content, users can also make a series of adjustments to print content.
The Lodop control currently has Simplified Chinese, Traditional Chinese, large five yards (Big5), and several versions in English.
Suitable for IE series browser, Firefox series browser and IE kernel browser (roaming, 360, the window of the world, Tencent TT, Sogou, etc.) and other types of browsers.
The advantages of using LODOP as a Web Printing control:
1, simple, easy to use, in JS through the function of the call can achieve a complex print task development, greatly reducing the volume of print function development.
2, any content in the Web page is printed out when the cut material, use the JS statement of the current page in a region hypertext display in the established print layout of the output, its location in the print layout can be controlled, but also by the user in the operation of the adjustment.
3, all kinds of adjustment and printing settings, such as the control of all local automatic preservation, a thorough solution to a large software engineering project in the type of complex printer when the precise set of problems.
4, the use of plug-in technology to achieve Web printing, plug-in installation is not only simple, and high success rate.
Two. LODOP Development Package Introduction
There are three main files in the LODOP development package:
Install_lodop.exe is a control installation and upgrade file that is provided to users or developers to download the installation.
Checkactivx.js This file is a JS file that is used to boot the installation control.
The task of the Checklodop method is to check whether the control is installed, the latest version, and boot the installation or upgrade.
Npactivexfirefox4x.xpi This file is a Firefox browser needs to install additional files, because the platform only supports IE kernel browser, so this document does not need.
three. How to use in the platform
In the source code Webroot set up a folder Lodop, folder into Install_lodop.exe and checkactivx.js two files.
Among them, the contents of the Checkactivx.js file should read:
function Checklodop () {
var Oldversion=lodop. Version;
Newverion= "5.0.2.3";
if (oldversion==null)
document.write ("document.write ("
1. Embed ActiveX controls using <object> Tags:
Embed the LODOP plug-in in <object id= "Lodop" classid= "Clsid:2105c259-1e0c-4534-8141-a753534cb4ca" width=0 height=0></object>
2. Introduction of Checkactivx.js Documents
Deploying Checkactivx.js as a resource file allows you to use the browser's cache to reduce repetitive downloads of page content and improve execution efficiency.
Introduce checkactivx.js files between <script language=jscript src= ". /lodop/checkactivx.js "></SCRIPT>
3. Create the Lodop object and invoke the validation method:
Create the Lodop object in the initialization method in the JavaScript page check and invoke the validation method:
function Customizeiniobj ()
{
This writes the initialization of the related object of the custom code
var Lodop=document.getelementbyid ("Lodop");
Checklodop ();
}
Generates the Lodop object in the initialization method so that the related method of printing can be invoked at any time.
At this point, lodop use of the environment to complete, now can be called by the relevant functions to achieve a variety of printing functions of the development.
For example, the form page has the following contents:
ID: <input type=text id=text_0 maxlength=50 name=text_0>
USERNAME: <input type=text id=text_1 maxlength=50 name=text_1>
PASSWORD: <input type=text id=text_2 maxlength=50 name=text_2>
SEX: <input type=text id=text_3 maxlength=50 name=text_3>
Age: <input type=text id=text_4 maxlength=50 name=text_4>
EMAIL: <input type=text id=text_5 maxlength=50 name=text_5>
The development of printing-related features in javascript:
Build what you want to print out:
function Createprintpage () {
Lodop. Print_init ("Perform LODOP print Test ...");
Lodop. Add_print_text (30,60,170,20,document.getelementbyid ("Text_0"). Value);
Lodop. Add_print_text (60,60,170,20,document.getelementbyid ("text_1"). Value);
Lodop. Add_print_text (90,60,170,20,document.getelementbyid ("Text_2"). Value);
Lodop. Add_print_text (120,60,170,20,document.getelementbyid ("Text_3"). Value);
Lodop. Add_print_text (150,60,170,20,document.getelementbyid ("Text_4"). Value);
Lodop. Add_print_text (180,60,170,20,document.getelementbyid ("Text_5"). Value);
}
Where: Print_init () is the initialization method, must have, parameters as the print task display, or as a PDF file when printing the file name.
"Page code controls printers through controls" This is the basic idea of LODOP. So each content has to be paged to the control, the control will not go to the page to get information,
Preview Method:
function Print_view () {
Createprintpage ();
Lodop. PREVIEW ();
}
Printing method:
function print () {
Createprintpage ();
Lodop. PRINT ();
}
Print Maintenance:
function Print_setup () {
Createprintpage ();
Lodop. Print_setup ();
}
Print Design:
function Print_design () {
Createprintpage ();
Lodop. Print_design ();
}
The difference between print maintenance and print design is:
Print maintenance is open to the user, and the user can adjust the position of each printed element in the printed page.
"Print Design" is a helper development tool open to programmers, using graphical drag-and-drop design to help programmers quickly generate code.
Page calls each method:
<button Onclick=print_view () > Print preview </BUTTON>
<button onclick=print () > Printing </BUTTON>
<button onclick=print_setup () > Print Maintenance </BUTTON>
<button onclick=print_design () > Print design </BUTTON>
four. Main functions of Lodop
In addition to the most important basic printing features, LODOP has the following features:
1. Export data to Excel files
2. Control paper size and continuous printing
3. Print Maintenance function permissions
4. Get information about system printing equipment
5. Support page address (URL) printing
6. Get Client System Information
7. Read and write local files
Five. Development of Lodop
Because LODOP performance is stable, powerful, simple to use, the page and local resources can easily achieve docking, in view of this, Lodop's work is constantly
Expansion, LODOP will eventually develop into what it looks like. We pay close attention to the ...
Platform and LODOP print control downloads: http://mtsoftware.v053.gokao.net/download.html