1. Introduction
With the rapid development of the Internet, many companies have developed business application systems based on WEB. Generally speaking, WEB-based business applications adopt a three-layer or more structure. The front desk, that is, the client, is an ordinary WEB browser. The intermediate business logic application layer is stored on the WEB server, and the backend database is accessed by the service components on the WEB server. In order to interconnect the business system with the Internet, both the WEB server and the database system are hosted in IDC (Internet Data Center), so the business data needs to be extracted from the server hosted in IDC and printed out locally. When the client browser can only print simple HTML pages, it requires more powerful and flexible printout functions; by using relevant technologies to expand the browser's functions, more complex data printing tasks can be completed, such as receipts, receipts, etc. When I developed education management software for an online education company, the author used the FileSystem component to implement the functions of printing triple receipts and admission tickets locally.
2. Introduction to FileSystem component usage
The FileSystem component is actually an ActiveX control, which exists in the WINDOWS platform (both Win98, Win2000, or NT environments contain this component.), CLSID: 0D43FE01-11CF-8940-00A0C9054228. People who are familiar with ASP programmers may have used the FileSystem component. Generally, this component is used on the server side to access and control text files, folders and drives. There are two ways to create an object instance of the FileSystem component:
1. Use the built-in object SERVER method of ASP to create an instance of the server-side object.
2. Use the Vbscript script function CreateObject to create an instance of the client object (this method can also be used on the server side, but sometimes errors will occur and are generally not used;).
The FileSystem component has the following methods to operate text files:
CreateTextFile(Filename,[Overwriteifexists],[Unicode/ASCII])//Create text file
OpenTextFile(Filename,[Input/outputmode],[Createifnotexists],[Format])//Open text file
CopyFile (Filename1,Filename2,[Overwrite])//Copy text file
MoveFile(Filename1,Filename2)//Move text files
DeleteFile(Filename)//Delete text file
GetFile(Filename)//Get text file
FileExists(Filename)//Judge whether the text file exists
The FileSystem component also has similar methods to text files for folders and drives, so I will not elaborate on them here.
In fact, the FileSystem component can also be used on the client side. The second method of creating an instance of the FileSystem component object is to use this component to access and control the text files, folders and drives of the client system. Because the Microsoft platform has FileSystem component, the Microsoft platform client does not need to download it from a remote server, and it will install and register itself when installing the operating system; while the other platforms client must install plug-ins and download FileSystem component.
3. Implementation mechanism of local specific printing
The process of implementing local-side specific printing using FileSystem component is shown in the figure: