Lodop Use of print controls

Source: Internet
Author: User

Look first:

Lodop plugin needs to be installed

Print Browsing Effect:

Prerequisites for printing

Go to the official website to download a few JS packages: Http://www.lodop.net/download.html added to the project

The picture is as follows:

Add the following code to the Web front end needs to print the corresponding location of the function page

<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></embed>
</object>

I myself encapsulated the print JS code (encapsulated in table format data)

1     functionPrn1_preview () {2         varLodop = Getlodop (document.getElementById (' Lodop_ob '), document.getElementById (' Lodop_em ')));3Lodop. Print_init ("Print control function Demo _lodop function _ Print form");4        5         varTheads = "<thead ><tr><th width= ' 300px ' > dish name </th><th width= ' 50px ' > number of copies </th><th Width= ' 50px ' > Price </th><th width= ' 150px ' > name </th><th width= ' 150px ' > Time </ Th></tr></thead> "6         varTablebodystar = "<table border= ' 1 ' >";7         varTablebodyend = "</table>";8         varTablehead = "<caption style= ' width:200px; ' > Order List </caption> "9 Ten         varTablebody; One       A$ (Lodopvalue). each (function () { -  -             varMenuname = "<tr><th width= ' 300px ' >" + This. Menu_name; the             varListnumber = "</th><td width= ' 50px ' >" + This. List_number; -             varClistprice = "</td><td width= ' 50px ' >" + This. Clist_price; -             varEmployeeloginname = "</td><td width= ' 150px ' >" + This. Employee_loginname; -             varClisttime = "</td><td width= ' 150px ' >" + times ( This. clist_time); +          //alert (menuname); -Tablebody + = menuname + listnumber + clistprice + employeeloginname + clisttime + "</td></tr>"; +           //alert (tablebody); A         }); at  -       vart =Tablebodystar; -T + =Tablehead; -T + =theads; -T + =Tablebody; -T + =Tablebodyend; in  -Lodop. Add_print_htm (60, 20, 800, 1000, T);  to Lodop. PREVIEW (); +};

Note: The above lodopvalue is a global variable that I define, which is the data inside the DataGrid:

Onloadsuccess:function (data)

{
var rows = data.rows;

}

Lodopvalue = rows; The data printed is primarily the data in rows

Lodop Use of print controls

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.