CN107256134B - Method and device for virtualizing POS terminal as computer printer and POS terminal - Google Patents

Method and device for virtualizing POS terminal as computer printer and POS terminal Download PDF

Info

Publication number
CN107256134B
CN107256134B CN201710278727.XA CN201710278727A CN107256134B CN 107256134 B CN107256134 B CN 107256134B CN 201710278727 A CN201710278727 A CN 201710278727A CN 107256134 B CN107256134 B CN 107256134B
Authority
CN
China
Prior art keywords
data
printed
pos terminal
printing
printer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710278727.XA
Other languages
Chinese (zh)
Other versions
CN107256134A (en
Inventor
李坚强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
PAX Computer Technology Shenzhen Co Ltd
Original Assignee
PAX Computer Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by PAX Computer Technology Shenzhen Co Ltd filed Critical PAX Computer Technology Shenzhen Co Ltd
Priority to CN201710278727.XA priority Critical patent/CN107256134B/en
Priority to PCT/CN2017/102215 priority patent/WO2018196262A1/en
Publication of CN107256134A publication Critical patent/CN107256134A/en
Application granted granted Critical
Publication of CN107256134B publication Critical patent/CN107256134B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1202Dedicated interfaces to print systems specifically adapted to achieve a particular effect
    • G06F3/1203Improving or facilitating administration, e.g. print management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1223Dedicated interfaces to print systems specifically adapted to use a particular technique
    • G06F3/1224Client or server resources management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1278Dedicated interfaces to print systems specifically adapted to adopt a particular infrastructure
    • G06F3/128Direct printing, e.g. sending document file, using memory stick, printing from a camera
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07GREGISTERING THE RECEIPT OF CASH, VALUABLES, OR TOKENS
    • G07G5/00Receipt-giving machines

Abstract

The invention relates to a method and a device for virtualizing a POS terminal into a computer printer and the POS terminal. The method comprises the steps that a printing instruction is received through a first printing driver, first data to be printed are obtained according to the printing instruction, and the first printing driver is used for providing a printer type to be a POS terminal printer; calling a printing servo program through the first printing driver to convert the first data to be printed into second data to be printed which accords with the POS terminal; and sending the second data to be printed to a printer of the POS terminal so that the printer of the POS terminal prints the second data to be printed. The utilization rate of the POS printer is improved.

Description

Method and device for virtualizing POS terminal as computer printer and POS terminal
Technical Field
The invention relates to the field of computer application, in particular to a method and a device for virtualizing a POS terminal into a computer printer and the POS terminal.
Background
Currently, POS is widely used in various payment situations, and becomes one of the mainstream electronic payment channels.
At present, a printer of the POS terminal only has the function of printing out required consumption certificates after transaction, and the printer is empty, does not reach the allowed printing quantity in the service life specification of the printer, and is low in utilization rate.
Disclosure of Invention
Therefore, it is necessary to provide a method and an apparatus for virtualizing a POS device as a computer printer, and a POS terminal, which can improve the usage rate of POS devices, in order to solve the problem of low usage rate of POS printers.
A method of virtualizing a POS terminal as a computer printer, comprising the steps of:
receiving a printing instruction through a first printing driver, and acquiring first data to be printed according to the printing instruction, wherein the first printing driver is used for providing a printer type as a POS terminal printer;
calling a printing servo program through the first printing driver to convert the first data to be printed into second data to be printed which accords with the POS terminal;
and sending the second data to be printed to a printer of the POS terminal so that the printer of the POS terminal prints the second data to be printed.
In one embodiment, the method further comprises:
storing the acquired first data to be printed under an appointed file directory path;
and calling a printing servo program through the first printing driver to read the first data to be printed from the specified file directory path, and converting the first data to be printed into second data to be printed which is in line with the POS terminal.
In one embodiment, the converting the first data to be printed into second data to be printed conforming to the POS terminal by the first print driver invoking the print servo includes:
and calling a printing servo program through the first printing driver to convert the first data to be printed into monochrome bitmap data and convert the monochrome bitmap data into dot matrix array data, wherein the dot matrix array data are second data to be printed which accord with the POS terminal.
In one embodiment, the step of sending the second data to be printed to a printer of the POS terminal includes:
and sending the second data to be printed to a printing agent of the POS terminal, and transmitting the second data to be printed to a printer of the POS terminal through the printing agent.
A method of virtualizing a POS terminal as a computer printer, comprising:
receiving second data to be printed which are sent by a printing servo program and accord with the POS terminal through a printing agent program of the POS terminal, and sending the second data to be printed to a printer of the POS terminal; the second data to be printed is obtained by converting the first data to be printed acquired by the first printing driver through the printing servo program;
and printing the second data to be printed by a printer of the POS terminal.
In one embodiment, the step of receiving, by the print agent of the POS terminal, the data to be printed that conforms to the POS terminal and is sent by the print server includes:
and receiving dot matrix array data sent by a printing servo program through a printing agent program of the POS terminal, wherein the dot matrix array data is obtained by converting first to-be-printed data acquired by the first printing drive into monochrome bitmap data and then converting the monochrome bitmap data by the printing servo program.
An apparatus for virtualizing a POS terminal as a computer printer, comprising:
the printing driving module is used for providing the printer type as a POS terminal printer, receiving a printing instruction and acquiring first data to be printed according to the printing instruction;
and the printing servo program module is used for converting the first data to be printed into second data to be printed which accords with the POS terminal and sending the second data to be printed to a printer of the POS terminal so that the printer of the POS terminal prints the second data to be printed.
In one embodiment, the print driver module is further configured to store the acquired first data to be printed in a specified file directory path, and invoke the print servo program module to read the first data to be printed from the specified file directory path, and convert the first data to be printed into second data to be printed conforming to the POS terminal.
In one embodiment, the print driver module is further configured to invoke the print servo program module to convert the first data to be printed into monochrome bitmap data, and convert the monochrome bitmap data into dot matrix data, where the dot matrix data is the second data to be printed conforming to the POS terminal.
In one embodiment, the print servo program module is further configured to send the second data to be printed to a print agent of a POS terminal, and transmit the second data to be printed to a printer of the POS terminal through the print agent.
A POS terminal, comprising:
the printing agent program module is used for receiving second data to be printed which are sent by the printing servo program and accord with the POS terminal, and sending the second data to be printed to a printer of the POS terminal; the second data to be printed is obtained by converting the first data to be printed acquired by the first printing driver through the printing servo program;
and the printing module is used for printing the second data to be printed.
In one embodiment, the print agent is further configured to receive dot matrix array data sent by a print servo program, where the dot matrix array data is obtained by converting first to-be-printed data acquired by the first print driver into monochrome bitmap data and then converting the monochrome bitmap data by the print servo program.
According to the method and the device for virtualizing the POS terminal into the printer and the POS terminal, the first data to be printed are obtained through the first printing driver, the printing servo program is called to convert the first data to be printed into the second data to be printed which accords with the POS terminal, and the second data to be printed are sent to the printer of the POS terminal to be printed, so that the utilization rate of the POS printer is improved.
Drawings
FIG. 1 is a diagram illustrating an application scenario of a method for virtualizing a POS terminal as a computer printer according to an embodiment;
FIG. 2 is a flow diagram of a method for virtualizing a POS terminal as a computer printer in one embodiment;
FIG. 3 is a flow diagram of printing by the Windows operating system in one embodiment;
FIG. 4A is a flow diagram that illustrates the operation of a print port monitor in one embodiment;
FIG. 4B is a diagram illustrating an example of a graph in accordance with an embodiment;
FIG. 5 is a POS terminal flow diagram of a method for virtualizing a POS terminal as a computer printer in one embodiment;
FIG. 6 is a flowchart illustrating operation of computer 110 in one embodiment to transmit print data to POS terminal 120 for printing;
FIG. 7 is a block diagram of a POS terminal virtualized as a Windows printer device in one embodiment;
FIG. 8 is a block diagram of an apparatus for virtualizing a POS terminal as a computer printer in one embodiment;
FIG. 9 is a flowchart illustrating the operation of virtualizing the POS terminal as a computer printer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
FIG. 1 is a diagram illustrating an application scenario of a method for virtualizing a POS terminal as a computer printer in one embodiment. As shown in fig. 1, the application scenario includes a computer 110 and a POS terminal 120. Computer 110 and POS terminal 120 may be in data communication via wired or wireless communication. The computer 110 may have installed thereon a Windows operating system, a Linux operating system, etc. The wired mode can be serial port, USB cable, Ethernet and other connection communication. The wireless communication mode can be a WIFI mode and the like. The computer 110 may receive a printing instruction through a first printing driver, and obtain first data to be printed according to the printing instruction, where the first printing driver is configured to provide the printer type as a POS terminal printer, convert the first data to be printed into second data to be printed that conforms to the POS terminal by calling a printing servo program through the first printing driver, and send the second data to be printed to a printer of the POS terminal, so that the printer of the POS terminal 120 prints the second data to be printed.
FIG. 2 is a flow diagram of a method for virtualizing a POS terminal as a computer printer in one embodiment. As shown in fig. 2, a method for virtualizing a POS terminal as a computer printer, described in terms of a computer, includes steps 202 through 206. Wherein:
step 202, receiving a printing instruction through a first printing driver, and acquiring first data to be printed according to the printing instruction, wherein the first printing driver is used for providing the printer type as a POS terminal printer.
Specifically, the computer may receive a print instruction triggered by a user through the installed first print driver, and acquire the first data to be printed according to the print instruction. The first data to be printed can be word format data, PDF format data, picture format data, TXT format data and the like.
Step 204, a printing servo program is called through the first printing driver to convert the first data to be printed into second data to be printed which is in line with the POS terminal.
Specifically, the print servo program refers to an application program for converting data to be printed in a computer into data to be printed conforming to the POS terminal. The first print driver calls the print servo program through a function.
And step 206, sending the second data to be printed to a printer of the POS terminal, so that the printer of the POS terminal prints the second data to be printed.
Specifically, the printing servo program of the computer sends the second data to be printed to the printer of the POS terminal for printing through a convention protocol. The agreed protocol is a protocol conforming to data communication between the computer and the POS terminal.
According to the method for virtualizing the POS terminal into the printer, the first data to be printed is obtained through the first printing driver, the printing servo program is called to convert the first data to be printed into the second data to be printed which accords with the POS terminal, and the second data to be printed is sent to the printer of the POS terminal to be printed, so that the utilization rate of the POS printer is improved.
In one embodiment, the method for virtualizing the POS terminal as a computer printer further includes: and storing the acquired first data to be printed under the specified file directory path.
Specifically, the user needs to configure system-related parameters and specify a file directory path for storing the first data to be printed before invoking the first print driver. For example, in a Windows system, the user may set the path to: HKEY _ CURRENT _ USER \ SOFTWARE \ ImagePrinter for storing the first data to be printed. In addition, the configuration of the system-related parameters can also be automatically completed by installing the first print driver. Please refer to table 1 for the relevant parameters of the configuration system.
TABLE 1
In one embodiment, the method for virtualizing the POS terminal as a computer printer further includes: and calling a printing servo program through the first printing driver to read the first data to be printed from the specified file directory path, and converting the first data to be printed into second data to be printed which is in line with the POS terminal.
Specifically, the first print driver acquires a print instruction, and then converts the first data to be printed into bitmap data and stores it under a specified file directory path. And then, the first printing driver calls a printing servo program to acquire bitmap data in the specified file directory path and converts the first data to be printed into second data to be printed which accords with the POS terminal.
FIG. 3 is a flow diagram of printing by the Windows operating system in one embodiment. The Windows print driver is developed based on ImagePrinter of open source (GNU License), and belongs to the virtual printer driver class of Windows platform, that is, the ImagePrinter is a development tool for implementing virtual printer drivers, and functions as a port monitor in the printing process and provides the implementation of the port driver. The port driver is the first print driver. As shown in fig. 3, the printing flow of the windows operating system includes:
step 302, a print application is launched.
Specifically, the printing application creates a Device context and draws an object thereon, and then calls a corresponding function Interface in the GDI (Graphics Device Interface) to send a print request to a printer corresponding to the Device context. Creating a device context, i.e. configuring a device runtime environment. The GDI, i.e. the graphical device interface provided by Windows, is a core component of the Windows system, is the heart of the Windows graphical function, and its main function is responsible for information exchange between the Windows system and the drawing program. All graphic image processing, font processing, color management functions, etc. are implemented in the GDI.
Step 304, create a device context.
Specifically, the GDI function calls a corresponding printer driver to process the print request.
In step 306, the GDI calls the corresponding printer driver.
Specifically, the print driver creates a print job and calls a GDI function to return a processing result to the GDI through a print interface DLL (DLL is an interface file) and a print graphics DLL.
At step 308, the GDI function calls the print spooler.
The print spooling technique of Windows operating system mainly refers to a technique that uses an auxiliary memory (usually a hard disk) as a buffer memory of a port and processes a specific sending work in the background in order to reduce the time of occupying the host processor (because the speed of the port is usually much lower than that of the processor) when the host processor transfers data to an external device.
The steps are used for developing the Windows inherent flow for the printer driver. That is, if the printer driver is developed on the Windows platform, the above steps are implemented.
At step 310, the print spooler calls the language monitor. The language monitor is mainly used for supporting the bidirectional communication of the printer, monitoring the state of the printer and acquiring and processing some events.
Specifically, the print offline calls the print request processor to send the print job to the printer specified by the application. The print request handler then sends the print job to the local print provider, which if the type of print job is non-direct printing, deposits the print job on disk in the original spool file format and appends subsequent print segments to the spool file until the application calls the EndDoc function to terminate a print job. The above steps 302 to 310 may be repeated a plurality of times to generate a complete spool file. And then the local printing provider starts a background thread, and the printing main thread selects an optimal moment to trigger the analysis process of the spool file according to the monitoring condition of the printing spool subsystem resources. At this point, the print master thread will call the StartDocPort function to start one of the threads in the print processor to begin parsing work. The printer processor thread calls ReadPrinter to activate the local print provider to read the generated print spool file from disk. At the same time, the print processor also calls the WritePrinter function to activate the language monitor of the printer job to send data to the corresponding printer through the physical port.
At step 312, the language monitor calls the port monitor.
Specifically, the print language monitor calls the function of the port monitor to send data to the printer. The port monitor controls communication between the printer and the physical port. Its role is to transmit and receive data to and from the port device (some port monitors have only transmit functionality). Typically, the operating system will provide port monitors to support some types of ports (LPT, COMN, etc.) for use by the printer, eliminating the need for developers to provide their own port monitors. However, if the port type of the printer is not in the list of port types supported by the operating system by default, then the developer is required to write its own print port monitor and install it along with the printer driver. The ImagePrinter functions as a port monitor in the printing process and provides the realization of a port driver.
Fig. 4A is a flowchart illustrating the operation of the print port monitor of fig. 3. In the implementation in the port monitor, by configuring the WriteFile, a function of writing bitmap data under a specific file directory path is realized. As shown in fig. 4A, the workflow of the print port monitor includes:
at step 404, the print port is opened.
Specifically, print spool 402 first calls the OpenPort function of the port monitor, the main function of which is to open a port and return a handle identifying the port. In subsequent calls to the spool, the handle will be used as an input parameter to other processing functions. The handle is the basis for the entire Windows programming. A handle refers to a unique integer value, i.e., a 4-byte (8-byte in a 64-bit program) long value, used to identify different objects in an application and different instances in the same class, such as a window, button, icon, scroll bar, output device, control, or file.
At step 406, the print job is started.
Specifically, after a port is opened, the print spool then calls the StartDocPort function to start a print job. The StartPort function establishes a data link with the kernel port driver mainly by calling a CreateFile function provided by a Windows API (Application programming interface).
In step 408, it is determined whether to read or write data to the printer.
Specifically, after the data link is established, the print spool may do bi-directional operations as needed, one is to write data to the printer, in which case the print spool first calls the WritePort function of the port monitor and then calls the WriteFile function provided by the Windows API multiple times to send data to the kernel port driver. In the first print drive, bitmap data is written into a designated file path directory by configuring the write port 410 and calling the WriteFile function. Alternatively, the data is read to the printer, at which point the print spooler first calls the ReadPort function of the port monitor and then calls the ReadFile function provided by the Windows API to read the hardware information from the kernel port driver.
At step 412, the data is transmitted.
Specifically, after writing data to the printer, the print spooler calls the getprintdatafromport function, which has the main role of finally implementing data transfer between the print driver and the kernel port driver by calling the DeviceloControl function provided by the Windows API.
In step 414, the printing process is completed.
Specifically, after the above operations are completed, the print spool calls the EndDocPort function to end a print job. The function has the main function of releasing all system resources applied in the data link established by the CreateFile function and the StartDocPort function.
At step 416, it is determined whether there are more jobs in the print queue to be printed.
Specifically, after a print job is completed according to the above-described procedure, the print spool checks that there are no other files to be printed in the print queue connected to this port. If so, the program returns to the StartDocPort function to repeat the process, and if not, the print spool closes the port.
At step 418, the port is closed.
Specifically, the ClosePort function of the port monitor is used to close the port. The main role of this function is to put all the system resources that are claimed in the OpenPort function.
In one embodiment, the converting the first data to be printed into second data to be printed conforming to the POS terminal by the first print driver invoking the print servo includes: and calling a printing servo program through the first printing driver to convert the first data to be printed into monochrome bitmap data and convert the monochrome bitmap data into dot matrix array data, wherein the dot matrix array data are second data to be printed which accord with the POS terminal.
Specifically, after the print servo program is called by the first print driver, the print servo program acquires the first data to be printed under the specified file directory path. And simultaneously judging whether the first data to be printed is monochrome bitmap data or not, if the first data to be printed is non-monochrome bitmap data, firstly converting the bitmap data into monochrome bitmap data, and then converting the monochrome bitmap data into dot matrix data, wherein the dot matrix data is the second data to be printed which accords with the POS terminal. The dot matrix array data comprises first characters, byte numbers of graphs in each row and graph data. Wherein:
the initial character [1Byte ] is used to indicate the number of lines of the graphic.
Byte number [2Byte, high Byte preceding ] of the first row pattern, and pattern data [ width of one row is 384 dots ] of the first row pattern.
The second row pattern has a Byte number [2Byte, high Byte preceding ]. And so on. Third row, fourth row, etc.
Where 1 indicates that there is data (black dots) at the position, and 0 indicates that there is no data (white dots) at the position, for example:
as shown in fig. 4B, the pixels of the graph are 98 × 44 pixels
The converted array is:
Figure GDA0001353985250000101
Figure GDA0001353985250000111
Figure GDA0001353985250000121
Figure GDA0001353985250000131
Figure GDA0001353985250000141
Figure GDA0001353985250000151
the first byte 0x2C of the lattice array represents the number of rows (i.e., height) of the image as 44. I.e., 0X2C is hexadecimal, converted to 44 decimal, i.e., 44 rows. And so on.
In one embodiment, the step of sending the second data to be printed to a printer of the POS terminal includes: and sending the second data to be printed to a printing agent of the POS terminal, and transmitting the second data to be printed to a printer of the POS terminal through the printing agent.
Specifically, the print servo program converts the monochrome bitmap data into dot matrix array data and sends the dot matrix array data to the POS terminal through an agreed communication protocol. The protocol adopts LRC (Longitudinal Redundancy Check) verification mechanism. After the dot matrix data is transmitted to a printing agent program of the POS terminal from the servo program, LRC verification is firstly carried out to ensure the accuracy and the integrity of the dot matrix data, and if the dot matrix data is wrong, the printing agent program of the POS terminal returns an error code to the printing servo program; the printing servo program resends the dot matrix array data to a printing agent program of the POS terminal; and finally, the printing agent program transmits the correct and complete data to a printer of the POS terminal to complete the printing task. The appointed communication protocol comprises a data header, a data length, data content, LRC verification, a response packet data header, response packet data content, LRC verification and the like. Specifically, when transmitting array data, the data header is transmitted first, and then the data content is transmitted, and the definition of the data header format refers to table 2.
TABLE 2
Figure GDA0001353985250000162
Wherein, the initial character represents the start mark of the data, and the data header information includes: the length of the packet, the device type information, the type of the packet, and the index information of the command, for initialization of the transmission data. Please refer to table 3 for data content format definition.
TABLE 3
Figure GDA0001353985250000171
The packet length is the length of the entire data except for the start character, and when the receiver receives the data, the packet length is received first, and then the remaining data is received. The data packet type and the command index contain information such as an analysis format, a calculation format, real data content, a data root and the like. The LRC is used for data verification and is an exclusive OR value of other data except the initial character, and the accuracy of the data is guaranteed. The specific format of the data content is as follows, if the parameter is an integer, then 4 bytes are used for representation (high order bits are before) and refer to table 4.
TABLE 4
Parameter 1 Parameter 2 Parameter 2 。。。 Parameter n
After the data is successfully printed or the data transmission process is completed, the POS terminal returns a message to the print server, which returns a definition of a response packet, see table 5.
TABLE 5
Figure GDA0001353985250000172
Wherein the start character represents a start flag of the data, and the header information includes: the length of the data packet, the device type information, the type of the data packet, and the index information of the command, initialization for transmitting data, and data content format definition please refer to table 6.
TABLE 6
Figure GDA0001353985250000173
The meaning of each part of the data packet is the same as that of the data packet, an error code is added to the data content, and if the error code (ErrorCode) is an LRC check error or a response packet itself checks an error, the PC retransmits the previous data packet. The definition of the error code is as follows:
Figure GDA0001353985250000181
in the step of sending the second data to be printed to the printer of the POS terminal, the communication protocol adopts an LRC verification mechanism, which ensures the integrity and correctness of the dot matrix array data, so that the POS printer can accurately print out the data required by the user.
FIG. 5 is a flowchart of a POS terminal method for virtualizing a POS terminal as a computer printer in another embodiment. As shown in fig. 5, the method for virtualizing a POS terminal as a computer printer, described in terms of POS terminals, includes steps 502 and 504. Wherein:
step 502, receiving second data to be printed which is sent by a printing servo program and accords with the POS terminal through a printing agent program of the POS terminal, and sending the second data to be printed to a printer of the POS terminal; and the second data to be printed is obtained by converting the first data to be printed acquired by the first printing drive through the printing servo program.
And step 504, printing the second data to be printed by a printer of the POS terminal.
In one embodiment, the step of receiving, by the print agent of the POS terminal, the data to be printed that conforms to the POS terminal and is sent by the print server includes:
and receiving dot matrix array data sent by a printing servo program through a printing agent program of the POS terminal, wherein the dot matrix array data is obtained by converting first to-be-printed data acquired by the first printing drive into monochrome bitmap data and then converting the monochrome bitmap data by the printing servo program.
Through the steps, the printing data is converted into the data suitable for being printed by the printer, the completeness and the correctness of the data are ensured, the POS printer is successfully virtualized into a computer printer, and the utilization rate of the POS printer is improved.
In one example, the step of sending the second data to be printed to the POS terminal printer by the print agent of the POS terminal includes:
and after receiving the data to be printed which is sent by the printing servo program and accords with the POS terminal through the printing agent program of the POS terminal, checking the second data to be printed, and then sending the correct and complete second data to be printed to a POS terminal printer for printing.
Specifically, a printing agent program of the POS terminal monitors the data port, and when the POS terminal printing agent program monitors dot matrix array data sent by the printing server program, the POS terminal printing agent program performs LRC verification on the dot matrix array data, that is, second data to be printed, and determines whether the dot matrix array data is correct and complete, and if so, transmits the second data to be printed to a POS terminal printer, prints the second data to be printed, and then sends a return value of the completion of printing to the computer terminal, and completes the printing task. If the second data to be printed is incorrect or incomplete, the POS terminal printing agent program sends an error code to the computer terminal, and the computer terminal printing servo program resends the second data to be printed to the POS terminal printing agent program until the second data to be printed is correctly and completely transmitted to the POS terminal printer and the printing task is completed.
According to the method for virtualizing the POS terminal into the computer printer described by the POS terminal, the second data to be printed is transmitted to the POS terminal through an agreed protocol, and finally the data is printed out, so that the accuracy and the integrity of the data are ensured, and a user can print out correct data through the POS terminal printer.
Fig. 6 is a flowchart illustrating the operation of computer 110 transmitting print data to POS terminal 120 for printing according to one embodiment. As shown in fig. 6, the computer 110 has a first print driver and a print servo installed thereon. The POS terminal 120 has a print agent and a printer installed thereon. Described in terms of a computer, the process of the computer 110 transmitting the print data to the POS terminal 120 for printing includes:
step 602, receiving a print driver selection instruction, and acquiring a first print driver.
Specifically, the print driver selection instruction may be an instruction generated by receiving a user selection of a POS terminal printer type at the print interface. A first print drive is acquired according to the print drive selection instruction. The first print driver may be a driver adapted for the POS terminal printer.
In step 604, the first print driver transmits the first data to be printed to the designated file directory path, and searches and calls the print servo program.
Specifically, the first print driver converts the first data to be printed into bitmap data, sends the bitmap data to a designated file directory path, and calls a print servo program.
Step 606, the printing servo program converts the first data to be printed into dot matrix array data, the dot matrix array data is the second data to be printed, and sends the second data to be printed to a printing agent module of the POS terminal, and the printing agent module is a program used by the POS terminal to receive the computer terminal.
Specifically, the computer-side printing servo program acquires first data to be printed under an appointed file directory path, then judges whether bitmap data of the first data to be printed is monochrome bitmap data or not, then converts the monochrome bitmap data into a dot matrix array, the dot matrix array is second data to be printed, and then sends the second data to be printed to a printing agent module of the POS terminal through an agreed protocol. Acquiring the converted data to be printed through monitoring a communication port according to the POS terminal printing agent program, and calling a POS printer; and printing the data to be printed according to the POS printer.
FIG. 7 is a block diagram of an apparatus for virtualizing a POS terminal as a computer printer in one embodiment. As shown in fig. 7, an apparatus for virtualizing a POS terminal as a computer printer, which is described in terms of a computer, includes a print driver module 702 and a print server module 704. Wherein:
the print driver module 702 is configured to provide the printer type as a POS terminal printer, receive a print instruction, and obtain first data to be printed according to the print instruction.
The printing servo program module 704 is configured to convert the first data to be printed into second data to be printed, which is compliant with the POS terminal, and send the second data to be printed to a printer of the POS terminal, so that the printer of the POS terminal prints the second data to be printed.
In one embodiment, the print driver module is further configured to store the acquired first data to be printed in a specified file directory path, and invoke the print servo program module to read the first data to be printed from the specified file directory path, and convert the first data to be printed into second data to be printed conforming to the POS terminal.
In one embodiment, the print driver module is further configured to invoke the print servo program module to convert the first data to be printed into monochrome bitmap data, and convert the monochrome bitmap data into dot matrix data, where the dot matrix data is the second data to be printed conforming to the POS terminal.
In one embodiment, the print servo program module is further configured to send the second data to be printed to a print agent of a POS terminal, and transmit the second data to be printed to a printer of the POS terminal through the print agent.
Fig. 8 is a block diagram showing an internal configuration of a POS terminal according to an embodiment. As shown in fig. 8, a POS terminal includes a print agent module 802 and a print module 804. Wherein:
the printing agent program module 802 is configured to receive second data to be printed, which is sent by the printing servo program and conforms to the POS terminal, and send the second data to be printed to a printer of the POS terminal; and the second data to be printed is obtained by converting the first data to be printed acquired by the first printing drive through the printing servo program.
The printing module 804 is configured to print the second data to be printed.
In an embodiment, the print agent is further configured to receive dot matrix array data sent by a print servo program, where the dot matrix array data is obtained by converting, by the print servo program, first to-be-printed data acquired by the first print driver into monochrome bitmap data and then converting the monochrome bitmap data.
Referring to fig. 9, fig. 9 is a flowchart illustrating an embodiment of a method for virtualizing a POS terminal as a computer printer system, where the method may include:
the print driver module 902 is configured to select a POS printer print driver, obtain a user print instruction, transmit data to be printed to a specified file directory path, and search for and call a print servo program.
And a print servo program module 904, configured to obtain data to be printed, determine whether the data to be printed is monochrome bitmap data, convert the monochrome bitmap data into the monochrome bitmap data if the data to be printed is not monochrome bitmap data, convert the monochrome bitmap data into dot matrix data, and send the data to the POS terminal device through an agreed protocol.
And the printing agent module 906 receives the data transmitted by the printing servo program module and judges whether the data is correct and complete. If the data is wrong, the dot matrix array data is requested to the computer terminal printing servo program again, and then the dot matrix array data is transmitted to the printing module.
The printing module 908 receives the dot matrix data, prints the dot matrix data, completes the printing task, and feeds back the printing result.
According to the method for virtualizing the POS equipment into the printer, the printing process of the computer end is fused, so that a user can print a simple document by using the POS printer without extra work. And multiple link modes can be supported between the computer end and the POS machine, the POS machine is not limited to the traditional parallel port cable link mode, the computer end can use serial ports, USB cables, Ethernet, WiFi and other modes to link the POS printer to print documents, and the utilization rate of the POS printer is improved.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a non-volatile computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the program is executed. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), or the like.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (14)

