Printing data processing method and device, equipment and medium

By performing multiple filtering and filtering of the ticket print data, the problem of insufficient data filtering in the existing technology is solved, and more efficient and accurate ticket printing is achieved, which improves system stability and resource utilization efficiency.

CN120428933APending Publication Date: 2025-08-05BEIJING SHUYAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510520389.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-24
Publication Date
2025-08-05

AI Technical Summary

Technical Problem

The existing ticket printing system lacks an effective data filtering mechanism, resulting in the collected data containing a large amount of non-printed data, affecting the accuracy and efficiency of ticket printing.

Method used

By performing multiple filtering of the printed data, it includes marking the data according to the preset printing instruction set format, applying filtering rules to eliminate invalid data, and parsing and printing the valid data.

Benefits of technology

Improves printing efficiency and accuracy, reduces invalid data processing time, saves resources, enhances system stability and reliability, and extends the printer service life.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120428933A_ABST
    Figure CN120428933A_ABST
Patent Text Reader

Abstract

The invention provides a printing data processing method and device, equipment and a medium, and relates to the technical field of computers, and the method comprises the steps: obtaining printing data received in a preset time period; marking the printing data according to a preset printing instruction set format to obtain marked printing data; wherein the mark printing data comprises initial invalid printing data and initial valid printing data; according to a filtering rule, filtering the initial invalid printing data, and removing the initial invalid printing data meeting the filtering rule to obtain filtered invalid printing data; and analyzing the filtered invalid printing data and the initial valid printing data to obtain printing content, and printing the printing content. According to the technical scheme, the printing data can be screened and filtered for multiple times, the printing efficiency and accuracy are improved, and the time and resources for processing invalid printing data by the printing equipment are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a printing data processing method, device, equipment and medium. Background Art

[0002] With the rapid development of industries such as retail, catering, and logistics, the receipt printing system, as an important tool for information recording and transaction vouchers, has become increasingly widely used.

[0003] In the prior art, a receipt printing system typically consists of a data source (such as a cash register), a data transmission line, a receipt printer, and an external data collection device. The data source sends various data to the printer port via the transmission line, while the external data collection device is connected to the printer port to collect all passing data.

[0004] Due to the lack of an effective filtering mechanism, this acquisition device simply collects all data from the printer port without classifying and filtering the data, resulting in the collected data containing a large amount of non-printing data, such as control instructions, status feedback information, etc. This data has no practical significance for the analysis and utilization of the receipt content, seriously affecting the accuracy and efficiency of receipt printing. Summary of the Invention

[0005] In view of this, the object of the present invention is to provide a print data processing method, device, equipment and medium, which improves printing efficiency and accuracy by multiple screening and filtering of print data, and reduces the time and resources of the printing device in processing invalid print data.

[0006] In a first aspect, an embodiment of the present invention provides a method for processing print data, the method comprising:

[0007] Obtaining print data received within a preset time period;

[0008] Marking the print data according to a preset print instruction set format to obtain marked print data; wherein the marked print data includes initial invalid print data and initial valid print data;

[0009] filtering the initial invalid printing data according to the filtering rules, eliminating the initial invalid printing data that meets the filtering rules, and obtaining filtered invalid printing data;

[0010] The filtered invalid printing data and the initial valid printing data are parsed to obtain printing content, and the printing content is printed.

[0011] In a preferred embodiment of the present invention, the print data includes a plurality of print instructions; and the step of marking the print data according to a preset print instruction set format to obtain marked print data includes:

[0012] Obtaining preset instruction features corresponding to a preset printing instruction set;

[0013] Parsing the print data to obtain target instruction features corresponding to each print instruction in the print data;

[0014] For each printing instruction, the printing instruction is marked according to the matching result between the preset instruction feature and the target instruction feature to obtain marked printing data.

[0015] In a preferred embodiment of the present invention, the number of the preset printing instruction sets is multiple; and the marking of the printing instructions according to the matching result between the preset instruction features and the target instruction features to obtain the marked printing data includes:

[0016] When the target instruction feature successfully matches the preset instruction feature corresponding to any preset printing instruction set, the tag of the printing instruction is determined to be valid, and the printing instruction is determined to be initial valid printing data;

[0017] When the target instruction feature fails to match the preset instruction features corresponding to all preset printing instruction sets, the tag of the printing instruction is determined to be invalid, and the printing instruction is determined to be initial invalid printing data.

[0018] In a preferred embodiment of the present invention, the initial invalid print data includes at least one print instruction; filtering the initial invalid print data according to the filtering rule, eliminating the initial invalid print data that meets the filtering rule, and obtaining the filtered invalid print data includes:

[0019] For each printing instruction, match it with the filtering rules to obtain a first matching result;

[0020] If the first matching result is a successful match, deleting the print instruction;

[0021] When the first matching result is a matching failure, the printing instruction is retained as filtered invalid printing data.

[0022] In a preferred embodiment of the present invention, the filtering rule includes multiple filtering conditions; for each printing instruction, the filtering rule is matched to obtain a first matching result, including:

[0023] For each print instruction, determining second matching results corresponding to the print instruction and each of the filter conditions in sequence according to a preset order of the filter conditions; wherein the number of the second matching results is multiple;

[0024] If any of the second matching results is a successful match, determining the first matching result is a successful match;

[0025] When all the second matching results are matching failures, the first matching result is determined to be matching failure.

[0026] In a preferred embodiment of the present invention, parsing the filtered invalid print data and the initial valid print data, obtaining print content, and printing the print content includes:

[0027] Parsing the filtered invalid printing data and the initial valid printing data according to a preset printing instruction set format to obtain printing content;

[0028] A print image is generated according to the print content and a preset print layout, and the print image is printed.

[0029] In a preferred embodiment of the present invention, the filtering invalid printing data and the initial valid printing data are parsed according to a preset printing instruction set format to obtain the printing content, including:

[0030] Identifying the printing instructions in the filtered invalid printing data and the initial valid printing data according to a preset printing instruction set format;

[0031] The printing parameters in the printing instruction are determined as printing content.

[0032] In a second aspect, an embodiment of the present invention further provides a print data processing device, comprising:

[0033] A data acquisition module, used to acquire print data received within a preset time period;

[0034] a marking module, configured to mark the print data according to a preset print instruction set format to obtain marked print data; wherein the marked print data includes initially invalid print data and initially valid print data;

[0035] A filtering module, configured to filter the initial invalid printing data according to a filtering rule, remove the initial invalid printing data that meets the filtering rule, and obtain filtered invalid printing data;

[0036] The printing module is used to parse the filtered invalid printing data and the initial valid printing data, obtain printing content, and print the printing content.

[0037] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the print data processing method of the first aspect.

[0038] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the print data processing method of the first aspect.

[0039] The embodiments of the present invention bring the following beneficial effects:

[0040] An embodiment of the present invention provides a method for processing print data. By acquiring print data within a preset time period, batch data can be centrally processed, avoiding the tedious process of single data processing and improving overall processing efficiency. At the same time, initial invalid print data is filtered out, which reduces unnecessary printing tasks, saves printing time and resources, and enables the printer to process valid print data more quickly, thereby improving printing speed. Initial invalid print data that meets the filtering rules is eliminated to prevent invalid data from entering the printing process, thereby reducing system errors or failures that may be caused by processing invalid data, enhancing the stability and reliability of the entire printing system, and reducing the risk of system crashes or printing errors. By performing multiple screening and filtering, the filtered invalid print data and the initial valid print data are parsed before printing, which can rationally utilize the resources of the printer, avoid resource waste, enable the printer to operate more efficiently, extend the service life of the printer, and also reduce energy consumption.

[0041] Other features and advantages of the present invention will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by implementing the above-mentioned technology of the present invention.

[0042] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0044] Figure 1 A flowchart of a print data processing method provided by an embodiment of the present invention;

[0045] Figure 2 A flowchart of another print data processing method provided by an embodiment of the present invention;

[0046] Figure 3 A schematic structural diagram of a print data processing device provided by an embodiment of the present invention;

[0047] Figure 4 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0048] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0049] At present, in the field of receipt printing data collection, commonly used collection devices mainly focus on the comprehensive collection of data, but lack an effective screening mechanism for the collected data. For example, a common receipt printing data collection system mainly consists of a data source (such as a cash register), a data transmission line, a receipt printer, and an external collection device. The data source sends various types of data to the printer port through the transmission line, and the external collection device is connected to the printer port to collect all passing data. This collection device simply collects all the data from the printer port without classifying and filtering the data, resulting in the collected data containing a large amount of non-printing data, such as control instructions, status feedback information, etc. These data have no practical significance for the analysis and utilization of the receipt content, which not only reduces the accuracy of data collection, but also seriously affects the analysis efficiency.

[0050] Based on this, embodiments of the present invention provide a print data processing method, apparatus, device, and medium, which improve printing efficiency and accuracy by performing multiple screening and filtering on print data, and reduce the time and resources of the printing device in processing invalid print data.

