(In our practice office, we often need to realize the printing function. But due to historical factors, the printing function provided by Java has always been relatively weak. In practice, the bottom layer of jdk does not support printing, and it was not until jdk1.1 that very lightweight printing support was introduced. Therefore, in the programs designed with Java/Applet/JSP/Servlet, the more complicated printing is realized by calling ActiveX/OCX controls or VB/VC programs, which is very annoying. In fact, SUN enterprise has always been committed to the improvement of Java printing function, and Java2 method finally has the beginning of a powerful printing mode, which is fully integrated with the Java2D graphics package. What's more encouraging is that the newly released jdk1.4 provides a complete set of Java Print Service API (JavaPrintServiceAPI), which is an active supplement to the existing print function. Utilizing it, we can realize most practical use needs, including printing text, graphics, documents and print preview, etc. This article will explain how to design a Java printing program to realize these functions through a detailed program example, and analyze and compare the implementation methods of different versions. I hope you can get some favorable tips from it.
Java print programming.txt)