Printing control method and device and electronic equipment

By using a layered software architecture to transform standard ESC/POS commands into internal system interface calls, the problem of high adaptation costs for different printers is solved, achieving consistent printing and high scalability, making it suitable for embedded devices such as POS terminals and cash registers.

CN121541840APending Publication Date: 2026-02-17FUJIAN LANDI COMMERCIAL EQUIPMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511540880.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-27
Publication Date
2026-02-17

AI Technical Summary

Technical Problem

In existing technologies, two sets of ESC/POS instruction adapters need to be developed separately for different types of printers, resulting in high software development costs, low application efficiency, and an inability to provide a consistent user experience and poor scalability.

Method used

A layered software architecture is adopted, including a parsing layer, a print driver client, a print driver server, and a driver implementation layer. The parsing layer converts standard ESC/POS commands into internal system interface call commands, and the print driver client and server generate driver operation commands adapted to different printers to ensure consistent printing behavior.

Benefits of technology

It achieves consistent printing behavior across different printers, reduces software development costs, improves application efficiency, and supports rapid expansion to new printer models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121541840A_ABST
    Figure CN121541840A_ABST
Patent Text Reader

Abstract

The invention provides a printing control method and device, electronic equipment and a printing control system applied to the electronic equipment, the system comprises an analysis layer, a printing driving client side, a printing driving server side and a driving implementation layer, the method comprises the steps that a printing instruction is obtained, and the printing instruction comprises a standard instruction sequence; calling an analysis layer to analyze the printing instruction to obtain an interface calling instruction; calling a printing control interface corresponding to the printing driving client based on the interface calling instruction; acquiring a driving operation instruction corresponding to the printing control interface from a printing driving server; and calling the drive implementation layer to execute the drive operation instruction to complete printing. After decoupling between the printing instruction and hardware is achieved, the printing driving server side obtains the driving operation instruction corresponding to the printing control interface, the driving operation instruction corresponding to the printer can be generated, the driving operation instruction is executed through the driving implementation layer to complete printing, automatic adaptation to different hardware printers at the bottom layer is achieved, and the printing efficiency is improved. And the printing behavior consistency is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of printing control, and more particularly to a printing control method, apparatus, and electronic device. Background Technology

[0002] In related technologies, cash registers and POS machines have different structures, so the printer structures they are compatible with also differ. For example, the blade positions are different in printers with different structures.

[0003] Therefore, for different types of printers, it is usually necessary to develop two separate sets of ESC / POS command adapters to adapt to different application scenarios, resulting in high software development costs and low application efficiency. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to provide a printing control method, device and electronic device that adapts to different printers based on a set of ESC / POS instructions to complete the printing operation.

[0005] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: A printing control method is applied to a printing control system for an electronic device. The system includes a parsing layer, a printing driver client, a printing driver server, and a driver implementation layer. The method includes: Obtain printing instructions, which include a standard sequence of instructions; The parsing layer is invoked to parse the print instruction, thereby obtaining the interface call instruction; Based on the interface call instruction, the print control interface corresponding to the print driver client is called; Obtain the driver operation instructions corresponding to the print control interface from the print driver server; The driver implementation layer is invoked to execute the driver operation instructions and complete the printing.

[0006] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is as follows: A printing control device is connected to at least one printer. The printing control device includes: a first acquisition module for acquiring printing instructions, the printing instructions including a standard instruction sequence; a first invocation module for invoking a parsing layer to parse the printing instructions and obtain an interface invocation instruction; a second invocation module for invoking a printing control interface corresponding to a printing driver client based on the interface invocation instruction; a second acquisition module for acquiring a driver operation instruction corresponding to the printing control interface from a printing driver server; and an execution module for invoking a driver implementation layer to execute the driver operation instruction and complete printing.

[0007] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is as follows: An electronic device includes a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement a printing control method as described above.

[0008] The beneficial effects of this invention are as follows: By setting up a print control system in the electronic device consisting of a parsing layer, a print driver client, a print driver server, and a driver implementation layer, after obtaining standard print commands, the parsing layer converts the hardware operations indicated by the original print commands into calls to the internal system interfaces, thus decoupling the print commands from the hardware. Then, by calling the print control interface of the print driver client, the print driver server obtains the driver operation commands corresponding to the print control interface, generating driver operation commands corresponding to the printer. Finally, the driver implementation layer executes the driver operation commands to complete the printing, thereby automatically adapting to different underlying hardware printers and ensuring consistent printing behavior. Therefore, using the solution of this application, a set of ESC / POS commands can be developed to adapt to different printers and different application scenarios, effectively reducing software development costs and improving application efficiency and applicability. Attached Figure Description