1. A method for virtualizing a POS terminal as a computer printer is applied to a scene comprising a computer and the POS terminal, and comprises the following steps:
receiving a printing instruction through a first printing driver, and acquiring first data to be printed according to the printing instruction, wherein the first printing driver is used for providing a printer type to a POS terminal printer, and the first data to be printed can be at least one of word format data, PDF format data, picture format data and TXT format data;
calling a printing servo program through the first printing driver to convert the first data to be printed into second data to be printed which accords with the POS terminal;
and sending the second data to be printed to a printer of the POS terminal so that the printer of the POS terminal prints the second data to be printed.
2. The method of claim 1, further comprising:
storing the acquired first data to be printed under an appointed file directory path;
and calling a printing servo program through the first printing driver to read the first data to be printed from the specified file directory path, and converting the first data to be printed into second data to be printed which is in line with the POS terminal.
3. The method of claim 1, wherein the converting the first data to be printed into second data to be printed conforming to the POS terminal by the first print driver invoking the print servo comprises:
and calling a printing servo program through the first printing driver to convert the first data to be printed into monochrome bitmap data and convert the monochrome bitmap data into dot matrix array data, wherein the dot matrix array data are second data to be printed which accord with the POS terminal.
4. The method of claim 1, wherein the step of sending the second data to be printed to a printer of a POS terminal comprises:
and sending the second data to be printed to a printing agent of the POS terminal, and transmitting the second data to be printed to a printer of the POS terminal through the printing agent.
5. A method for virtualizing a POS terminal as a computer printer is applied to a scene comprising a computer and the POS terminal, and comprises the following steps:
receiving second data to be printed which are sent by a printing servo program and accord with the POS terminal through a printing agent program of the POS terminal, and sending the second data to be printed to a printer of the POS terminal; the second data to be printed is obtained by converting first data to be printed acquired by a first printing driver through the printing servo program, and the first data to be printed can be at least one of word format data, PDF format data, picture format data and TXT format data;
and printing the second data to be printed by a printer of the POS terminal.
6. The method of claim 5, wherein the step of receiving, by the print agent of the POS terminal, the POS terminal compliant data to be printed sent by the print server comprises:
and receiving dot matrix array data sent by a printing servo program through a printing agent program of the POS terminal, wherein the dot matrix array data is obtained by converting first to-be-printed data acquired by the first printing drive into monochrome bitmap data and then converting the monochrome bitmap data by the printing servo program.
7. An apparatus for virtualizing a POS terminal as a computer printer, applied to a scenario including a computer and a POS terminal, comprising:
the printing driving module is used for providing a printer type as a POS terminal printer, receiving a printing instruction and acquiring first data to be printed according to the printing instruction, wherein the first data to be printed can be at least one of word format data, PDF format data, picture format data and TXT format data;
and the printing servo program module is used for converting the first data to be printed into second data to be printed which accords with the POS terminal and sending the second data to be printed to a printer of the POS terminal so that the printer of the POS terminal prints the second data to be printed.
8. The apparatus according to claim 7, wherein the print driver module is further configured to store the acquired first data to be printed in a designated file directory path, and to call the print server program module to read the first data to be printed from the designated file directory path and convert the first data to be printed into second data to be printed conforming to the POS terminal.
9. The apparatus of claim 7, wherein the print driver module is further configured to invoke the print server program module to convert the first data to be printed into monochrome bitmap data, and convert the monochrome bitmap data into dot matrix data, and the dot matrix data is the second data to be printed conforming to the POS terminal.
10. The apparatus of claim 7, wherein the print server module is further configured to send the second data to be printed to a print agent of a POS terminal, and transmit the second data to be printed to a printer of the POS terminal through the print agent.
11. A POS terminal for use in a scenario including a computer and a POS terminal, comprising:
the printing agent program module is used for receiving second data to be printed which are sent by the printing servo program and accord with the POS terminal, and sending the second data to be printed to a printer of the POS terminal; the second data to be printed is obtained by converting first data to be printed acquired by a first printing driver through the printing servo program, and the first data to be printed can be at least one of word format data, PDF format data, picture format data and TXT format data;
and the printing module is used for printing the second data to be printed.
12. The POS terminal of claim 11, wherein the print agent is further configured to receive dot matrix array data sent by a print servo, where the dot matrix array data is obtained by converting, by the print servo, first to-be-printed data obtained by the first print driver into monochrome bitmap data and then converting the monochrome bitmap data.
13. A computer comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method of any one of claims 1 to 4.
14. A computer-readable storage medium, storing a computer program which, when executed by a processor, causes the processor to carry out the steps of the method according to any one of claims 1 to 6.
CN201710278727.XA 2017-04-25 2017-04-25 Method and device for virtualizing POS terminal as computer printer and POS terminal Active CN107256134B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201710278727.XA CN107256134B (en) 2017-04-25 2017-04-25 Method and device for virtualizing POS terminal as computer printer and POS terminal
PCT/CN2017/102215 WO2018196262A1 (en) 2017-04-25 2017-09-19 Method for virtualizing pos terminal into computer printer, computer, pos terminal, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710278727.XA CN107256134B (en) 2017-04-25 2017-04-25 Method and device for virtualizing POS terminal as computer printer and POS terminal

