A printing control method, device, electronic device, printer, and storage medium

Through the protocol conversion device, analyzes the data characteristics of the printing task, determines the parsing protocol and converts data, which solves the problem of printer protocol incompatibility and improves the device multiplexing rate and data storage capabilities.

CN114780046BActive Publication Date: 2025-06-27XIAMEN HANIN CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210573020.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-24
Publication Date
2025-06-27
Estimated Expiration
2042-05-24

AI Technical Summary

Technical Problem

Existing printers only support one printing protocol, resulting in incompatibility between different protocols, low device reuse rate and serious resource waste.

Method used

Through the protocol conversion device, it receives the printing tasks sent by the upper computer, analyzes the task data characteristics, determines the corresponding data analysis protocol, analyzes the printing tasks to obtain the printing data, converts it into bitmap data, and sends it to the printer.

Benefits of technology

Enhance printer compatibility with multiple protocols, improve device reuse rate, reduce device costs, and improve data storage capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114780046B_ABST
    Figure CN114780046B_ABST
Patent Text Reader

Abstract

The present invention discloses a printing control method, apparatus, electronic device, and storage medium. The method includes: receiving a printing task sent by a host computer; analyzing the printing task to obtain data characteristics of the printing task; determining a data parsing protocol corresponding to the printing task according to the data characteristics, and parsing the printing task according to the data parsing protocol to obtain printing data; converting the printing data into bitmap data, and sending a printing instruction to a printer based on the bitmap data. That is, in the embodiment of the present invention, the data parsing protocol is determined through the data characteristics of the printing task, and the printing data is obtained according to the data parsing protocol for data conversion to form bitmap data. The bitmap data is used as intermediate data for storage and generation of printing instructions. Different protocols corresponding to printing tasks can be printed by the printer through data conversion, enhancing the compatibility of the printer with multiple protocols, improving the reuse rate of the device, reducing the device cost, and at the same time improving the data storage capacity of the device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to computer technology, and in particular, to a printing control method, apparatus, electronic device, and storage medium. Background Art

[0002] With the popularization of electronic office work, various types of printers are available in the market, and different printers correspond to different printing protocols, printing formats, and paper sizes. Generally, a printer only supports one printing protocol, and the printing protocols are not compatible with each other. For example, the standard printing protocols include ESC, CPCL, TSCL, EPL, etc. Among them, each printing protocol can only be used by pairing a dedicated printer and printing software, and each printer can only support and receive a specific set of printing instructions, with poor compatibility with different system software and low device reuse rate, resulting in waste of resources. Summary of the Invention

[0003] The present invention provides a printing control method, apparatus, electronic device, and storage medium to enhance the compatibility of printers with multiple protocols and improve the reuse rate of devices.

[0004] In a first aspect, an embodiment of the present invention provides a printing control method applied to a protocol conversion device installed in a host computer, where the host computer is connected to a printer. The method includes:

[0005] Receiving a printing task sent by the host computer;

[0006] Analyzing the printing task to obtain data characteristics of the printing task;

[0007] Determining a data parsing protocol corresponding to the printing task according to the data characteristics, and parsing the printing task according to the data parsing protocol to obtain printing data;

[0008] Converting the printing data into bitmap data, and sending a printing instruction to the printer based on the bitmap data.

[0009] Further, determining a data parsing protocol corresponding to the printing task according to the data characteristics includes:

[0010] Matching a data parsing protocol corresponding to the printing task from each preset protocol according to the data characteristics, where each preset protocol is stored in the protocol conversion device.

[0011] Further, matching a data parsing protocol corresponding to the printing task from each preset protocol according to the data characteristics includes:

[0012] Determining a preset matching time according to each preset protocol;

[0013] Determine whether the data feature matches the feature of the current protocol within the preset matching time;

[0014] When the data feature does not match the feature of the current protocol, the data feature is sequentially matched with the next protocol until the data parsing protocol corresponding to the printing task is matched from the preset protocols.

[0015] Further, converting the print data into bitmap data includes:

[0016] Determine the content of the print data, and perform bitmap mapping on the content of the print data to obtain bitmap information;

[0017] Format the bitmap information according to the general data format to obtain the bitmap data.

[0018] Further, sending a print instruction to the printer based on the bitmap data includes:

[0019] Obtain the print protocol from the printer, and generate a print instruction according to the bitmap data and the print protocol;

[0020] Send the print instruction to the printer so that the printer completes the printing task according to the print instruction.

[0021] Further, after sending the print instruction to the printer so that the printer completes the printing task according to the print instruction, it further includes:

[0022] Receive a new protocol and update the new protocol to the preset protocol library.

[0023] In a second aspect, an embodiment of the present invention further provides a print control device, which is applied to a protocol conversion device. The protocol conversion device is installed on an upper computer, and the upper computer is connected to a printer. The device includes:

[0024] A task acquisition module, configured to receive a printing task sent by the upper computer;

[0025] A protocol determination module, configured to analyze the printing task to obtain the data feature of the printing task;

[0026] A data parsing module, configured to determine the data parsing protocol corresponding to the printing task according to the data feature, and parse the printing task according to the data parsing protocol to obtain print data;

[0027] An instruction generation module, configured to convert the print data into bitmap data, and send a print instruction to the printer based on the bitmap data.

[0028] In a third aspect, an embodiment of the present invention further provides an electronic device, which includes:

[0029] One or more processors;

[0030] A storage device for storing one or more programs,

[0031] When the one or more programs are executed by the one or more processors, the one or more processors implement the printing control method described above.

[0032] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the printing control method described above is implemented.

[0033] In the embodiment of the present invention, by receiving a printing task sent by a host computer; analyzing the printing task to obtain the data characteristics of the printing task; determining a data parsing protocol corresponding to the printing task according to the data characteristics, and parsing the printing task according to the data parsing protocol to obtain printing data; converting the printing data into bitmap data, and sending a printing instruction to the printer based on the bitmap data. That is, in the embodiment of the present invention, a data parsing protocol is determined through the data characteristics of the printing task, and printing data is obtained according to the data parsing protocol for data conversion to form bitmap data. Using the bitmap data as intermediate data for storage and generating printing instructions can use the data conversion method to prompt the printer to print printing tasks corresponding to different protocols, enhance the compatibility of the printer with multiple protocols, improve the reuse rate of the device, reduce the device cost. In addition, using the bitmap data as intermediate data can improve the data storage capacity of the device. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 is a flowchart of the printing control method provided by an embodiment of the present invention;

[0035] Figure 2 is another flowchart of the printing control method provided by an embodiment of the present invention;

[0036] Figure 3 is a structural diagram of a printing control device provided by an embodiment of the present invention;

[0037] Figure 4 is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0038] The present invention will be further described in detail below with reference to the drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the present invention, rather than limiting the present invention. In addition, it should be noted that for the sake of description, only parts related to the present invention are shown in the drawings, rather than all the structures.

[0039] Figure 1 This is a schematic flowchart of the printing control method provided by the embodiments of the present invention. This method can be executed by the printing control device provided by the embodiments of the present invention, and the device can be implemented in software and / or hardware. In a specific embodiment, the device is applied to a protocol conversion device, and the protocol conversion device is installed on a host computer, and the host computer is connected to a printer. The following embodiments will be described by taking the device integrated in an electronic device as an example. Refer to Figure 1 , and the method may specifically include the following steps:

[0040] S110. Receive a printing task sent by the host computer;

[0041] Exemplarily, the protocol conversion device can be a device implemented in software and / or hardware and having the function of converting the printing data in the printing task. The situation where the agreements followed by the communication between the host computer and the printer are inconsistent can be resolved by converting the printing data in the printing task. Among them, multiple printing protocols are stored in the protocol conversion device, and the printing protocols stored in the protocol conversion device are used to parse the data of the printing task received from the host computer to determine the printing data in the printing task. The host computer can be a computer that directly sends a printing command, and determines the printing task that the printer needs to print by displaying various information on the screen. Among them, the printing task can be a data packet containing the data that the printer needs to print, and the packaging method of the printing task can be determined according to the communication protocol between the host computer and the printer. Different communication protocols can correspond to different packaging methods.

[0042] In specific implementation, on the host computer or the printer installed with the protocol conversion device, the protocol conversion device receives the printing task sent by the host computer to the printer, and analyzes the printing task to obtain the data characteristics of the printing task, so as to confirm the data parsing protocol corresponding to the printing task according to the data characteristics of the printing task. Among them, the connection method between the protocol conversion device and the host computer can adopt network connection, serial port connection, and Bluetooth interactive access method, or can be integrated into the host computer; among them, the connection method between the protocol conversion device and the printer can adopt network connection, serial port connection, wire connection, and Bluetooth and other connection methods.

[0043] S120. Analyze the printing task to obtain the data characteristics of the printing task;

[0044] In specific implementation, the print data in the print task is encapsulated and packed in the form of instruction sets. Among them, the instruction sets corresponding to each preset protocol are different or have differences, and the instruction sets corresponding to each preset protocol have corresponding data characteristics. For example, the ESC instruction set, the TSPL instruction set, and the CPCL instruction set. Among them, the data characteristics can be that the instruction set contains general data symbols, special data combination rules, and print control languages, etc. Determine the data characteristics of the print task by analyzing the data language, data symbols, and data combination rules in the instruction set of the print task, so as to determine the data parsing protocol corresponding to the print task according to the data characteristics of the print task and obtain the print data.

[0045] S130. Determine the data parsing protocol corresponding to the print task according to the data characteristics, and parse the print task according to the data parsing protocol to obtain the print data;

[0046] In specific implementation, the data parsing protocol corresponding to the print task can be the print protocol used when the host computer generates the print task. This print protocol is used to encapsulate the print data into packets, and the relevant rules of the print protocol can also be used to parse the print task to obtain the print data in the print task, so as to perform data conversion on the print data to form a print instruction that the printer can recognize, and complete the print task sent by the host computer according to the print instruction. Match the print protocol that conforms to the data characteristics from each preset protocol according to the data characteristics of the print task. When the data parsing protocol corresponding to the print task is matched from each preset protocol according to the data characteristics of the print task, use this data parsing protocol to parse the instructions in the print task to obtain the print data, where the print data contains the content that the host computer needs to print.

[0047] S140. Convert the print data into bitmap data, and send a print instruction to the printer based on the bitmap data.

[0048] In specific implementation, the bitmap data can be display data that displays the print data in the form of bitmap and vector graphics. The display data can be a pixel group, and each pixel in the array represents a point in the picture, that is, a point sample. Use the data parsing protocol to parse the instruction set in the print task to obtain the print data, and perform dot matrix conversion on the print data to obtain the bitmap data corresponding to the print data. In fact, perform image conversion on the print data to obtain the bitmap data. The bitmap data is stored using pixels as memory units, that is, the smallest memory unit can be used to mark a number, and the storage space of the data can be reduced through the mapping rule to achieve the purpose of increasing the storage capacity. The bitmap data, as the image-converted data, can be converted through the print protocol of the printer to generate a print instruction that the printer can execute.

[0049] In an embodiment of the present invention, a printing task sent by a host computer is received; the data characteristics of the printing task are analyzed; a data parsing protocol corresponding to the printing task is determined according to the data characteristics, and the printing task is parsed according to the data parsing protocol to obtain printing data; the printing data is converted into bitmap data, and a printing instruction is sent to the printer based on the bitmap data. That is, in the embodiment of the present invention, a data parsing protocol is determined through the data characteristics of the printing task, printing data is obtained according to the data parsing protocol for data conversion to form bitmap data, and the bitmap data is used as intermediate data for storage and generation of printing instructions. Different protocols corresponding to printing tasks can be printed by the printer by means of data conversion, the compatibility of multiple protocols of the printer is enhanced, the reuse rate of the device is improved, the device cost is reduced, and in addition, the data storage capacity of the device can be improved by using the bitmap data as intermediate data.

[0050] The printing control method provided by the embodiment of the present invention is further described below. As Figure 2 shown, the method may specifically include the following steps:

[0051] S210. Receive a printing task sent by a host computer;

[0052] S220. Analyze the printing task to obtain the data characteristics of the printing task;

[0053] In a specific implementation, the printing data in the printing task is encapsulated and packed in the form of an instruction set. Among them, the instruction sets corresponding to each preset protocol are different or have differences, and each preset protocol corresponds to an instruction set with corresponding data characteristics. For example, the ESC instruction set, the TSPL instruction set, and the CPCL instruction set. Among them, the data characteristics may be that the instruction set contains general data symbols, special data combination rules, and printing control languages, etc. The data characteristics of the printing task are determined by analyzing the data language, data symbols, and data combination rules in the printing task, so as to determine the data parsing protocol corresponding to the printing task according to the data characteristics of the printing task and obtain the printing data.

[0054] For example: The printing task sent by the ESC instruction set contains data characteristics of instruction combinations such as 0x1b 0x40, 0x1b 0x4a, 0x1b 0x64, and 0x1d 0x76. The printing task sent by the TSPL instruction set contains data characteristics of instruction combinations such as!, T, PRINT, etc. The printing task sent by CPCL contains data characteristics of instruction combinations such as SIZE, PRINT, etc.

[0055] S230. Determine a preset matching time according to each preset protocol, and determine whether the data characteristics match the characteristics of the current protocol within the preset matching time;

[0056] Exemplarily, the preset matching time can be the time required for the data characteristics of the printing task preset according to actual requirements and experimental data to match the data characteristics of the instruction set corresponding to each preset protocol. It can be the unit time preset according to experimental data, that is, the matching time of each preset protocol is the same. It can also be the preset matching time set corresponding to each preset protocol differently, that is, the preset times of the data characteristics of the instruction set corresponding to each preset protocol are different. The current protocol can be the printing protocol that is currently performing feature matching during the data feature matching process, that is, any one of the preset protocols. During the data feature matching process, the preset protocols can determine the matching order according to certain rules, and then perform matching on each preset protocol one by one. Among them, the feature of the current protocol can be the data characteristics of the instruction set of the current protocol. Among them, it can be sorted from large to small according to the number of successful matches of each preset protocol, or when the preset matching times are inconsistent, it can be sorted from small to large according to the length of the preset matching time, so as to reduce the matching time.

[0057] In specific implementation, to determine the preset matching time corresponding to each preset protocol during the data feature matching process according to each preset protocol, it can be the unit time preset according to experimental data, or the preset matching time can be set corresponding to each preset protocol differently. Perform sequential matching according to the preset matching time corresponding to each preset protocol and the matching order corresponding to each preset protocol. Each preset protocol performs data feature matching to determine whether the data characteristics match the features of the current protocol within the preset matching time. When the data characteristics do not match the data characteristics of the instruction set of the current protocol, that is, the data characteristics are inconsistent with the data characteristics of the instruction set of the current protocol, or when it cannot be determined whether the data characteristics are consistent with the data characteristics of the instruction set of the current protocol within the preset matching time, it is determined that the data characteristics do not match the data characteristics of the instruction set of the current protocol.

[0058] S240. When the data characteristics do not match the characteristics of the current protocol, sequentially execute the matching of the data characteristics with the next protocol until the data parsing protocol corresponding to the printing task is matched from each preset protocol;

[0059] In a specific implementation, the next protocol can be the printing protocol to be matched next after the current protocol matching ends during the data feature matching process, that is, the printing protocol after the current protocol in the sorting. Sequentially match according to the preset matching time corresponding to each preset protocol and the matching order corresponding to each preset protocol. Each preset protocol performs data feature matching to determine whether the data features match the features of the current protocol within the preset matching time. When the data features do not match the data features of the instruction set of the current protocol, that is, when the data features are inconsistent with the data features of the instruction set of the current protocol, then sequentially execute the matching of the data features with the next protocol until the data parsing protocol corresponding to the number of printed people is matched from each preset protocol. Additionally, when it is impossible to determine whether the data features match the data features of the instruction set of the current protocol and the preset matching time has arrived, then determine that the data features do not match the data features of the instruction set of the current protocol, and then sequentially execute the matching of the data features with the next protocol until the data parsing protocol corresponding to the number of printed people is matched from each preset protocol. For example, set the preset matching time to a consistent time of 3 seconds, determine whether the data features match the data features of the instruction set of the current protocol within 3 seconds. When the data features do not match the data features of the instruction set of the current protocol within 3 seconds, then determine that the data features do not match the data features of the instruction set of the current protocol, and sequentially execute the matching of the data features with the next protocol within the next 3 seconds until the data parsing protocol corresponding to the number of printed people is matched from each preset protocol.

[0060] S250. Parse the print task according to the data parsing protocol to obtain print data, where each preset protocol is stored in the protocol conversion device;