[0009] Figure 1 This is a flowchart illustrating the steps of a printing control method according to an embodiment of the present invention; Figure 2 This is a framework diagram of a printing control method according to an embodiment of the present invention; Figure 3 This is a flowchart of another step in a printing control method according to an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of a printing control device according to an embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0010] To make the technical problems, technical solutions, and beneficial effects to be solved by this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and are not intended to limit the scope of this application.

[0011] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0012] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0013] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0014] In related technologies, different types of printers have different hardware structures, thus requiring different instruction sequences to be written for different printer models. Taking embedded printers as an example, due to differences in device structure, the printer structures adapted to different devices also differ. For instance, cash registers and POS machines require different printer structures due to their structural differences. Adaptation solutions for the heterogeneity of embedded printers mainly suffer from the following technical drawbacks: 1. High Development and Maintenance Costs: In related technologies, the processing logic for hardware differences is typically delegated to upper-layer application developers. Developers must write different instruction sequences for different printer models. For example, a GSV m instruction is sent for models with a cutter, while an ESC J n instruction is calculated and sent for models without a cutter. This results in a large number of conditional branches and hardware-specific code in the application code, significantly increasing the complexity and cost of development, debugging, testing, and maintenance, and making the code difficult to reuse.

[0015] 2. Inconsistent Behavior and Fragmented User Experience: Due to the lack of a unified adaptation layer, the same ESC / POS command (Escapea Point of Sale, a standard protocol for controlling printers, defining a series of control commands) will produce different physical behaviors on different hardware. For example, the physical distance of paper feeding for the ESC J n command will vary depending on the printer's default resolution (DPI); the GS V m command cannot be executed on bladeless printers, resulting in inconsistent paper placement. This makes it impossible for the same application software to provide a consistent user experience across different terminals, undermining the software's versatility and professionalism.

[0016] 3. Poor scalability and inability to cope with rapid iteration: Existing middleware solutions are mostly simple instruction forwarding solutions, failing to fundamentally shield hardware differences. When support for a new printer model needs to be added, a full-stack modification from application to driver is often required, resulting in severe coupling between system layers and extremely poor scalability. This cannot adapt to the rapid iteration of hardware products and the diverse market demands.

[0017] 4. Failure to fully utilize hardware characteristics: Traditional solutions are passive adaptations that fail to proactively and intelligently provide the optimal solution based on hardware capabilities. For example, they cannot automatically calculate more accurate paper feed dots for high-DPI printers, nor can they intelligently convert cutter commands into equivalent paper feed commands.

[0018] To address the aforementioned issues, this application provides a printing control method, apparatus, and electronic device. It should be noted that the electronic device in this application can be an embedded device such as a POS terminal, cash register, or portable printer. Through a layered software architecture, it achieves unified adaptation to printers with different hardware characteristics, shields underlying hardware differences, provides consistent standard ESC / POS command support to upper-layer applications, and automatically adapts to different underlying hardware printers, ensuring consistent printing behavior.

[0019] Please refer to Figure 1 The printing control method of this application is described in detail below. This method is applied to the printing control system of electronic devices. Please refer to... Figure 2 The system includes a parsing layer, a print driver client, a print driver server, and a driver implementation layer. The method includes steps S110-S150.

[0020] S1. Obtain the print command. The print command includes a standard command sequence. The standard command sequence refers to the ESC / POS command sequence.

[0021] S2. Call the parsing layer to parse the print instruction to obtain an interface call instruction. That is, the parsing layer is mainly responsible for receiving and parsing the standard ESC / POS instruction sequence; the parsing layer does not directly operate the hardware, but parses the ESC / POS instruction into a semantic and abstract internal driver print interface call instruction.

[0022] S3. Based on the interface call instruction, call the corresponding print control interface of the print driver client. That is, the interfaces declared by the print driver client include all possible print operations of the subsequent layer, such as the paper feed interface: EA_ucFeedPrinter, and the dot matrix image print interface: EA_ucDotMatrixPrinter; but it does not contain any specific implementation. This interface is the bridge connecting the parsing layer and the driver implementation layer.

[0023] S4. Obtain the driver operation instruction corresponding to the print control interface from the print driver server. That is, the print driver server is mainly responsible for parsing the input data and configuration (i.e., the data parsed by the instruction parsing layer), where the data includes the data to be printed, such as the text line data "abc123 Chinese", and the configuration is the print configuration, including line spacing, etc., which is converted into data that can be processed by the underlying hardware. For example, after obtaining the input text line data and configuring it for 2x2 magnification printing, the driver server is responsible for parsing the text into a dot matrix, magnifying it, and then delivering it to the next layer for processing.

[0024] S5. Call the driver implementation layer to execute the driver operation instruction to complete printing. That is, the driver implementation layer is responsible for receiving the data processed by the print driver server and completing the specific printer hardware driver operation; for example, completing the printing after magnifying the input text line data by 2x2.

[0025] As can be seen from the above embodiments, by setting up a print control system consisting of a parsing layer, a print driver client, a print driver server, and a driver implementation layer in an electronic device, after obtaining the standard print instruction, the hardware operation indicated by the original print instruction is converted into an internal interface call instruction of the system through the parsing layer, achieving decoupling between the print instruction and the hardware. Then, after calling the print control interface of the print driver client, the print driver server obtains the driver operation instruction corresponding to the print control interface, that is, it can generate a driver operation instruction corresponding to the printer, and finally, the driver implementation layer executes the driver operation instruction to complete printing, thereby achieving automatic adaptation to different underlying hardware printers and ensuring the consistency of printing behavior. Therefore, using the solution of this application, a set of ESC / POS instructions can be developed to adapt to different printers to adapt to different application scenarios, which can effectively reduce the software development cost and improve the efficiency and applicable scenarios of the application.

[0026] In an embodiment of this application, S2. Calling the parsing layer to parse the print instruction includes: S21. Parse the print command to obtain at least one target operation; the target operation includes at least one of printing, paper feeding, cutting, setting parameters, and obtaining parameters. For example, if the received ESC / POS command sequence is: ESC dn, the meaning of the command is: feed n lines of paper.

[0027] S22. Obtain the corresponding interface call instruction based on the target operation. Based on the target operation: feed n lines of paper, convert it into an instruction to call the interface: EA_ucFeedPrinter(printer_handle, EM_prn_FEEDLINE, n). The specific operation of this interface is to feed paper in units of text lines, i.e., feed n lines of paper. If the received ESC / POS instruction sequence is for dot matrix image printing, then call the interface EA_ucDotMatrixPrinter (for dot matrix image printing).

[0028] As can be seen from the above embodiments, after the target operations such as printing and paper feeding are obtained by parsing the printing instructions through the parsing layer, the target operations are converted into instructions to call the printing interface and the paper feeding interface, thus achieving complete decoupling between the instruction sequence and hardware operations, eliminating the need to concern oneself with hardware differences. This complete decoupling of the instruction sequence and hardware operations at the front end of the system software architecture allows the front end to input standardized printing instructions without the need for repetitive code development, solving the technical problem of high development and maintenance costs in the past.

[0029] In one embodiment of this application, it further includes: Obtain the print configurations for different printers; set the print configurations in the differentiated processing branch for generating driver operation instructions on the print driver server. For example, if there are five types of printers, generate the corresponding print configurations for each of the five printer types and process them in different differentiated branches.

[0030] Taking the EA_ucFeedCutPrinter interface as an example, printers with a paper cutter feed the printed content to the paper cutter head (paper feed distance n1) and then cut it. Printers without a paper cutter feed the printed content to the tear-off area (paper feed distance n2) without cutting. Similarly, after thermal printing, the paper remains at the heating head. The distance between the heating head and the paper cutter / tear-off area varies between different devices, meaning the paper feed distance could be n1 or n2. These paper feed distances n1 and n2 are determined by the inherent differences in the printer's hardware structure. Therefore, different processing methods are needed for these different branches.

[0031] As can be seen from the above embodiments, different types of printers typically produce application interfaces with different behaviors. Therefore, by pre-setting the configurations of different printers and setting them for processing in different differentiated processing branches, it is possible to achieve that when a unified ESC / POS command sequence is input, the print driver server can process it in the corresponding differentiated branch and output commands adapted to the current printer. Taking the paper feed command as an example, by adaptively adjusting the paper feed distance to n1 and n2, it is ensured that the physical position of the paper is roughly the same after the "paper cutting" operation is completed in both bladeless and bladed models. This enables the adaptive provision of commands that match the hardware capabilities, and can intelligently convert blade cutting commands into equivalent paper feed commands, fundamentally solving the behavioral differences caused by hardware heterogeneity and the existing technical problems of not fully utilizing hardware characteristics.