[0051] To facilitate understanding of this embodiment, a printing data processing method disclosed in an embodiment of the present invention is first introduced in detail.

[0052] Example 1

[0053] An embodiment of the present invention provides a method for processing printing data. Figure 1 Flowchart of a method for processing printing data provided by an embodiment of the present invention. Figure 1 As shown, the print data processing method realizes real-time monitoring, analysis and filtering of print data by setting a print data processing device at the receipt printer port. The method may include the following steps:

[0054] Step S101 , obtaining print data received within a preset time period.

[0055] The preset time period refers to a pre-set time period for collecting print data. The preset time period can be adjusted based on actual circumstances. Print data refers to data collected at the receipt printer port. In embodiments of the present invention, the print data may comprise print instructions, which may specify the content to be printed by the printer and the operations to be performed by the printer.

[0056] Specifically, a data collection device may be provided at the receipt printer port to collect printing data once within each preset time period.

[0057] Step S102: marking the print data according to a preset print instruction set format to obtain marked print data.

[0058] A print command set is a collection of printing instructions used to control a printer to perform specific operations. Each print command set has a specific format and pattern, and different printers or different types of print tasks may use different command sets. For example, a label printer may use the JABOR command set to meet specific label printing requirements, such as barcode printing and label size settings. By sending a specific command sequence to the printer, functions such as setting the print format, selecting the font, controlling the print direction, and printing graphics can be achieved. Common print command sets include the ESC-P series command set, the JABOR command set for labels, and the POSTEK and POSBANK command sets. Predefined print command set formats describe the format and pattern of a print command set. For example, the ESC-P command set typically begins with specific control characters, such as ESC (hexadecimal 1B) and GS (hexadecimal 1D), followed by the corresponding operation command and parameters.

[0059] Marked print data includes initial invalid print data and initial valid print data. Initial invalid print data refers to data that does not require the printer to perform a print function, such as control instructions, status feedback information, etc. Initial valid print data refers to data that controls the printer to perform a print function.

[0060] Specifically, according to the preset printing instruction set format, each printing instruction in the printing data is compared with the preset printing instruction set format, the instructions that conform to the preset printing instruction set format are marked as initial valid printing data, and the instructions that do not conform to the preset printing instruction set format are marked as initial invalid printing data to obtain marked printing data.

[0061] Step S103 , filtering the initial invalid printing data according to the filtering rules, eliminating the initial invalid printing data that meets the filtering rules, and obtaining filtered invalid printing data.

[0062] Filtering rules are a set of predefined conditions used to further filter initial invalid print data. Initial invalid print data that meets the filtering rules will be eliminated, and only those that do not meet the filtering rules will be retained. This data is the filtered invalid print data. Filtering rules can be set according to actual conditions.

[0063] Furthermore, the conditions within the filtering rules can be flexibly arranged and nested, or their priorities can be clearly defined. For example, when a print instruction in print data triggers multiple conditions simultaneously, they are processed in order of priority. This approach improves the ability to identify complex and invalid print data, avoiding misjudgments and missed detections.

[0064] In another real-time approach, machine learning models can be built to improve the accuracy and generalization of invalid print data identification. For example, deep learning models such as convolutional neural networks (CNNs) or recurrent neural networks (RNNs) are suitable for processing spatially structured data, such as print instructions in the form of images; RNNs excel at processing sequential data, such as text-based print instructions. By rationally designing the model's number of layers, number of neurons, and connectivity, the model's ability to extract features from print data can be enhanced, thereby improving classification accuracy. Combining filtering rules with machine learning models can create a more comprehensive print data filtering process. For example, filtering rules can be used to perform a preliminary screening of print data, quickly eliminating clearly invalid data. The remaining data can then be input into a machine learning model for further classification, improving classification accuracy and efficiency. Real-time adjustment mechanisms for filtering rules and machine learning models can also be implemented. For example, new print data can be regularly collected and annotated, and then used to update and train the machine learning model. Based on feedback from actual applications, the combination and priority of filtering rules can be dynamically adjusted to improve the system's ability to identify different types of invalid data.

[0065] Step S104 , parsing the filtered invalid printing data and the initial valid printing data to obtain printing content, and printing the printing content.

[0066] The print content refers to the content that needs to be displayed after printing is completed. Specifically, according to the preset print instruction set format, the filtered invalid print data and the initial valid print data are identified, the print content is determined and extracted, and the print content is sent to the printer for printing.