[0061] In a specific implementation, match the print protocol that conforms to the data features of the print task from each preset protocol according to the data features of the print task, and match according to the data language, data symbols, and data combination rules of the instruction set corresponding to each preset protocol and the data features of the print task. When it is determined that the data features of the instruction set corresponding to a print protocol are consistent with the data features of the print task from each preset protocol, then the data features of the instruction set corresponding to the print protocol match the data features of the print task, and use this print protocol as the data parsing protocol corresponding to the print task, and use this data parsing protocol to parse the instruction set in the print task to obtain print data. Among them, each preset protocol is stored in the protocol conversion device and is used to determine the data parsing protocol through data feature matching.

[0062] S260. Convert the print data into bitmap data, and send a print instruction to the printer based on the bitmap data.

[0063] Further, converting the print data into bitmap data includes:

[0064] Determine the content of the print data, and perform bitmap mapping on the content of the print data to obtain bitmap information;

[0065] Format the bitmap information according to the general data format to obtain bitmap data.

[0066] In a specific implementation, the general data format can be an image file format, for example, the BMP file storage format. Parse the instruction set in the print task using a data parsing protocol to obtain the print data, determine the content of the print data, perform bitmap mapping on the content of the print data, determine the position information of each dot in the bitmap data, and format the bitmap information according to the general data format to obtain bitmap data or a bitmap file, so as to combine the print data and the print protocol through image scanning to generate a print instruction.

[0067] Further, send a print instruction to the printer based on the bitmap data, including:

[0068] Obtain the print protocol from the printer, and generate a print instruction according to the bitmap data and the print protocol;

[0069] Send the print instruction to the printer so that the printer can complete the print task according to the print instruction.

[0070] In a specific implementation, utilize the communication connection between the protocol conversion device and the printer to obtain the print protocol of the printer, combine the print data and the print protocol through image scanning to generate a print instruction, send the print instruction to the printer, and the printer completes the print task according to the received print instruction.

[0071] Further, after sending the print instruction to the printer so that the printer can complete the print task according to the print instruction, it further includes:

[0072] Receive a new protocol, and update the new protocol to the preset protocol library.

[0073] In a specific implementation, after each time the printer instruction is sent to the printer, it is necessary to receive the new protocol through the network. It can be the server connected to the network for data update to receive the new protocol, or the protocol conversion device for data update to receive the new protocol, update the new protocol to the preset protocol library, and re-determine the preset matching time and the order of data feature matching of each preset protocol in the preset protocol library, so as to perform data feature matching on the received new print task.

[0074] In an embodiment of the present invention, a printing task sent by a host computer is received; data characteristics of the printing task are analyzed; a data parsing protocol corresponding to the printing task is determined according to the data characteristics, and the printing task is parsed according to the data parsing protocol to obtain printing data; the printing data is converted into bitmap data, and a printing instruction is sent to a printer based on the bitmap data. That is, in the embodiment of the present invention, the data parsing protocol is determined according to the data characteristics of the printing task, the printing data is obtained according to the data parsing protocol for data conversion to form bitmap data, and the bitmap data is used as intermediate data for storage and generation of a printing instruction. Different printing tasks corresponding to different protocols can be printed by the printer by means of data conversion, the compatibility of multiple protocols of the printer is enhanced, the reuse rate of the device is increased, the device cost is reduced, and in addition, the data storage capacity of the device can be improved by using the bitmap data as intermediate data.

[0075] Figure 3 is a schematic structural diagram of a printing control device provided by an embodiment of the present invention, as Figure 3 shown, the printing control device includes:

[0076] A task acquisition module 310, configured to receive a printing task sent by a host computer;

[0077] A protocol determination module 320, configured to analyze the printing task to obtain data characteristics of the printing task;

[0078] A data parsing module 330, configured to determine a data parsing protocol corresponding to the printing task according to the data characteristics, and parse the printing task according to the data parsing protocol to obtain printing data;

[0079] An instruction generation module 340, configured to convert the printing data into bitmap data, and send a printing instruction to a printer based on the bitmap data.

[0080] In one embodiment, the data parsing module 330 determines a data parsing protocol corresponding to the printing task according to the data characteristics, including:

[0081] Matching a data parsing protocol corresponding to the printing task from each preset protocol according to the data characteristics, where each preset protocol is stored in the protocol conversion device.

[0082] In one embodiment, the data parsing module 330 matches a data parsing protocol corresponding to the printing task from each preset protocol according to the data characteristics, including:

[0083] Determining a preset matching time according to each preset protocol;