[0032] In one embodiment of this application, it further includes: The system retrieves the target printing configuration corresponding to the target printer connected to the electronic device; the print driver server retrieves the driver operation instructions corresponding to the print control interface and the target printing configuration. Taking an electronic device with an embedded printer as an example, since the printer is embedded within the electronic device, the electronic device typically only connects to one embedded printer; after obtaining the configuration of the embedded printer, it will obtain the differentiated branch that matches the embedded printer, thereby obtaining the driver operation instructions that match the embedded printer.

[0033] As can be seen from the above embodiments, compared with the prior art which requires the development of different software programs according to different printer needs, the method based on this embodiment can be applied to electronic devices with different types of embedded printers with a single software program. That is, ESC instruction developers only need to face a unified application programming interface (API) and consistent behavior, without having to write, test and maintain different code branches for each printer model, thus solving the technical problem of high development and maintenance costs.

[0034] In one embodiment of this application, it further includes: If the print control interface being called is a hardware operation, then the standard hardware operation parameters are obtained, as well as the target hardware operation parameters are obtained according to the print configuration; the operation mode corresponding to the target printer is obtained based on the ratio of the standard hardware operation parameters to the target hardware operation parameters.

[0035] The printer driver server sends driver operation instructions to the driver implementation layer. These instructions abstract all basic printer operations, such as printing, paper feeding, cutting, and device property settings / retrieval, and mainly include the following parameters: Table 1. Basic Printer Commands

[0036] The driver implementation layer needs to shield the main differences between different printer cartridges in terms of resolution, motor drive, heating control, and cutter.

[0037] (1) Taking the paper feed instruction as an example: When the paper feed instruction is received and the paper feed length is n pixels, the motor step length of different printer modules is different. For example, the step step of module A is 0.125mm, while the step step of module B is 0.0625mm. When the upper layer is controlled, it is generally controlled at 203 DPI, that is, 0.125mm / unit. Therefore, on module A, the instruction needs to be executed to control the motor to move n steps, while on module B, the instruction needs to be executed to control the motor to move 2n steps.

[0038] (2) Taking printing instructions as an example: thermal printing imaging requires controlling the heating of the heating chip head of the machine mechanism, and the control methods are also different, including: based on GPIO control and based on PWM control; therefore, different control methods are required for different machine mechanisms.

[0039] (3) Taking the cutting knife command as an example: some products are controlled by the control line that has been integrated by the mechanism manufacturer, while other products require the operation of the cutting knife motor control line.

[0040] As can be seen from the above embodiments, when a hardware operation instruction is obtained, the current printer configuration and standard hardware operation parameters are obtained, and the hardware operation is converted into an operation mode that matches the current printer device. This allows the driver implementation layer to shield the hardware differences of different printers, ensuring that the generated operation mode can be adapted to different printers. This enables functions such as automatically calculating more accurate paper feed dots for high-DPI printers, thus solving the existing technical problem of not fully utilizing hardware characteristics.

[0041] In one embodiment of this application, the method further includes: if the target hardware operation parameters are not obtained, then no driver operation instruction is generated. For example, if the printer is a bladeless device, then when EA_ucFeedCutPrinter is executed, no blade cutting operation is performed.

[0042] As can be seen from the above embodiments, by determining whether the printer device has the corresponding hardware configuration when a hardware operation instruction is obtained, and not performing the operation on the hardware configuration when the printer device does not have the corresponding hardware configuration, the problem of the instruction failing to execute due to the mismatch between the instruction and the hardware configuration is avoided.

[0043] In one embodiment of this application, it further includes: Obtain the print configurations for at least two target printers. In each differentiation processing branch, obtain the driver operation instructions corresponding to the target printer based on the print configuration, and send the driver operation instructions to the target printer. For example, if an electronic device is connected to multiple printers of different types, and the same document needs to be printed in different ways, the instructions are sent to different differentiation processing branches for processing, and the printing operation is completed in different printers.

[0044] As can be seen from the above embodiments, by simultaneously connecting an electronic device to multiple different types of printers and processing them through different differentiated processing branches, the same content can be printed on different printers. Taking the standard cutter command as an example, the upper-layer application and the command parsing layer only need to send the standard GS V m command without any modification, and a consistent user experience of "the printed paper is properly handled" can be obtained on two very different printers.

[0045] In one embodiment of this application, the method further includes: generating a new printing configuration based on the model of the newly added printer; adding a differentiation processing branch in the print driver server, and setting the new printing configuration in the newly added differentiation processing branch. That is, when a new printer is developed and it is necessary to enable electronic devices to support the new printer, it is only necessary to: a) add a differentiation processing branch in the print driver server; b) provide the underlying driver for the new printer model in the driver implementation layer.