[0067] Specifically, printing can be performed through steps A1 and A2.

[0068] Step A1: parsing the filtered invalid printing data and the initial valid printing data according to a preset printing instruction set format to obtain printing content.

[0069] Specifically, according to the preset print instruction set format, the print instruction types contained in the filtered invalid print data and the initial valid print data are identified. Based on the identified print instruction types, data related to the print content, that is, the print content, is extracted.

[0070] Furthermore, according to the preset printing instruction set format, the filtered invalid printing data and the initial valid printing data are parsed to obtain printing content, including: identifying the printing instructions in the filtered invalid printing data and the initial valid printing data according to the preset printing instruction set format; and determining the printing parameters in the printing instructions as printing content.

[0071] According to a preset print instruction set format, data that meets the preset print instruction set format is identified from the filtered invalid print data and the initial valid print data as the print instruction. It is understood that the filtered invalid print data may include at least one print instruction, and the initial valid print data may also include at least one print instruction.

[0072] Specifically, the filtered invalid print data and the initial valid print data consist of a series of character strings. A preset print instruction set format specifies the formats and functions of different types of print instructions. Data that meets the format specified in the preset print instruction set format is determined from the filtered invalid print data and the initial valid print data as the print instruction. Each print instruction has a corresponding function, such as character printing, graphic printing, paper feeding, or paper cutting.

[0073] Print parameters refer to data related to the print content. For example, for character printing instructions, the print parameters include information such as character encoding, font size, and character spacing; for graphic printing instructions, the print parameters include information such as the pixel data, size, and position of the graphic.

[0074] Specifically, the printing instruction includes printing parameters, and the printing parameters in the printing instruction are determined as the printing content.

[0075] Step A2: generating a print image according to the print content and a preset print layout, and printing the print image.

[0076] Based on the extracted printed content, the receipt image or text content is generated according to the receipt layout and format requirements. For example, character-based printed content is converted into text content according to specified fonts and typesetting rules, and graphic-based printed content is converted into corresponding image elements. These elements are then combined into a complete receipt image. The generated receipt content can be stored as an image file (such as BMP, PNG, etc.) or a text file (such as XML, JSON, etc.) to facilitate subsequent data utilization, such as display, storage, and transmission.

[0077] Identifying and determining print instructions according to a preset print instruction set format ensures the standardization and accuracy of the parsing process, reduces parsing errors caused by human judgment or ambiguous rules, and improves the reliability of the parsing results. Generating a print image based on the extracted print content according to a preset print layout ensures a reasonable layout and standardized format for the printout. The generated print content can be stored as an image or text file, facilitating subsequent data utilization. These files can be used for a variety of purposes, including display, storage, and transmission, facilitating further data processing and management, and enhancing the system's scalability and practicality.

[0078] The printing data processing method provided by the embodiment of the present invention can centrally process batch data by acquiring printing data within a preset time period, avoiding the tedious process of single data processing and improving the overall processing efficiency. At the same time, the initial invalid printing data is filtered out, which reduces unnecessary printing tasks, saves printing time and resources, and enables the printer to process valid printing data more quickly, thereby improving the printing speed. The initial invalid printing data that meets the filtering rules is eliminated to prevent invalid data from entering the printing process, thereby reducing system errors or failures that may be caused by processing invalid data, enhancing the stability and reliability of the entire printing system, and reducing the risk of system crashes or printing errors. By filtering multiple times, the filtered invalid printing data and the initial valid printing data are parsed before printing, which can rationally utilize the resources of the printer, avoid resource waste, enable the printer to operate more efficiently, extend the service life of the printer, and also reduce energy consumption.

[0079] Example 2

[0080] An embodiment of the present invention also provides another method for processing print data; this method is implemented based on the method of the above embodiment; this method focuses on describing a specific implementation method of marking the print data according to a preset print instruction set format to obtain marked print data.

[0081] Figure 2 A flowchart of another print data processing method provided by an embodiment of the present invention is shown in FIG. Figure 2 As shown, the print data processing method may include the following steps:

[0082] Step S201: acquiring printing data received within a preset time period.

[0083] The printing data includes a plurality of printing instructions.

[0084] Step S202: obtaining a preset instruction feature corresponding to a preset printing instruction set.

[0085] The preset instruction feature is used to describe the format and regularity of the printing instruction set, which at least includes information such as control characters, operation commands and printing parameters. Specifically, the preset instruction feature corresponding to the preset printing instruction set can be obtained by looking up a table or the like.

[0086] Step S203: parsing the print data to obtain target instruction features corresponding to each print instruction in the print data.