[0084] Determining whether the data characteristics match the characteristics of the current protocol within the preset matching time;

[0085] When the data feature does not match the feature of the current protocol, the data feature is sequentially matched with the next protocol until the data parsing protocol corresponding to the print task is matched from the preset protocols.

[0086] In one embodiment, the instruction generation module 340 converts the print data into bitmap data, including:

[0087] Determine the content of the print data, and perform bitmap mapping on the content of the print data to obtain bitmap information;

[0088] Format the bitmap information according to the general data format to obtain the bitmap data.

[0089] In one embodiment, the instruction generation module 340 sends a print instruction to the printer based on the bitmap data, including:

[0090] Obtain the print protocol from the printer, and generate a print instruction according to the bitmap data and the print protocol;

[0091] Send the print instruction to the printer so that the printer completes the print task according to the print instruction.

[0092] In one embodiment, after the instruction generation module 340 sends the print instruction to the printer so that the printer completes the print task according to the print instruction, it further includes:

[0093] Receive a new protocol, and update the new protocol to the preset protocol library.

[0094] In the device according to the embodiment of the present invention, a print task sent by the host computer is received; the data feature of the print task is analyzed to obtain the data feature of the print task; the data parsing protocol corresponding to the print task is determined according to the data feature, and the print task is parsed according to the data parsing protocol to obtain print data; the print data is converted into bitmap data, and a print instruction is sent to the printer based on the bitmap data. That is, in the embodiment of the present invention, the data parsing protocol is determined through the data feature of the print task, and the print data is obtained according to the data parsing protocol for data conversion to form bitmap data. The bitmap data is used as intermediate data for storage and generation of print instructions, which can use the data conversion method to prompt the printer to print print tasks corresponding to different protocols, enhance the compatibility of the printer with multiple protocols, improve the reuse rate of the device, reduce the device cost, and in addition, using the bitmap data as intermediate data can improve the data storage capacity of the device.

[0095] Figure 4 It is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. Figure 4A block diagram of an exemplary electronic device 12 suitable for implementing embodiments of the present invention is shown. Figure 4 The illustrated electronic device 12 is merely an example and should not impose any limitation on the functions and usage scope of the embodiments of the present invention.

[0096] As Figure 4 shown, the electronic device 12 is presented in the form of a general-purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 connecting different system components (including the system memory 28 and the processing unit 16).

[0097] The bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus structures. By way of example, these architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.

[0098] The electronic device 12 typically includes a variety of computer system-readable media. These media can be any available media accessible by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.

[0099] The system memory 28 may include computer system-readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, a storage system 34 can be used to read and write non-removable, non-volatile magnetic media ( Figure 4 not shown, typically referred to as a "hard disk drive"). Although Figure 4 not shown in the figure, a disk drive for reading and writing removable non-volatile disks (such as "floppy disks") and an optical disk drive for reading and writing removable non-volatile optical disks (such as CD-ROM, DVD-ROM, or other optical media) can be provided. In these cases, each drive can be connected to the bus 18 through one or more data media interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.

[0100] A program / utilities 40 having a set (at least one) of program modules 42 can be stored, for example, in a memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. The program modules 42 generally execute the functions and / or methods in the embodiments described in the present invention.

[0101] The electronic device 12 can also communicate with one or more external devices 14 (such as a keyboard, a pointing device, a display 24, etc.), and can also communicate with one or more devices that enable a user to interact with the electronic device 12, and / or communicate with any device that enables the electronic device 12 to communicate with one or more other computing devices (such as a network card, a modem, etc.). Such communication can be carried out through an input / output (I / O) interface 22. Moreover, the electronic device 12 can also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 20. As shown in the figure, the network adapter 20 communicates with other modules of the electronic device 12 through a bus 18. It should be understood that although not shown in the figure, other hardware and / or software modules can be used in combination with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.

[0102] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the print control method provided by the embodiments of the present invention. The method includes:

[0103] Receiving a print task sent by the host computer;

[0104] Analyzing the print task to obtain data characteristics of the print task;

[0105] Determining a data parsing protocol corresponding to the print task according to the data characteristics, and parsing the print task according to the data parsing protocol to obtain print data;

[0106] Converting the print data into bitmap data, and sending a print instruction to the printer based on the bitmap data.

[0107] Embodiments of the present invention also provide a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the print control method is implemented. The method includes:

[0108] Receiving a print task sent by the host computer;

[0109] Analyze the printing task to obtain the data characteristics of the printing task;

[0110] Determine the data parsing protocol corresponding to the printing task according to the data characteristics, and parse the printing task according to the data parsing protocol to obtain printing data;

[0111] Convert the printing data into bitmap data, and send a printing instruction to the printer based on the bitmap data.

[0112] The computer storage medium of the embodiments of the present invention may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the computer-readable storage medium include: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, the computer-readable storage medium may be any tangible medium that contains or stores a program, which can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0113] The computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries the computer-readable program code. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0114] The program code contained on the computer-readable medium can be transmitted by any appropriate medium, including but not limited to wireless, wire, optical fiber, RF, etc., or any suitable combination of the above.

[0115] Computer program code for performing the operations of the present invention may be written in one or more programming languages or combinations thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and also including conventional procedural programming languages such as the "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network including a local area network (LAN) or a wide area network (WAN), or, may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0116] Note that the above is only the preferred embodiment of the present invention and the technical principles applied. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, re-adjustments, and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments. Without departing from the concept of the present invention, more other equivalent embodiments may be included, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A printing control method, characterized in that, Applied to a protocol conversion device, the protocol conversion device is installed in a host computer, and the host computer is connected to a printer. The printing control method includes: Receiving a printing task sent by the host computer; Analyzing the printing task to obtain the data characteristics of the printing task; the data characteristics include data symbols, data combination rules, and printing control language; Determining a data parsing protocol corresponding to the printing task according to the data characteristics, and parsing the printing task according to the data parsing protocol to obtain printing data; Converting the printing data into bitmap data, and sending a printing instruction to the printer based on the bitmap data; Among them, determining the data parsing protocol corresponding to the printing task according to the data characteristics includes: determining a preset matching time according to each preset protocol; determining whether the data characteristics match the characteristics of the current protocol within the preset matching time; when the data characteristics do not match the characteristics of the current protocol, the data characteristics are sequentially matched with the next protocol until the data parsing protocol corresponding to the printing task is matched from each of the preset protocols; among them, each of the preset protocols is stored in the protocol conversion device.

2. The method according to claim 1, characterized in that, Converting the printing data into bitmap data includes: Determining the content of the printing data, and performing bitmap mapping on the content of the printing data to obtain bitmap information; Formatting the bitmap information according to a general data format to obtain the bitmap data.

3. The method according to claim 2, wherein Sending a printing instruction to the printer based on the bitmap data includes: Obtaining a printing protocol from the printer, and generating a printing instruction according to the bitmap data and the printing protocol; Sending the printing instruction to the printer so that the printer completes the printing task according to the printing instruction.

4. The method according to claim 3, wherein After sending the printing instruction to the printer so that the printer completes the printing task according to the printing instruction, it further includes: Receiving a new protocol and updating the new protocol to a preset protocol library.

5. A printing control device, characterized in that, Applied to a protocol conversion device, the protocol conversion device is installed in a host computer, and the host computer is connected to a printer. The printing control device includes: A task acquisition module for receiving a printing task sent by the host computer; A protocol determination module for analyzing the printing task to obtain the data characteristics of the printing task; the data characteristics include data symbols, data combination rules, and printing control language; A data parsing module for determining a data parsing protocol corresponding to the printing task according to the data characteristics, and parsing the printing task according to the data parsing protocol to obtain printing data; An instruction generation module for converting the printing data into bitmap data, and sending a printing instruction to the printer based on the bitmap data; Among them, determining the data parsing protocol corresponding to the printing task according to the data characteristics in the data parsing module includes: determining a preset matching time according to each preset protocol; determining whether the data characteristics match the characteristics of the current protocol within the preset matching time; when the data characteristics do not match the characteristics of the current protocol, sequentially execute the matching of the data characteristics with the next protocol until the data parsing protocol corresponding to the printing task is matched from the various preset protocols; among them, the various preset protocols are stored in the protocol conversion device.

6. An electronic device, characterized in that, The electronic device includes: One or more processors; A storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the printing control method according to any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the printing control method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Printing apparatus and method of controlling printing apparatus

    CN107168658A

  • Printing language recognition method and device, electronic equipment and storage medium

    CN110874195A

  • Printing method and device, electronic equipment and computer readable storage medium

    CN113190187A