[0046] As can be seen from the above embodiments, when it is necessary to enable electronic devices to support new printers, the adaptation of electronic devices to new printers can be achieved by adding a differentiated processing branch in the print driver server and providing the underlying driver of the printer model in the driver implementation layer. The ESC / POS instruction parsing layer, print driver client and existing application code do not need any modification, which makes the system highly scalable, can meet the needs of adding new printer devices, and solve the existing technical problem of poor scalability.

[0047] That is, the above method can achieve the following: 1. Reduced development and maintenance costs: ESC instruction developers only need to deal with a unified API and consistent behavior, eliminating the need to write, test, and maintain different code branches for each device model. This solves the problem of high development and maintenance costs.

[0048] 2. Completely transparent to the application layer: The upper-layer application and command parsing layer only need to send standard GS V m commands without any modification, achieving a consistent user experience of "properly handled paper after printing" on two very different printers. This solves the existing problem of inconsistent behavior and fragmented user experience.

[0049] 3. Extremely high scalability: To support a new printer in the future, simply: a) (if needed) add a differentiated processing branch to the print service; b) provide the underlying driver for that model at the driver implementation layer. The ESC / POS command parsing layer, print driver client, and existing application code require no modifications. This solves the problem of poor scalability of existing printer devices.

[0050] 4. Adaptive Behavior: By adaptively adjusting the paper feed distance n2, it ensures that the physical position of the paper is approximately the same after the "paper cutting" operation is completed in both bladeless and bladed models, fundamentally solving the behavioral differences caused by hardware heterogeneity. It also resolves the existing problem of not being able to adjust instructions based on hardware capabilities.

[0051] This embodiment provides a specific application scenario, as follows: Please refer to Figure 3 Assume there are N ECS commands, numbered ECS_1 to ESC_N. In the first three steps, the commands are identical, for example, all are ECS_1. Upon reaching the print driver server, the server performs differentiated processing based on the specific device. For example, driver implementation layer 1 may have a cutter, while driver implementation layer 2 may not. The differentiated processing branch within the print driver server can handle these differences, allowing subsequent actions to be directly performed by the driver implementation layer. For instance, in driver implementation layer 1, the step distance is directly converted into the number of steps a certain motor in a cutter-equipped POS machine takes in a specific direction. In driver implementation layer 2, it's the number of steps a certain motor in a cutter-less POS machine takes.

[0052] To further illustrate the technical means and effects adopted in this embodiment to achieve the intended purpose of the invention, the specific implementation of the solution proposed according to the present invention will be described below with reference to a specific embodiment. Please refer to... Figure 2 Taking receiving the cutting command (GS V m) in standby mode as an example, the details are as follows: (1) Parsing layer - instruction parsing and abstraction: After the application layer or third-party library sends the standard ESC / POS cutter command GS V m, the parsing layer captures and parses the command, identifying it as a "full paper cut" operation. The parsing layer does not directly manipulate the hardware; instead, it calls the unified interface EA_ucFeedCutPrinter(printer_handle, EM_prn_CUT_FULL) provided by the print driver client. At this point, the decoupling from the specific ESC / POS command is complete. That is, S1-S2 are executed.

[0053] (2) Print driver client - unified interface call: The print driver client's interface EA_ucFeedCutPrinter passes the call request to the print driver server. That is, S3 is executed.

[0054] (3) Print driver server - intelligent difference processing: During the print driver server initialization phase, it communicates with the driver implementation layer to obtain the current product model and caches this value. When EA_ucFeedCutPrinter is executed, differentiated processing is performed for heterogeneous products: If the product has a cutter: feed the paper to pixel n1 at the cutter edge and perform the cut; If the product has no cutter: when the paper feed n2 pixels reach the tear edge, the cutter will not be executed.

[0055] That is, execute S4. This converts the unified paper cutting command into two distinct command streams: paper feed n1 + cutter or paper feed n2.

[0056] (4) Print driver implementation layer - hardware instruction execution: The print driver implementation layer is responsible for translating paper feed / cutter commands into the lowest-level I / O operations that control the motor and cutter, ultimately completing the physical action. That is, executing S5.

[0057] Please refer to Figure 4 Another embodiment of the present invention provides a printing control device, which is connected to at least one printer and performs a printing control method as described above.

