Java cloud printing Lodop, Java cloud printing Lodop

Source: Internet
Author: User

Java cloud printing Lodop, Java cloud printing Lodop
We often encounter printing content on a webpage. For example, when applying for a Hong Kong and Macao pass online, you must enter an application form and print the application form. How is such a printing technology implemented? This kind of printing can be done through a plug-in called cloud printing. According to my understanding, cloud Printing Technology uploads the content to be printed to the "Cloud" server, then it is transmitted to the printer through the server. When we access the Internet, we can click print on a webpage. This print is called network printing. It stores data on a printing device or a printer's built-in storage device, cloud printing stores data on the "Cloud" end. The printing technology is used in many development projects. The printing technology is used in a tangxia project that has been developed by our project team. To implement printing, you need to add the downloaded Printing file to eclipse. Next is the entire printing implementation process: (1) Prepare the materials in the Java compiler eclipse, put the downloaded file in the corresponding folder, and put it anywhere, you only need to reference the path when referencing. The. exe file is some plug-ins that need to be installed on the client. It depends on the browser (client. This print is only related to the front-end, and the background Code does not need to do anything. (2) Click print to print the desired effect. The page is uploaded to the print page, and the A4 paper is printed After previewing.

(3) Implement preauthorization in the code to reference the printed JS file on the print.html page
1 <! -- Print plug-in --> 2 <script src = "/js/Lodop/LodopFuncs. js "type =" text/javascript "> </script> 3 <object id =" LODOP_OB "4 classid =" clsid: 2105C259-1E0C-4534-8141-A753534CB4CA "width = 0 height = 0> 5 <embed id =" LODOP_EM "type =" application/x-print-lodop "width = 0 height = 0> </embed> 6 </object>

This is the printed html page.

1 <form action = "offcomplete/print" method = "post"> 2 <input type = "hidden" id = "id" name = "offBatchfile. id "3 value =" $ {offBatchfile. id !} "/> 4 <% if (off. display_Name = null) {%> 5 <div class = "print_btn_box"> 6 <a href = "#" onclick = "PrintURL () "class =" btn-default "> <I class =" fa-print "> </I> print </a> 7 <a href ="/offcomplete/export /$ {printUsefullId !} "Class =" btn-default "> <I class =" fa-file-word-o "> </I> download </a> 8 </div> 9 <% }%> 10 <div align = "center" id = "print"> 11 <% include ("/offcomplete/view.html ") {}%> 12 </div> 13 </form>

Then, a click event is provided for the print button.

1 <script type = "text/javascript"> 2 // print registration 3 function PrintURL () {4 try {5 var LODOP = getLodop (document. getElementById ('dop _ ob'), document 6. getElementById ('dop _ EM '); 7 LODOP. PRINT_INIT (""); 8 LODOP. SET_PRINT_STYLE ("FontSize", 18); 9 LODOP. SET_PRINT_STYLE ("Bold", 1); 10 LODOP. ADD_PRINT_HTM (45, 55,770,100 4, document11. getElementById ("print "). innerHTML); 12 LODOP. PREVIEW (); 13} catch (e) {14 15} 16} 17 </script>

If these steps are complete, you can print them. Some problems may occur when printing the client (ie will not appear), such as prompting the installation information. Before installing install_lodop, you 'd better check the computer operating system and the number of browsers used, which are 32-bit and 64-bit. Select installation.

I hope that my sharing will be more appealing. I suggest that the selection of browsers is very important no matter what kind of Web projects I do. In general, I used to use IE at the beginning, because no matter who buys a computer, Microsoft's stuff must be installed in the system unless it is not a Windows OS computer, in addition, IE is the lowest-end for many browsers, and more or less other browsers also have the IE kernel. The browsers with the lowest-end development are not running properly, it is no problem to download the preferred advanced browser based on the customer's preferences. In theory, the lower version can pass through, not to mention the higher version. Of course, as a developer, I still prefer the Firefox browser, and it is better to use it for debugging.

 

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.