Java Cloud Print Lodop_java

Source: Internet
Author: User

LODOP is a professional web printing control, its design goal is simple and easy to use, powerful enough to create a new situation of web printing development.

LODOP designers of the web under the Print Development task is classified summary, highly abstract, designed to use only a few functional functions, can achieve complex printing tasks, to minimize the user's knowledge of the burden. The control publishing package consists of 3 system files, all of which are implemented with several control parameters and 2 sets of functional functions.

Print a page of content we have often encountered, such as online application for the Hong Kong and Macao permits need to fill out the application form, and then the application form to print out. How does a printing technology like this happen? This kind of printing can be done by a plug-in called cloud printing, I understand the cloud printing technology to upload the required content to the "cloud" server, and then transferred to the printer through the server.

Usually when we surf the Internet, we can directly click on a page to print, this kind of printing is called network printing, is to store the data in the print device or printer built-in storage devices, and cloud printing is to store the data to the "cloud" side.

Printing technology is used in a lot of development projects, our project team has developed a Tangxia project in the use of printing technology, print implementation needs to add in eclipse has been downloaded a printed file.

The next step is the entire print implementation process:

(1) Preparation of materials

In the Java compiler Eclipse, put the downloaded file in the corresponding folder, put it anywhere, as long as the reference is the right path reference.

The. exe file is a number of plug-ins that need to be installed on the client to see how many bits of the browser (client) are based on which.

This print is only related to the front-end, the background code does not need to do anything.

(2) Requirements to achieve the effect

Click to print this page to the print page, preview and print out A4 paper.

(3) Implement in code

First to print.html the page to refer to the printed JS file

<!--print plugin-->
<script src= "/js/lodop/lodopfuncs.js" type= "Text/javascript" ></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>

This is the printed HTML page

<form action= "Offcomplete/print" method= "POST" > <input type= "hidden" id= "
id" name= "offbatchfile.id"
value= "${offbatchfile.id!}"/>
<%if (off.display_name = null) {%> <div
"class=" Box ">
<a href=" # "onclick=" Printurl () "class=" btn btn-default "><i class=" fa fa-print "></i> Print </a> 
<a href= "/offcomplete/export/${printusefullid!}" class= "Btn btn-default" ><i class= "FA Fa-file-word-o "></i> downloads </a>
</div>
<%}%>
<div align=" center "id=" print " >
<% include ("/offcomplete/view.html") {}%>
</div>
</form>

Then give the Print button a click event

<script type= "Text/javascript" >
//Print registration
function Printurl () {
try {
var Lodop = Getlodop ( document.getElementById (' Lodop_ob '), document
. getElementById (' Lodop_em '));
Lodop. Print_init ("");
Lodop. Set_print_style ("FontSize",);
Lodop. Set_print_style ("Bold", 1);
Lodop. Add_print_htm (770, 1004, document
. getElementById ("PRINT"). InnerHTML);
Lodop. PREVIEW ();
} catch (E) {
}
}
</script>

If these steps are done, you can print them, and you may experience problems when printing on the client (ie browser does not appear), such as to prompt for such installation information. That means not installed INSTALL_LODOP before installation, it is best to look at the computer's operating system and the number of browsers used, divided into 32-bit and 64-bit, choose to install.

I hope that my share can stay lingering incense, I suggest that no matter what kind of Web projects, browser choice is very important.

In general I used to start using IE, because whoever bought the computer, Microsoft's Things must be installed in the system, unless it is not a Windows operating system computer, and IE for many browsers is the lowest end, other browsers more or less will have IE kernel, Developed the things that the lowest end of the browser operation is not a problem, that according to the customer download preferences of the advanced browser that is even more, the theory is so, the lower version of the clearance, not to mention the high version. Of course, as a developer or favor of the Fox Fire Browser, use it to debug better.

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.