[0058] The printing control device includes: a first acquisition module for acquiring printing instructions, the printing instructions including a standard instruction sequence; a first invocation module for invoking the parsing layer to parse the printing instructions and obtain an interface invocation instruction; a second invocation module for invoking the printing control interface corresponding to the printing driver client based on the interface invocation instruction; a second acquisition module for acquiring driver operation instructions corresponding to the printing control interface from the printing driver server; and an execution module for invoking the driver implementation layer to execute the driver operation instructions and complete printing.

[0059] Please refer to Figure 5Another embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements a printing control method as described above. In this embodiment, the electronic device can be an embedded device such as a POS terminal, cash register, or portable printer. Through a layered software architecture, it achieves unified adaptation to printers with different hardware characteristics, shields the differences in underlying hardware, provides consistent standard ESC / POS command support to upper-layer applications, and automatically adapts to different underlying hardware printers, ensuring consistent printing behavior.

[0060] In summary, this invention provides a printing control method, apparatus, and electronic device. By setting up a printing control system in the electronic device, consisting of a parsing layer, a print driver client, a print driver server, and a driver implementation layer, it achieves the following: after obtaining a standard print command, the parsing layer converts the hardware operation indicated by the original print command into an instruction to call the internal interface of the system, thus decoupling the print command from the hardware. Then, after calling the print control interface of the print driver client, the print driver server obtains the driver operation instruction corresponding to the print control interface. For example, it can dynamically convert a unified abstract interface call into a specific low-level instruction sequence most suitable for the current hardware based on the current printer's hardware capabilities (such as whether there is a cutter, resolution), and finally execute the driver operation instruction through the driver implementation layer to complete the printing. This achieves automatic adaptation to different underlying hardware printers and ensures consistent printing behavior.

[0061] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A print control method characterized by, A printing control system applied to an electronic device, the system comprising a parsing layer, a print driver client, a print driver server and a driver implementation layer, the method comprising: obtaining a print instruction, the print instruction comprising a standard instruction sequence; calling the parsing layer to parse the print instruction to obtain an interface call instruction; based on the interface call instruction, calling a print control interface corresponding to the print driver client; obtaining a driver operation instruction corresponding to the print control interface from the print driver server; calling the driver implementation layer to execute the driver operation instruction to complete printing.

2. The print control method according to claim 1, characterized by, The calling of the parsing layer to parse the print instruction comprises: parsing the print instruction to obtain at least one target operation; the target operation comprises at least one of printing, paper feeding, a cutter, setting parameters and obtaining parameters; obtaining a corresponding interface call instruction according to the target operation.

3. The print control method according to claim 1, wherein Further comprising: obtaining a print configuration of different printers; setting the print configuration in a differentiated processing branch of the print driver server for generating the driver operation instruction.

4. The print control method according to claim 3, wherein Further comprising: obtaining a target print configuration corresponding to a target printer connected to the electronic device; the print driver server obtaining the driver operation instruction corresponding to the print control interface and the target print configuration.

5. The print control method according to claim 4, wherein Further comprising: if the called print control interface is a hardware operation, obtaining a standard hardware operation parameter and a target hardware operation parameter according to the print configuration; obtaining an operation mode corresponding to the target printer according to the ratio of the standard hardware operation parameter and the target hardware operation parameter.

6. A print control method according to claim 5, wherein Further comprising: if the target hardware operation parameter is not obtained, the driver operation instruction is not generated.

7. The print control method according to claim 4, characterized by, Further comprising: obtaining the print configuration corresponding to at least two target printers respectively; in each of the differentiated processing branches, obtaining the driver operation instruction corresponding to the target printer according to the print configuration, and issuing the driver operation instruction to the target printer.

8. The print control method according to claim 3, wherein Further comprising: generating a new print configuration according to the model of a new printer; adding a differentiated processing branch in the print driver server, and setting the new print configuration in the added differentiated processing branch.

9. A print control device, characterized by, The printing control device is connected with at least one printer, and the printing control device comprises: a first obtaining module for obtaining a print instruction, the print instruction comprising a standard instruction sequence; a first calling module for calling the parsing layer to parse the print instruction to obtain an interface call instruction; a second calling module for calling a print control interface corresponding to the print driver client based on the interface call instruction; a second obtaining module for obtaining a driver operation instruction corresponding to the print control interface from the print driver server; an execution module for calling the driver implementation layer to execute the driver operation instruction to complete printing.

10. An electronic device comprising a memory, a processor, and a computer program stored on the memory and running on the processor, characterized in that, The processor executes the computer program to implement the printing control method according to any one of claims 1-8.