[0087] The target instruction feature refers to a feature in the print data that conforms to the format and rules of the print instruction set. Specifically, for each print instruction in the print data, the preset instruction features corresponding to the preset print instruction set are searched for the preset instruction feature that the print instruction conforms to, and the preset instruction feature is used as the target instruction feature.

[0088] For example, the preset command features of the ESC-P command set include: control characters include ESC (hexadecimal 1B) and GS (hexadecimal 1D), operation commands include command 1 and command 2, and print parameters include parameter 1 and parameter 2. For a print command in the print data, if the print command includes the control character ESC, operation command 1, and parameter 2, the control character ESC, operation command 1, and parameter 2 are used as the target feature command corresponding to the print command.

[0089] Step S204 : For each printing instruction, the printing instruction is marked according to the matching result between the preset instruction feature and the target instruction feature to obtain marked printing data.

[0090] Specifically, for each print instruction, if the target instruction feature can be found in the preset instruction features, it means that the print instruction meets the preset instruction features, the matching result is successful, and the print instruction is marked as initial valid print data. If the target instruction feature cannot be found in the preset instruction features, it means that the print instruction does not meet the preset instruction features, the matching result is failed, and the print instruction is marked as initial invalid print data.

[0091] There are multiple preset printing instruction sets. Specifically, the marking printing data can be obtained through steps B1 and B2.

[0092] Step B1: when the target instruction feature successfully matches the preset instruction feature corresponding to any preset printing instruction set, the tag of the printing instruction is determined to be valid, and the printing instruction is determined to be initial valid printing data.

[0093] Step B2: when the target instruction feature fails to match the preset instruction features corresponding to all preset printing instruction sets, the tag of the printing instruction is determined to be invalid, and the printing instruction is determined to be initial invalid printing data.

[0094] Specifically, for each print instruction, if the target instruction feature can be found in any of the preset instruction features, it means that the print instruction meets the preset instruction features, the matching result is successful, and the print instruction is marked as initially valid print data. If the target instruction feature cannot be found in any of the preset instruction features, it means that the print instruction does not meet the preset instruction features, the matching result is failed, and the print instruction is marked as initially invalid print data.

[0095] The preset printing instruction set format includes multiple types of instruction sets, which can recognize and process multiple types of instructions, showing good flexibility and versatility, and can adapt to diverse printing needs.

[0096] Step S205 , filtering the initial invalid printing data according to the filtering rules, eliminating the initial invalid printing data that meets the filtering rules, and obtaining filtered invalid printing data.

[0097] It is understandable that the print data includes multiple print instructions. After marking the print data, the initial invalid print data obtained includes at least one print instruction, and the initial valid print data includes at least one print instruction.

[0098] Specifically, the filtered invalid data can be determined through steps C1 to C3.

[0099] Step C1: Match each print instruction with the filtering rule to obtain a first matching result.

[0100] Specifically, the filtering rule determines whether the printing instruction satisfies the filtering rule by judging the characteristic symbols in the printing instruction. Specifically, for each printing instruction, the characteristic symbols in the printing instruction are identified. If the identified characteristic symbols are the same as the characteristic symbols in the filtering rule, it means that the printing instruction satisfies the filtering rule, and the first matching result is successful. If the identified characteristic symbols are different from the characteristic symbols in the filtering rule, or the characteristic symbols cannot be identified, it means that the printing instruction does not satisfy the filtering rule, and the first matching result is failed.

[0101] Furthermore, the filtering rules include multiple filtering conditions; for each printing instruction, matching is performed with the filtering rules to obtain a first matching result, including: for each printing instruction, determining the second matching results corresponding to the printing instruction and each of the filtering conditions in sequence according to the preset order of the filtering conditions; wherein the number of the second matching results is multiple; when any of the second matching results is a successful match, the first matching result is determined to be a successful match; when all of the second matching results are failed matches, the first matching result is determined to be a failed match.

[0102] Specifically, the regular rule includes multiple filtering conditions, and each filtering condition requires the identification of different characteristic symbols for matching. For each printing instruction, it is matched with each filtering condition in turn. If the identified characteristic symbol is the same as the characteristic symbol in the filtering condition, it means that the printing instruction meets the filtering condition, and the second matching result is a successful match. If the identified characteristic symbol is different from the filtering condition in the filtering rule, or the characteristic symbol cannot be identified, it means that the printing instruction does not meet the filtering condition, and the second matching result is a failed match. If there is a successful second matching result, the first matching result is determined to be a successful match. If there is no successful second matching result, that is, all the second matching results are failed matches, and the first matching result is determined to be a failed match.

[0103] In another embodiment, for each print instruction, second matching results corresponding to the print instruction and each of the filter conditions are sequentially determined according to the preset order of the filter conditions; if the second matching result is a successful match, the first matching result is determined to be a successful match, and step C2 is executed. If the second matching result is a failed match, second matching results corresponding to the print instruction and each of the filter conditions are continuously determined according to the preset order of the filter conditions until all of the filter conditions have been traversed and the first matching result is determined to be a failed match.

[0104] For example, the filtering conditions may include the following conditions:

[0105] (1) Identical data judgment: If multiple identical print commands are received consecutively, they are usually considered invalid data, and the second matching result is considered a successful match. For example, in a normal receipt printing process, it is unlikely that multiple identical data will appear consecutively. This is likely due to data transmission errors or other anomalies.

[0106] (2) Multiple Characteristic Symbols OR Match Judgment: When a print instruction contains any one of multiple known non-printing characteristic symbols, it is judged as suspected non-printing data, and the second matching result is a successful match. For example, certain control characters or special symbol combinations, such as the FileSystemFree character (hexadecimal representation: 46 69 6C 65 53 79 7374 65 6D46 72 65 65) or specific character string sequences, rarely appear in normal print data but may exist in invalid data.

[0107] (3) AND match judgment for multiple characteristic symbols: Only when the printing instruction contains multiple specific non-printing characteristic symbols at the same time, it is judged as suspected non-printing data and the second match result is considered a successful match. This rule is more stringent than the OR match judgment and is applicable to situations where multiple characteristics must appear together to determine that the data is invalid.

[0108] (4) Single Characteristic Symbol Matching: If a specific non-printing characteristic symbol appears in the print instruction, it is judged as suspected non-printing data, and the second matching result is a successful match. This is a relatively simple judgment method and is suitable for invalid data with obvious characteristics.

[0109] (5) Precise and complete matching of characteristic symbols: The characteristic symbols in the printing instruction must be completely consistent with the preset non-printing characteristic symbols in terms of position and content. Only then will it be judged as suspected non-printing data, and the second matching result is considered a successful match. This matching method has high accuracy but may require more computing resources.

[0110] (6) Fuzzy matching of characteristic symbols: The characteristic symbols in the printing instruction are allowed to be similar to the preset non-printing characteristic symbols to a certain extent, rather than being completely identical, and the second matching result is considered a successful match. For example, considering the similarity of characters and the inclusion relationship of character strings, this matching method can improve the recognition ability of some variant invalid data.

[0111] (7) Specific data format determination: For some invalid data with specific formats, such as HTTP protocol format, JSON format, electronic scale base64 data, PJL format, etc., if the printing instruction conforms to the specifications of these formats, it is judged as non-printing data, and the second matching result is a successful match. For example, check whether the data begins with the HTTP protocol request header or whether it conforms to the key-value pair structure of the JSON format.

[0112] Step C2: if the first matching result is a successful match, delete the print instruction.

[0113] Step C3: When the first matching result is a matching failure, retain the printing instruction as filtered invalid printing data.

[0114] Step S206 , parsing the filtered invalid printing data and the initial valid printing data to obtain printing content, and printing the printing content.

[0115] The printing data processing method provided by the embodiment of the present invention presets multiple printing instruction sets and obtains the corresponding preset instruction features, so that the method has the ability to identify and process various types of instructions. Different printers or printing scenarios may use different instruction sets, and the flexibility and versatility of the solution are reflected, which can adapt to diverse printing needs. The rules based on multiple matching methods and specific data format judgments can be adjusted according to different printing scenarios and needs, and can more accurately identify and eliminate truly invalid data, reducing the occupation of printing resources by invalid data. By further filtering the initial invalid printing data, the invalid data that meets the filtering rules is eliminated, and the filtered invalid printing data is obtained. This can avoid unnecessary parsing and printing operations on these invalid data, reducing the computing resources and time required to process these invalid data.

[0116] Example 3

[0117] Corresponding to the above method embodiment, an embodiment of the present invention provides a print data processing device, Figure 3 A schematic diagram of the structure of a print data processing device provided by an embodiment of the present invention is shown in FIG. Figure 3 As shown, the print data processing device may include:

[0118] The data acquisition module 301 is used to acquire the print data received within a preset time period;

[0119] The marking module 302 is configured to mark the print data according to a preset print instruction set format to obtain marked print data; wherein the marked print data includes initially invalid print data and initially valid print data;

[0120] A filtering module 303 is configured to filter the initial invalid printing data according to a filtering rule, remove the initial invalid printing data that meets the filtering rule, and obtain filtered invalid printing data;

[0121] The printing module 304 is configured to parse the filtered invalid printing data and the initial valid printing data, obtain printing content, and print the printing content.

[0122] The printing data processing method provided by the embodiment of the present invention can centrally process batch data by acquiring printing data within a preset time period, avoiding the tedious process of single data processing and improving the overall processing efficiency. At the same time, the initial invalid printing data is filtered out, which reduces unnecessary printing tasks, saves printing time and resources, and enables the printer to process valid printing data more quickly, thereby improving the printing speed. The initial invalid printing data that meets the filtering rules is eliminated to prevent invalid data from entering the printing process, thereby reducing system errors or failures that may be caused by processing invalid data, enhancing the stability and reliability of the entire printing system, and reducing the risk of system crashes or printing errors. By filtering multiple times, the filtered invalid printing data and the initial valid printing data are parsed before printing, which can rationally utilize the resources of the printer, avoid resource waste, enable the printer to operate more efficiently, extend the service life of the printer, and also reduce energy consumption.

[0123] In some embodiments, the print data includes a plurality of print instructions; the marking module 302 is further configured to:

[0124] Obtaining preset instruction features corresponding to a preset printing instruction set;

[0125] Parsing the print data to obtain target instruction features corresponding to each print instruction in the print data;

[0126] For each printing instruction, the printing instruction is marked according to the matching result between the preset instruction feature and the target instruction feature to obtain marked printing data.

[0127] In some embodiments, there are multiple preset printing instruction sets; marking the printing instructions according to the matching result between the preset instruction features and the target instruction features to obtain marked printing data includes:

[0128] When the target instruction feature successfully matches the preset instruction feature corresponding to any preset printing instruction set, the tag of the printing instruction is determined to be valid, and the printing instruction is determined to be initial valid printing data;

[0129] When the target instruction feature fails to match the preset instruction features corresponding to all preset printing instruction sets, the tag of the printing instruction is determined to be invalid, and the printing instruction is determined to be initial invalid printing data.

[0130] In some embodiments, the initial invalid print data includes at least one print instruction; the filtering module 303 is further configured to:

[0131] For each printing instruction, match it with the filtering rules to obtain a first matching result;

[0132] If the first matching result is a successful match, deleting the print instruction;

[0133] When the first matching result is a matching failure, the printing instruction is retained as filtered invalid printing data.

[0134] In some embodiments, the filtering rule includes multiple filtering conditions; for each printing instruction, matching is performed against the filtering rule to obtain a first matching result, including:

[0135] For each print instruction, determining second matching results corresponding to the print instruction and each of the filter conditions in sequence according to a preset order of the filter conditions; wherein the number of the second matching results is multiple;

[0136] If any of the second matching results is a successful match, determining the first matching result is a successful match;

[0137] When all the second matching results are matching failures, the first matching result is determined to be matching failure.

[0138] In some embodiments, the printing module 304 is further configured to:

[0139] Parsing the filtered invalid printing data and the initial valid printing data according to a preset printing instruction set format to obtain printing content;

[0140] A print image is generated according to the print content and a preset print layout, and the print image is printed.

[0141] In some embodiments, parsing the filtered invalid print data and the initial valid print data according to a preset print instruction set format to obtain print content includes:

[0142] Identifying the printing instructions in the filtered invalid printing data and the initial valid printing data according to a preset printing instruction set format;

[0143] The printing parameters in the printing instruction are determined as printing content.

[0144] The device provided in the embodiment of the present invention has the same implementation principle and technical effects as those in the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference can be made to the corresponding content in the aforementioned method embodiment.

[0145] Example 4

[0146] The embodiment of the present invention further provides an electronic device for executing the above-mentioned printing data processing method; Figure 4The structure diagram of an electronic device shown in FIG. 4 includes a memory 400 and a processor 401 , wherein the memory 400 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor 401 to implement the above-mentioned print data processing method.

[0147] Furthermore, Figure 4 The electronic device shown further includes a bus 402 and a communication interface 403 , and the processor 401 , the communication interface 403 and the memory 400 are connected via the bus 402 .

[0148] The memory 400 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is achieved through at least one communication interface 403 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 402 may be an ISA bus, a PCI bus, or an EISA bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0149] The processor 401 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in the processor 401 or by software instructions. The above processor 401 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly implemented as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in memory 400, and processor 401 reads the information in memory 400 and, in conjunction with its hardware, completes the steps of the method of the aforementioned embodiment.

[0150] An embodiment of the present invention also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned printing data processing method. The specific implementation can be found in the method embodiment and will not be repeated here.

[0151] The computer program product for performing a print data processing method provided in an embodiment of the present invention includes a computer-readable storage medium storing a non-volatile program code executable by a processor. The instructions included in the program code can be used to execute the method described in the previous method embodiment. For specific implementation, please refer to the method embodiment and will not be repeated here.

[0152] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0153] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. There may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some communication interface, indirect coupling or communication connection of devices or units, which may be electrical, mechanical or other forms.

[0154] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0155] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0156] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0157] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the above-described embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above-described embodiments within the technical scope disclosed by the present invention, or replace some of the technical features therein with equivalents. Such modifications, changes, or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A printing data processing method, characterized in that: include: Obtaining print data received within a preset time period; Marking the print data according to a preset print instruction set format to obtain marked print data; wherein the marked print data includes initial invalid print data and initial valid print data; filtering the initial invalid printing data according to the filtering rules, eliminating the initial invalid printing data that meets the filtering rules, and obtaining filtered invalid printing data; The filtered invalid printing data and the initial valid printing data are parsed to obtain printing content, and the printing content is printed.

2. The method according to claim 1, characterized in that The print data includes a plurality of print instructions; the printing data is marked according to a preset print instruction set format to obtain marked print data, including: Obtaining preset instruction features corresponding to a preset printing instruction set; Parsing the print data to obtain target instruction features corresponding to each print instruction in the print data; For each printing instruction, the printing instruction is marked according to the matching result between the preset instruction feature and the target instruction feature to obtain marked printing data.

3. The method according to claim 2, characterized in that The number of the preset printing instruction sets is multiple; the printing instructions are marked according to the matching result of the preset instruction features and the target instruction features to obtain marked printing data, including: When the target instruction feature successfully matches the preset instruction feature corresponding to any preset printing instruction set, the tag of the printing instruction is determined to be valid, and the printing instruction is determined as initial valid printing data; When the target instruction feature fails to match the preset instruction features corresponding to all preset printing instruction sets, the tag of the printing instruction is determined to be invalid, and the printing instruction is determined to be initial invalid printing data.

4. The method according to claim 2, characterized in that The initial invalid printing data includes at least one printing instruction; the filtering of the initial invalid printing data according to the filtering rules, eliminating the initial invalid printing data that meets the filtering rules, and obtaining the filtered invalid printing data, including: For each printing instruction, match it with the filtering rules to obtain a first matching result; If the first matching result is a successful match, deleting the print instruction; When the first matching result is a matching failure, the printing instruction is retained as filtered invalid printing data.

5. The method according to claim 4, characterized in that The filtering rules include multiple filtering conditions; for each printing instruction, matching is performed with the filtering rules to obtain a first matching result, including: For each print instruction, determining second matching results corresponding to the print instruction and each of the filter conditions in sequence according to a preset order of the filter conditions; wherein the number of the second matching results is multiple; If any of the second matching results is a successful match, determining the first matching result is a successful match; When all the second matching results are matching failures, the first matching result is determined to be matching failure.

6. The method according to claim 1, characterized in that The step of parsing the filtered invalid print data and the initial valid print data, obtaining print content, and printing the print content includes: Parsing the filtered invalid printing data and the initial valid printing data according to a preset printing instruction set format to obtain printing content; A print image is generated according to the print content and a preset print layout, and the print image is printed.

7. The method according to claim 6, characterized in that The step of parsing the filtered invalid print data and the initial valid print data according to a preset print instruction set format to obtain print content includes: Identifying the printing instructions in the filtered invalid printing data and the initial valid printing data according to a preset printing instruction set format; The printing parameters in the printing instruction are determined as printing content.

8. A printing data processing device, characterized in that: include: A data acquisition module, used to acquire print data received within a preset time period; a marking module, configured to mark the print data according to a preset print instruction set format to obtain marked print data; wherein the marked print data includes initially invalid print data and initially valid print data; A filtering module, configured to filter the initial invalid printing data according to a filtering rule, remove the initial invalid printing data that meets the filtering rule, and obtain filtered invalid printing data; The printing module is used to parse the filtered invalid printing data and the initial valid printing data, obtain printing content, and print the printing content.

9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the print data processing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the print data processing method according to any one of claims 1 to 7.