Publications (2)

Publication Number Publication Date
CN107256134A CN107256134A (en) 2017-10-17
CN107256134B true CN107256134B (en) 2020-01-21

Family

ID=60027229

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710278727.XA Active CN107256134B (en) 2017-04-25 2017-04-25 Method and device for virtualizing POS terminal as computer printer and POS terminal

Country Status (2)

Country Link
CN (1) CN107256134B (en)
WO (1) WO2018196262A1 (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108388411B (en) * 2018-03-05 2021-05-18 菲尼克斯(南京)智能制造技术工程有限公司 Laser printing system, laser printing method and conversion device for printer computer
CN109859414A (en) * 2018-12-21 2019-06-07 艾体威尔电子技术(北京)有限公司 A kind of method and system realizing POS machine Logo array modification and generating
CN112035074A (en) * 2019-06-04 2020-12-04 中兴通讯股份有限公司 Printing implementation method, device and system and storage medium
CN110377246A (en) * 2019-07-19 2019-10-25 厦门顶尖电子有限公司 A kind of Method of printing and without character library printer
US20220012034A1 (en) * 2020-07-10 2022-01-13 Roll, Inc Driver software for reading outgoing data from a point of sale (pos) system
CN112486429B (en) * 2020-11-26 2022-08-19 四川长虹电器股份有限公司 Method for automatically configuring printer by terminal
CN112925487A (en) * 2021-02-05 2021-06-08 北京互金新融科技有限公司 Printing method and device of target content, storage medium and electronic device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101408836A (en) * 2007-10-09 2009-04-15 北京书生国际信息技术有限公司 Print implementing method
CN102053806A (en) * 2009-10-29 2011-05-11 精工爱普生株式会社 Printer driver, printer control method, and recording medium
CN104813271A (en) * 2012-12-28 2015-07-29 精工爱普生株式会社 Data conversion system, data conversion device, and data conversion method
WO2016129226A1 (en) * 2015-02-12 2016-08-18 セイコーエプソン株式会社 Printer driver and pos system
CN106408798A (en) * 2016-09-22 2017-02-15 上海寰果信息科技有限公司 Pos machine printing method and printing system
CN106445426A (en) * 2016-08-31 2017-02-22 深圳市华阳信通科技发展有限公司 Printing driver-based text data acquisition and printing control method and system

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007072711A (en) * 2005-09-06 2007-03-22 Seiko Epson Corp On-demand print monitoring system, on-demand print monitoring method, on-demand print monitoring program and on-demand printer
CN102999299A (en) * 2011-09-13 2013-03-27 北京路模思科技有限公司 System and method for monitoring print data in Windows print process
US9542676B2 (en) * 2014-11-13 2017-01-10 Seiko Epson Corporation Host device, printing system, and data processing method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101408836A (en) * 2007-10-09 2009-04-15 北京书生国际信息技术有限公司 Print implementing method
CN102053806A (en) * 2009-10-29 2011-05-11 精工爱普生株式会社 Printer driver, printer control method, and recording medium
CN104813271A (en) * 2012-12-28 2015-07-29 精工爱普生株式会社 Data conversion system, data conversion device, and data conversion method
WO2016129226A1 (en) * 2015-02-12 2016-08-18 セイコーエプソン株式会社 Printer driver and pos system
CN106445426A (en) * 2016-08-31 2017-02-22 深圳市华阳信通科技发展有限公司 Printing driver-based text data acquisition and printing control method and system
CN106408798A (en) * 2016-09-22 2017-02-15 上海寰果信息科技有限公司 Pos machine printing method and printing system

Also Published As

Publication number Publication date
CN107256134A (en) 2017-10-17
WO2018196262A1 (en) 2018-11-01

Similar Documents

Publication Publication Date Title
CN107256134B (en) Method and device for virtualizing POS terminal as computer printer and POS terminal
US7466442B2 (en) Printing system and method for customization of a print job
EP1830250B1 (en) Non-postscript printer description file generating tool
KR100228793B1 (en) Data processing method for printer
US7068388B2 (en) Printing a plurality of print jobs of a group in a designated order
US5854940A (en) Output control system for interpreting input data according to a specific control language based upon outputs from a plurality of control language determining devices
JP5361358B2 (en) Information processing apparatus, control method therefor, and program
US8355144B2 (en) Apparatus and method of changing printer driver, and printing system and method using the same
CN103324450B (en) Messaging device and information processing method
EP1703371A2 (en) Method and systems for providing index data for print job data
CN100382002C (en) Printing method and apparatus for rectifying error and computer readable recording medium
JP2014071573A (en) Printing control device, printing control method and program
JPH1148583A (en) Method and system for processing information and memory medium
JP2005335390A (en) Lengthening of life span of printer
JP2014119998A (en) Output processing system and output processing method
JP6839389B2 (en) Image processing and error handling systems and printing methods for linearized and non-linearized portable document format (Pdf) files
US20150294198A1 (en) Information processing apparatus and control method of the same
JP3985135B2 (en) Device initialization method in control system, control system, program for causing computer to execute device initialization method, and recording medium recording this program
KR100657307B1 (en) Print data processing method and apparatus
JP3810238B2 (en) Print job management apparatus, print job management method, and recording medium recording program
JP2023173548A (en) Image formation apparatus and image formation method
JP2006146364A (en) Print control device, print control method, print control system, program and storage medium
JP2005108116A (en) Printer device, information processor, printing system, printing data processing method, computer program and computer-readable storing medium
JPH10320139A (en) Printing controller, printing control method and computer-readable recording medium recorded with printing control program
CN113448519A (en) Method for printing file

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant