Offline printing method and apparatus, storage medium, and electronic device

By pre-sending the print mode to the terminal device and triggering the command using physical buttons to obtain the print template, the problem of insufficient autonomous operation capability of the printer in the absence of a terminal device is solved, realizing convenient offline printing operation.

WO2026237551A1PCT designated stage Publication Date: 2026-11-19WUHAN JINGCHEN INTELLIGENT IDENTIFICATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2026/085590
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2025-05-16
Filing Date
2026-03-24
Publication Date
2026-11-19

AI Technical Summary

Technical Problem

Existing printers cannot operate autonomously without the intervention of terminal devices, resulting in complex and inefficient operation, making it difficult for users to perform printing operations conveniently.

Method used

The terminal device sends the print mode in advance, and after disconnecting from the printer, it uses a physical button to trigger a command to retrieve the preset print template from the storage module for printing, thus achieving offline printing.

Benefits of technology

It improves the convenience and independent operation capability of printing equipment, simplifies user operation, and avoids the inefficiency caused by dependence on terminal device connections.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2026085590_19112026_PF_FP_ABST
    Figure CN2026085590_19112026_PF_FP_ABST
Patent Text Reader

Abstract

An offline printing method and apparatus, a storage medium, and an electronic device, which are applied to the technical field of printers. The method comprises: acquiring a preset printing mode sent in advance by an application program of a terminal device; when a preset communication connection with the terminal device is disconnected, acquiring a trigger instruction for a physical button of a printing device; and on the basis of the trigger instruction, acquiring, from a storage module, a printing template corresponding to the preset printing mode, and performing a printing operation.
Need to check novelty before this filing date? Find Prior Art

Description

An offline printing method, apparatus, storage medium, and electronic device

[0001] Related applications

[0002] This application claims priority to Chinese Patent Application No. 2025106356785, filed on May 16, 2025, entitled "An Offline Printing Method, Apparatus, Storage Medium and Electronic Device", the entire contents of which are incorporated herein by reference. Technical Field

[0003] This application relates to the field of printer technology, and more specifically, to an offline printing method, apparatus, storage medium, and electronic device in the field of printer technology. Background Technology

[0004] To facilitate users' daily lives, current printing devices can continuously print on paper. For example, when the paper is label paper, the printing device can continuously print labels to generate the labels needed by the user in batches. In existing technology, to facilitate setting the printing content, users can set the printing content on their terminal device and then connect the terminal device to the printer so that the printer can obtain the printing content from the terminal device. However, in existing technology, the printer is overly dependent on the terminal device, which limits the printer's ability to work autonomously without the intervention of the terminal device. When the terminal device is continuously connected to the printer, it not only restricts the user's normal work but also reduces the printer's work efficiency. Therefore, there is a need to provide a method to improve the ease of use of printers. Summary of the Invention

[0005] This application provides an offline printing method, apparatus, storage medium, and electronic device. The method can send a printing mode in advance through a terminal device, and print according to a pre-stored template by simply clicking a physical button without establishing a connection, thereby improving the convenience of the printing device.

[0006] In a first aspect, embodiments of this application provide an offline printing method, the method comprising:

[0007] Obtain the preset printing pattern sent in advance by the terminal device application;

[0008] When the preset communication connection with the terminal device is disconnected, a trigger command for the physical button of the printing device is obtained;

[0009] Based on the trigger command, the print template corresponding to the preset print mode is retrieved from the storage module and the print operation is performed.

[0010] Secondly, embodiments of this application provide an offline printing device, the device comprising:

[0011] The print mode acquisition unit is used to acquire the preset print mode sent in advance by the terminal device application;

[0012] The trigger command acquisition unit is used to acquire trigger commands for physical buttons of the printing device when the preset communication connection with the terminal device is disconnected;

[0013] The printing operation unit is used to retrieve the printing template corresponding to the preset printing mode from the storage module and perform the printing operation based on the trigger command.

[0014] Thirdly, embodiments of this application provide a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the above-described method steps.

[0015] Fourthly, embodiments of this application provide an electronic device that may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the above-described method steps.

[0016] In one or more embodiments of this application, a preset printing mode pre-sent by a terminal device application is obtained. When a preset communication connection with the terminal device is disconnected, a trigger command for a physical button on the printing device is obtained. Based on the trigger command, a print template corresponding to the preset printing mode is retrieved from the storage module, and a printing operation is performed. By pre-sending the printing mode to the terminal device, printing can be performed directly by clicking a physical button according to a pre-stored template even without establishing a connection, thus improving the convenience of the printing device. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 is a schematic diagram illustrating a preset configuration of a terminal device according to an embodiment of this application;

[0019] Figure 2 is a flowchart illustrating an offline printing method provided in an embodiment of this application;

[0020] Figure 3 is a schematic diagram of a preset printing template setting provided in an embodiment of this application;

[0021] Figure 4 is a flowchart illustrating a printing operation in a validity period printing mode according to an embodiment of this application;

[0022] Figure 5 is a schematic flowchart of a time calibration process provided in an embodiment of this application;

[0023] Figure 6 is a flowchart illustrating a printing operation in a historical template printing mode according to an embodiment of this application;

[0024] Figure 7 is a flowchart illustrating a printing operation in real-time printing mode according to an embodiment of this application;

[0025] Figure 8 is a flowchart illustrating a printing operation under a specified template printing mode provided in an embodiment of this application;

[0026] Figure 9 is a schematic diagram of an offline printing device provided in an embodiment of this application;

[0027] Figure 10 is a schematic diagram of an offline printing device provided in an embodiment of this application;

[0028] Figure 11 is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Embodiments of the present invention

[0029] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0030] Printing devices with continuous printing capabilities offer high printing efficiency, bringing convenience to people's daily lives and work. Users can edit and confirm the required printing content on a terminal device, and then send the printing content to the printing device through the terminal device. The printing device can then print according to the received printing content. However, when users do not carry a terminal device with them, it is difficult for them to edit the printing content through the printer, resulting in the printing device being unable to work independently and making the operation of the printing device complicated. This application provides an offline printing method that allows users to complete printing through convenient operation even when the printing device is offline and communication with the terminal device is disconnected. The offline printing method provided in this application can be implemented by a computer program and can run on an offline printing device based on the von Neumann architecture. This computer program can be integrated into an application or run as a standalone utility application. The offline printing device can be the printing device itself, a module or application program within the printing device for executing the offline printing method, or an independent device connected to and controlling the printing device to execute the offline printing method.

[0031] Please refer to Figure 1, which is a schematic diagram illustrating a preset configuration of a terminal device according to an embodiment of this application. In this embodiment, the terminal device can establish a preset communication connection with the printing device. The preset communication connection can be a wired connection or a wireless connection. The wireless connection can include Bluetooth communication connection, local area network communication connection or near field communication connection, etc. The preset communication connection is used to enable data exchange between the terminal device and the printing device. Printing equipment can be used in label printing scenarios. The printed labels can be used on products to mark information such as production date and expiration date. Therefore, printing equipment often needs to perform continuous printing operations to meet the label printing needs of a batch of products. In order to meet the needs of mass printing and further improve the convenience of printing operations, printing equipment can perform subsequent printing operations based on pre-edited printing templates. Users can edit printing template data on the terminal device's application. Printing template data includes relevant data of the printing template, such as text information, date and time offset information, date and time format, alignment, rotation, inversion, language type, underline, font size, 12-hour or 24-hour format, coordinate information, etc. Among them, printing template data can be expiration date template printing data. Expiration date template printing data is a predefined data format and content related to the expiration date (such as product expiration date, certificate expiration date, etc.) in the printing template, which can be used to generate printed documents or labels containing expiration date information.

[0032] In addition to editing print template data on the terminal device, users can also determine a preset print mode and send the preset print mode to the printing device via a preset communication connection. The printing device can save the print template data in its storage module. The preset print mode is the way the printing device calls the print template data to perform the printing operation. At the same time, there can be physical buttons on the printing device, which users can use to control the printing device to perform the printing operation. The offline printing device can save the received print template data and preset print mode. Even if the terminal device has not established a preset communication connection with the printing device, as long as it detects that the user is controlling the printing device to perform the printing operation via physical buttons, it can complete the printing operation according to the print template data and preset print mode. Thus, the printing device can complete the printing operation autonomously even without a terminal device connection.

[0033] The offline printing method provided in this application will be described in detail below with reference to specific embodiments.

[0034] Please refer to Figure 2, which is a flowchart illustrating an offline printing method provided in an embodiment of this application. As shown in Figure 2, the method in this embodiment may include the following steps S101-S103.

[0035] S101, Obtain the preset printing mode sent in advance by the terminal device application.

[0036] Specifically, once a preset communication connection is established between the terminal device and the printing device, the user can set the desired preset printing mode on the terminal device's application and then send the preset printing mode to the printing device. The offline printing device can then obtain the preset printing mode sent by the terminal device's application and save it for later use.

[0037] S102, when the preset communication connection with the terminal device is disconnected, obtain the trigger command for the physical button of the printing device.

[0038] Specifically, even when the pre-defined communication connection between the printing device and the terminal device is disconnected, the printing device can still perform printing operations normally. If the user wants to use the printing device to perform printing operations, they can directly press the physical button on the printing device to send a trigger command to the printing device. The trigger command can be used to instruct the printing device to perform printing operations. Therefore, the offline printing device can obtain the user's trigger command for the physical button of the printing device to facilitate subsequent printing operations.

[0039] Optionally, the printing device can have a variety of physical buttons. Different physical buttons can have different functions and be used to send different commands. Physical buttons can be mechanical buttons or virtual buttons on the display screen. Among them, mechanical buttons have a physical structure, and users can trigger the corresponding functions by pressing, rotating, and other operations. Virtual buttons on the display screen are generated based on touch screen technology. Users can simulate button operations by touching specific areas on the screen. Virtual buttons can be adjusted and displayed according to different interface and functional requirements.

[0040] Understandably, when the preset communication connection with the terminal device is disconnected, the user can send a trigger command via physical buttons to instruct the printing device to perform a printing operation. When the preset communication connection with the terminal device is established, the user can also send a trigger command via physical buttons to perform a printing operation. In other words, the printing operation of the printing device is no longer limited by the connection with the terminal device. As long as the preset printing mode is saved, the user can directly perform a printing operation via physical buttons, which further simplifies the user operation.

[0041] S103, based on the trigger command, retrieves the print template corresponding to the preset print mode from the storage module and performs the print operation.

[0042] Specifically, after receiving the trigger command, the offline printing device can determine the preset printing mode it has stored in advance, and then retrieve the print template corresponding to the preset printing mode from the storage module to perform the printing operation, thereby enabling the printing device to work independently in offline mode. Since the preset printing mode is the way the printing device calls print template data to perform the printing operation, even if all print templates are generated based on the same print template data, the print templates corresponding to different preset printing modes can be different. For example, the print template data is used to determine the text frame of the print template, while the preset printing mode can be used to determine how to fill in the print template.

[0043] In this embodiment, a preset printing mode pre-sent by the terminal device application is obtained. When the preset communication connection with the terminal device is disconnected, a trigger command for the physical buttons of the printing device is obtained. Based on the trigger command, the print template corresponding to the preset printing mode is retrieved from the storage module and the printing operation is performed. By pre-sending the printing mode to the terminal device, printing can be performed directly by clicking the physical button according to the pre-stored template even without establishing a connection, thus improving the convenience of the printing device.

[0044] Please refer to Figure 3, which is a flowchart illustrating the setting of a preset printing template according to an embodiment of this application. As shown in Figure 3, in one or more embodiments of this application, step S101 includes the following steps S201-S202.

[0045] S201, establish a preset communication connection with the terminal device.

[0046] Specifically, the offline printing device can control the printing device to establish a preset communication connection with the terminal device. For example, when a user wants to establish a preset communication connection, they can send a communication connection request to the printing device through the terminal device. After detecting the communication connection request, the offline printing device can send a communication connection permission to the terminal device, thereby enabling the printing device and the terminal device to establish a preset communication connection and exchange data between them.

[0047] S202, based on a preset communication connection, obtain the preset printing mode sent by the terminal device application. The preset printing mode is set by the user in the application.

[0048] Specifically, users can set the desired preset printing mode on the terminal device's application and then send the preset printing mode to the printing device. The offline printing device can then obtain the preset printing mode sent by the terminal device application based on the established preset communication connection and save the preset printing mode.

[0049] In this embodiment, a preset communication connection is established with the terminal device. Based on this connection, a preset printing mode sent by the terminal device's application is obtained. This preset printing mode is set by the user within the application. By obtaining the preset printing mode sent by the terminal device through the preset communication connection, the user's personalized settings are satisfied, the pre-printing operation is simplified, and cumbersome settings on the printer's control panel are avoided.

[0050] The preset printing mode can be a way to call the printing template data for printing operation. Therefore, the offline printing device can be set with a variety of preset printing modes. After the user sets the preset printing mode on the terminal device application, the offline printing device can directly complete the printing operation according to the preset printing mode even in offline mode.

[0051] In one or more embodiments of this application, the preset printing mode includes an expiration date printing mode, a historical template printing mode, a real-time printing mode, and a specified template printing mode.

[0052] Specifically, preset printing modes can include at least four types: validity period printing mode, historical template printing mode, real-time printing mode, and instruction template printing mode. Validity period printing mode can be used to print information related to validity periods, such as product validity periods and certificate validity periods. For example, in validity period printing mode, the offline printing device can obtain the current time and the user-preset validity period length to calculate the expiration date of products, certificates, etc., and then fill the expiration date into the printing template for printing. Historical template printing mode can be used to print previously printed content. For example, in historical template printing mode, the offline printing device can obtain the printing template used in the last printing and print it directly, which can be applied to scenarios where labels for the same batch of products are reprinted. Real-time printing mode can be used to add the current time to the printing template for printing the current time, which can be applied to scenarios where product production dates are printed. Instruction template printing mode, the specified template printing mode can be used to print fixed printing content determined and pre-set by the user, such as in scenarios where time-independent fixed content is printed, like certificates of conformity.

[0053] Optionally, the print templates corresponding to different preset printing modes can be different. When editing, setting and sending print template data, users can set which preset printing mode the print template data is used to generate. The offline printing device can save the print template data corresponding to different preset print templates in the storage module and call them according to the type of preset print template.

[0054] Optionally, the print template data consists of relevant data for the print template, mainly including various print elements required for the generated print template, such as text information, date and time offset information, date and time format, alignment, rotation, inversion, language type, underline, font size, 12-hour or 24-hour format, coordinate information, etc. Various print elements can be combined to generate the print template. Therefore, the required print elements may be different in different preset print modes. Each preset print mode can be set with corresponding preset print elements. The offline printing device can obtain the corresponding print elements from the print template data of the storage module, and then generate the print template corresponding to the preset print mode based on these print elements.

[0055] Please refer to Figure 4, which is a flowchart illustrating a printing operation in the validity period printing mode according to an embodiment of this application. As shown in Figure 4, in one or more embodiments of this application, step S103 includes the following steps S301-S304.

[0056] S301, based on the trigger command, retrieves the expiration date print template corresponding to the expiration date print mode from the storage module.

[0057] Specifically, when the preset printing mode is the expiration printing mode, after receiving the trigger command, the offline printing device can obtain the expiration printing template corresponding to the expiration printing mode from the storage module. The expiration printing template can be a printing template generated from the printing template data corresponding to the expiration printing mode, or a printing template generated from the printing elements corresponding to the expiration printing mode.

[0058] S302 reads the current time from the hardware clock circuit and obtains the offset in the validity period printing template.

[0059] Specifically, the expiration date printing mode can be used to print information related to expiration dates, so it needs to print the current time. The offline printing device can read the valid printing time from the hardware clock circuit. This hardware clock circuit can be a Real-Time Clock (RTC) to provide accurate real-time time information. It can be integrated into the printing device to track the current date and time. Even if the device loses power, the RTC can continue to operate using a backup battery or other power source, ensuring time continuity. It can also obtain the offset in the expiration date printing template. The offset can be the expiration date length set by the user, such as the shelf life of food products.

[0060] Optionally, the printing operation can be a continuous printing operation, so the current time of the hardware clock circuit can be read before each printing operation, which further improves the accuracy of the printing time.

[0061] S303, calculate the expiration date based on the current time and offset, and fill the expiration date into the preset position of the expiration date in the validity period printing template.

[0062] Specifically, the offline printing device can calculate the expiration date based on the current time and offset. For example, the current time can be added to the offset to obtain the expiration date. Label printing requires timeliness, so the print template data only determines the text framework of the print template, leaving some blank spaces that need to be filled in during the printing operation. Since the expiration date print template can have preset positions for filling in the real-time calculated expiration date, the offline printing device can fill in the expiration date in the preset positions in the expiration date print template, eliminating the need for users to manually input or adjust date information, saving time and effort, and avoiding errors that may occur with manual calculation.

[0063] S304, Print based on the completed validity period print template.

[0064] Specifically, the offline printing device can perform printing operations based on the filled-in expiration date print template, allowing the printing equipment to print the filled-in expiration date print template onto the printing paper. The user only needs to send a trigger command, and the printing equipment can automatically complete the entire process from obtaining the print template, reading the current time, calculating the expiration date, and filling in the print template, reducing the tedious steps of manual operation and reducing errors caused by human operation.

[0065] In this embodiment, based on a trigger command, the validity period print template corresponding to the validity period print mode is retrieved from the storage module. The current time of the hardware clock circuit is read, the offset in the validity period print template is obtained, the expiration date is calculated based on the current time and the offset, and the expiration date is filled into the preset position of the expiration date in the validity period print template. The printing operation is then performed based on the filled-in validity period print template. By automatically obtaining the current date and offset to calculate and fill in the expiration date, the tedious operation of manually entering or changing the date by the user is avoided, as well as printing errors caused by calculation or input errors. This improves the accuracy and efficiency of printing, and further enhances the convenience and flexibility of using the printing device.

[0066] During the printing of expiration date information, the accuracy of the time information not only directly affects the correctness of the printed content, but may also affect the use, sales, and compliance of related products. Therefore, it is necessary to calibrate the current time to improve the accuracy of the time information.

[0067] Please refer to Figure 5, which is a schematic flowchart of a time calibration process provided in an embodiment of this application. As shown in Figure 5, in one or more embodiments of this application, the method further includes the following steps S401-S402.

[0068] S401: When a preset communication connection is established with the terminal device, obtain the network time of the terminal device.

[0069] Specifically, once a preset communication connection is established between the printing device and the terminal device, the offline printing device can obtain the network time of the terminal device through the preset communication connection. Network time refers to the time information obtained and synchronized from one or more time servers through a network connection. It usually comes from a high-precision time source (such as an atomic clock or GPS satellite) and is transmitted to each device through the network to ensure that the time of all devices is consistent.

[0070] Optionally, the offline printing device can obtain the network time from the terminal device and use it for calibration when it detects that a preset communication connection has been established between the printing device and the terminal device. Alternatively, it can obtain the network time of the terminal device every preset calibration time and use it for calibration when a preset communication connection has been established between the printing device and the terminal device, thereby further ensuring the accuracy of the current time in the hardware clock circuit.

[0071] S402 calibrates the hardware clock circuit based on network time.

[0072] Specifically, hardware clock circuits may experience time drift due to temperature changes, aging, or other factors. By periodically calibrating the hardware clock from network time, the accumulation of such errors can be reduced, ensuring long-term time accuracy. Offline printing devices can calibrate the hardware time circuit based on network time, that is, calibrate the current time in the hardware time circuit to the acquired network time.

[0073] In this embodiment, when a preset communication connection is established with the terminal device, the network time of the terminal device is obtained, and the hardware clock circuit is calibrated based on the network time. Calibrating the hardware clock circuit using network time reduces the accumulated error of the hardware clock circuit, further improving the accuracy of time information during printing.

[0074] In one or more embodiments of this application, the calibration error of the calibration process is a preset error value.

[0075] Specifically, the calibration error during the calibration process of the offline printing device is a preset error value. The preset error value represents the accuracy of the calibration process. It can be the initial setting of the offline printing device, or it can be set by the user or relevant personnel. It can also be related to the accuracy of the hardware clock circuit in the printing device. For example, the preset error value can be ±1 second.

[0076] In one or more embodiments of this application, the following steps may be included before step S304:

[0077] If the continuous time during which the hardware clock circuit has not been calibrated exceeds the first preset time, a flashing light will be used as a warning.

[0078] Specifically, if the continuous time during which the hardware clock circuit has not been calibrated, i.e. the time interval since the last calibration, is greater than the first preset time, it is determined that the hardware clock circuit has not been calibrated for a long time, and the time information may be inaccurate. The offline printing device can then flash a light to indicate this. The first preset time can be the initial setting of the offline printing device or can be set by the user or relevant personnel.

[0079] For example, an error indicator light can be set on the printing device. The offline printing device can control the error indicator light to flash to complete the light flashing prompting process, which is used to prompt the user that the hardware clock circuit needs to be calibrated. After the user observes the light flashing prompt, a terminal device can be connected to the printing device so that the offline printing device can obtain the network time and perform calibration.

[0080] Optionally, a buzzer can also be installed on the printing device. To further improve the efficiency of error prompting, if the continuous time during which the hardware clock circuit has not been calibrated is greater than a first preset time, the offline printing device can provide a buzzer prompt based on the buzzer.

[0081] In this embodiment, automated time detection and flashing light prompts reduce the need for manual periodic checks of hardware clock calibration status, facilitate timely detection and handling of uncalibrated hardware clock circuits, reduce vulnerabilities caused by time information errors, and further improve the accuracy of printing operations.

[0082] In one or more embodiments of this application, step S304 may further include the following steps:

[0083] If the hardware clock circuit is not calibrated within the second preset time after the flashing light prompts the process, offline printing will be performed based on the filled-in validity period template and the uncalibrated time watermark.

[0084] Specifically, in real-world applications, users may not notice the indicator light or may leave the printing device, resulting in a failure to connect in time and thus preventing calibration. Therefore, if the offline printing device detects that the hardware circuit has not been calibrated within the second preset time after the flashing indicator light, it can directly perform offline printing based on the entered validity period template and the uncalibrated time watermark. The uncalibrated time watermark indicates that the time information in the printed content has not been calibrated and may result in errors.

[0085] In this embodiment of the application, adding a time-uncalibrated watermark when time calibration has not been performed for a long time can not only avoid interruption of continuous printing, but also prompt users to pay attention to the time information in the label.

[0086] In one or more embodiments of this application,

[0087] If the preset printing mode is the history template printing mode, the storage module will only store the printing template used in the last printing operation.

[0088] Specifically, the historical template printing mode can be used to print the content of the previous print job. For example, it can be applied to scenarios where labels of the same batch of products are reprinted. In order to avoid errors in calling the printing template, if the preset printing mode is the historical template printing mode, the storage module can only store the printing template used in the previous printing operation. This allows the offline printing device to directly call the previous printing template from the storage module for printing operations in the historical template printing mode, saving storage module memory space and avoiding confusion of printing templates.

[0089] Please refer to Figure 6, which is a flowchart illustrating a printing operation in a historical template printing mode according to an embodiment of this application. As shown in Figure 6, in one or more embodiments of this application, step S103 includes the following steps S501-S502.

[0090] S501 retrieves the print template used in the previous print operation from the storage module based on the trigger command.

[0091] Specifically, when the preset printing mode is the historical template printing mode, after receiving the trigger command, the offline printing device can retrieve the printing template used in the last printing operation from the storage module.

[0092] S502 performs printing operations based on a print template.

[0093] Specifically, the line printing device can perform printing operations based on a printing template, so that the printing device prints the printing template onto the printing paper.

[0094] Optionally, the print template used in the previous printing operation can be a print template corresponding to other preset printing modes. Therefore, the printing operation method of the print template is the same as its corresponding preset printing mode. For example, if the print template used in the previous printing operation is an expiration print template, the printing operation can refer to the above steps S302-S04.

[0095] In this embodiment, based on a trigger command, the print template used in the previous printing operation is retrieved from the storage module, and the printing operation is performed based on the print template. By retrieving the print template used in the previous printing operation and performing the printing operation, the efficiency and accuracy of printing are improved, the operation process is further simplified, and data consistency is enhanced.

[0096] Please refer to Figure 7, which is a flowchart illustrating a printing operation in real-time printing mode according to an embodiment of this application. As shown in Figure 7, in one or more embodiments of this application, step S103 includes the following steps S601-S603.

[0097] S601, based on the trigger command, obtains the real-time print template corresponding to the real-time time print mode in the storage module.

[0098] Specifically, when the preset printing mode is real-time printing mode, after receiving the trigger command, the offline printing device can obtain the real-time printing template corresponding to the real-time printing mode from the storage module. The real-time printing template can be a printing template generated from the printing template data corresponding to the real-time printing mode, or a printing template generated from the printing elements corresponding to the real-time printing mode.

[0099] S602 reads the current time from the hardware clock circuit and fills the current time into the preset date position in the real-time printing template.

[0100] Specifically, the real-time time printing mode can be used to print the current time, applicable to scenarios such as printing product production dates. The real-time print template can have preset date positions for filling in the currently read time. Therefore, the offline printing device can read the current time from the hardware clock circuit and fill it into the preset date position in the real-time print template.

[0101] S603 performs printing operations based on the filled-in real-time print template.

[0102] Specifically, the offline printing device can perform printing operations based on the filled-in real-time printing template, so that the printing device can print the filled-in real-time printing template on the printing paper.

[0103] In this embodiment, based on a trigger command, the real-time print template corresponding to the real-time time printing mode in the storage module is obtained. The current time of the hardware clock circuit is read, and the current time is filled into the preset date position in the real-time print template. The printing operation is then performed based on the filled-in real-time print template. By automatically obtaining the current date for filling and printing, the tedious operation of manually entering or changing the date by the user is avoided, as well as printing errors caused by user input errors. This improves the accuracy and efficiency of printing, and further enhances the convenience and flexibility of using the printing device.

[0104] Please refer to Figure 8, which is a flowchart illustrating a printing operation in a specified template printing mode according to an embodiment of this application. As shown in Figure 8, in one or more embodiments of this application, step S103 includes the following steps S701-S702.

[0105] S701, based on the trigger command, retrieves the pre-stored specified print template corresponding to the specified template print mode from the storage module.

[0106] Specifically, when the preset printing mode is the specified template printing mode, after receiving the trigger command, the offline printing device can obtain the pre-stored specified printing template corresponding to the specified template printing mode from the storage module. The pre-stored specified printing template can be a printing template generated from the printing template data corresponding to the specified template printing mode, or a printing template generated from the printing elements corresponding to the specified template printing mode.

[0107] Optionally, the pre-stored specified print template can be fixed content that is unrelated to time information such as the current time, such as a certificate of conformity. Therefore, the specified template printing mode can be applied to scenarios where fixed content is printed in batches.

[0108] S702 performs printing operations based on a pre-stored specified print template.

[0109] Specifically, offline printing devices can perform printing operations based on pre-stored specified printing templates, so that the printing device can print the pre-stored specified printing templates onto the printing paper.

[0110] In this embodiment, based on a trigger command, a pre-stored specified print template corresponding to a specified template printing mode is retrieved from the storage module, and the printing operation is performed based on the pre-stored specified print template. Automatic template retrieval and printing via trigger command avoids tedious manual operations by the user, thereby improving printing accuracy and efficiency, and further enhancing the convenience and flexibility of the printing device.

[0111] In one or more embodiments of this application, the following steps are included before step S702:

[0112] If the pre-stored specified print template is not a valid print template, the current time of the hardware clock circuit will not be read.

[0113] Specifically, the pre-stored template can be either fixed content or a template corresponding to other preset printing modes. For example, the pre-stored template can be an expiration date printing template or a real-time printing template. If the pre-stored template is not an expiration date printing template, there is no need to process the time information for printing, and the current time of the hardware clock circuit does not need to be read, thus saving printing steps and improving printing efficiency. Similarly, if it is known that the pre-stored template is not a real-time printing template, the current time of the hardware clock circuit does not need to be read.

[0114] In one or more embodiments of this application, the method further includes the following steps:

[0115] When the preset communication connection with the terminal device is disconnected, the preset printing mode is the printing mode sent by the application last time, and switching the preset printing mode based on physical buttons is prohibited.

[0116] Specifically, when the printing device and the terminal device disconnect the preset communication connection, the preset printing mode saved by the offline printing device is the printing mode sent by the application last time. In other words, the setting and sending of the preset printing mode can only be done when the printing device and the terminal device have established a preset communication connection.

[0117] The printing device can be controlled not only through the terminal device, but also has an operation panel. Users can use physical buttons on the operation panel to switch preset printing modes, select printing content, and send trigger commands. In order to prevent the preset printing mode set when the preset communication connection is established from being changed due to user error when operating the physical buttons when the preset communication connection is disconnected from the terminal device, the offline printing device can prevent the switching of preset printing modes based on physical buttons, thereby avoiding human error and further ensuring the accuracy of printing operations.

[0118] In one or more embodiments of this application, the method further includes the following steps:

[0119] When the battery level is detected to be lower than the preset power threshold, the expiration date printing mode and real-time time printing mode will be turned off.

[0120] Specifically, the hardware clock circuit relies on the printer's battery power to operate normally. Insufficient battery power will affect the accuracy of the hardware clock circuit. When the offline printing device detects that the battery power is lower than the preset power threshold, it can turn off the validity period printing mode and the real-time time printing mode to avoid obtaining the current time of the hardware clock circuit and avoid printing inaccurate time information. The preset power threshold is used to determine whether the remaining battery power can meet the normal operation of the hardware clock circuit. It can be the initial setting of the offline printing device or set by the user or relevant personnel.

[0121] In one or more embodiments of this application, the method further includes the following steps:

[0122] Obtain the preset light color corresponding to the preset printing mode, and provide light indication based on the preset light color. Different preset printing modes correspond to different preset light colors.

[0123] Specifically, the printing device can be equipped with a mode indicator light. The mode indicator light can be used to indicate to the user the current preset printing mode of the printing device. The offline printing device can set different preset light colors for different preset printing modes. After the preset printing mode is determined, the preset light color corresponding to the preset printing mode can be obtained, and then the mode indicator light will light up based on the preset light color to provide light indication. This allows the user to judge the current preset printing mode by observing the color of the mode indicator light. The user can quickly confirm the status of the printing device and avoid printing errors caused by incorrect printing mode settings.

[0124] The offline printing apparatus provided in the embodiments of this application will now be described in detail with reference to Figures 9-10. It should be noted that the offline printing apparatus in Figures 4-6 is used to execute the methods of the embodiments shown in Figures 1-8 of this application. For ease of explanation, only the parts related to the embodiments of this application are shown. For specific technical details not disclosed, please refer to the embodiments shown in Figures 9 and 10 of this application.

[0125] Please refer to Figure 9, which shows a schematic diagram of the structure of an offline printing device provided in an exemplary embodiment of this application. This offline printing device can be implemented as all or part of a device through software, hardware, or a combination of both. The device 1 includes a printing mode acquisition unit 11, a trigger command acquisition unit 12, and a printing operation unit 13.

[0126] Printing mode acquisition unit 11 is used to acquire a preset printing mode sent in advance by the terminal device application;

[0127] The trigger command acquisition unit 12 is used to acquire trigger commands for physical buttons of the printing device when the preset communication connection with the terminal device is disconnected;

[0128] The printing operation unit 13 is used to obtain the printing template corresponding to the preset printing mode from the storage module and perform the printing operation based on the trigger command.

[0129] In this embodiment, a preset printing mode pre-sent by the terminal device application is obtained. When the preset communication connection with the terminal device is disconnected, a trigger command for the physical buttons of the printing device is obtained. Based on the trigger command, the print template corresponding to the preset printing mode is retrieved from the storage module and the printing operation is performed. By pre-sending the printing mode to the terminal device, printing can be performed directly by clicking the physical button according to the pre-stored template even without establishing a connection, thus improving the convenience of the printing device.

[0130] Please refer to Figure 10, which shows a schematic diagram of the structure of an offline printing device provided in an exemplary embodiment of this application. This offline printing device can be implemented as all or part of a device through software, hardware, or a combination of both. The device 1 includes a printing mode acquisition unit 11, a trigger command acquisition unit 12, a printing operation unit 13, a calibration processing unit 14, a key disabling unit 15, an expiration date mode shutdown unit 16, and a light indicator unit 17.

[0131] Printing mode acquisition unit 11 is used to acquire a preset printing mode sent in advance by the terminal device application;

[0132] Optionally, the printing mode acquisition unit 11 is specifically used to establish a preset communication connection with the terminal device;

[0133] Based on the preset communication connection, a preset printing mode sent by the terminal device application is obtained, and the preset printing mode is set by the user on the application.

[0134] Optionally, the preset printing modes include validity period printing mode, historical template printing mode, real-time printing mode, and specified template printing mode.

[0135] The trigger command acquisition unit 12 is used to acquire trigger commands for physical buttons of the printing device when the preset communication connection with the terminal device is disconnected;

[0136] The printing operation unit 13 is used to obtain the printing template corresponding to the preset printing mode from the storage module and perform the printing operation based on the trigger command.

[0137] Optionally, the preset printing mode is an expiration date printing mode, and the printing operation unit 13 is specifically used to obtain the expiration date printing template corresponding to the expiration date printing mode from the storage module based on the trigger instruction.

[0138] Read the current time of the hardware clock circuit and obtain the offset in the validity period printing template;

[0139] Calculate the expiration date based on the current time and the offset, and fill the expiration date into the preset expiration date position in the validity period printing template;

[0140] Print based on the completed validity period print template.

[0141] Optionally, if the preset printing mode is the historical template printing mode, then the storage module only stores the printing template used in the last printing operation.

[0142] Optionally, the printing operation unit 13 is specifically used to retrieve the print template used in the previous printing operation from the storage module based on the trigger instruction;

[0143] Perform the printing operation based on the printing template.

[0144] Optionally, the preset printing mode is a real-time printing mode, and the printing operation unit 13 is specifically used to obtain the real-time printing template corresponding to the real-time printing mode in the storage module based on the trigger command.

[0145] Read the current time from the hardware clock circuit and fill the current time into the preset date position in the real-time printing template;

[0146] The printing operation is performed based on the completed real-time printing template.

[0147] Optionally, the preset printing mode is a specified template printing mode, and the printing operation unit 13 is specifically used to obtain the pre-stored specified printing template corresponding to the specified template printing mode from the storage module based on the trigger instruction.

[0148] The printing operation is performed based on the pre-stored specified print template.

[0149] The printing operation unit 13 is also used to not read the current time of the hardware clock circuit if the pre-stored specified printing template is not a valid printing template.

[0150] The calibration processing unit 14 is used to obtain the network time of the terminal device when a preset communication connection is established with the terminal device;

[0151] The hardware clock circuit is calibrated based on the network time.

[0152] Optionally, the calibration error of the calibration process is a preset error value.

[0153] Optionally, the calibration processing unit 14 is also used to perform light flashing prompt processing if the continuous time during which the hardware clock circuit has not been calibrated is greater than a first preset time.

[0154] Optionally, the calibration processing unit 14 is specifically used to perform offline printing processing based on the filled-in validity period template and the time uncalibrated watermark if the hardware clock circuit is not calibrated within a second preset time after the light flashing prompt processing.

[0155] The button disable unit 15 is used to prevent switching of the preset printing mode based on the physical button when the preset communication connection with the terminal device is disconnected.

[0156] The expiration date mode shutdown unit 16 is used to shut down the expiration date printing mode and the real-time time printing mode when the battery power is detected to be lower than a preset power threshold.

[0157] The light indicator unit 17 is used to obtain the preset light color corresponding to the preset printing mode and perform light indication based on the preset light color, wherein different preset printing modes correspond to different preset light colors.

[0158] In this embodiment, a preset communication connection is established with the terminal device. Based on this connection, a preset printing mode sent by the terminal device's application is obtained. This preset printing mode is set by the user within the application. By obtaining the preset printing mode sent by the terminal device under the preset communication connection, personalized settings are satisfied, simplifying the pre-printing process and avoiding cumbersome settings on the printer's control panel. If the preset communication connection with the terminal device is disconnected, trigger commands for the printer's physical buttons are obtained. Based on these commands, the print template corresponding to the preset printing mode is retrieved from the storage module, and the printing operation is performed. By pre-sending the printing mode to the terminal device, printing can be performed directly by clicking the physical button without establishing a connection, improving the convenience of the printer. Furthermore, the current date and offset are automatically calculated and the due date is filled in, avoiding the tedious manual input or modification of dates by the user. This also avoids printing errors caused by calculation or input mistakes, thereby improving printing accuracy and efficiency, and further enhancing the convenience and flexibility of the printer. If the preset printing mode is the history template printing mode, the storage module will only store the printing template used in the last printing operation, which saves storage module memory space and avoids confusion of printing templates.

[0159] When a preset communication connection is established with the terminal device, the network time of the terminal device is obtained, and the hardware clock circuit is calibrated based on the network time. Calibration using network time reduces the cumulative error of the hardware clock circuit, further improving the accuracy of time information during printing. If the continuous time for which the hardware clock circuit has not been calibrated exceeds a first preset time, a flashing light is activated as a warning. Automated time detection and light flashing reduce the need for regular manual checks of the hardware clock calibration status, facilitating timely detection and handling of uncalibrated hardware clock issues. This reduces vulnerabilities caused by time information errors, further improving the accuracy of printing operations. In cases where time calibration has not been performed for an extended period, an uncalibrated watermark is added, prompting the user to pay attention to the time information on the label while preventing continuous printing interruptions. When the preset communication connection with the terminal device is disconnected, the preset printing mode is the one previously sent by the application, and switching the preset printing mode using physical buttons is prohibited, avoiding human error and further ensuring the accuracy of printing operations. When the battery level is detected to be below a preset threshold, the expiration date printing mode and real-time time printing mode are disabled to avoid obtaining the current time from the hardware clock circuit and to prevent printing inaccurate time information. The preset light color corresponding to the preset printing mode is obtained and used for light indication, allowing users to quickly confirm the status of the printing device and avoiding printing errors caused by incorrect printing mode settings.

[0160] It should be noted that the offline printing device provided in the above embodiments is only illustrated by the division of the above functional modules when executing the offline printing method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the offline printing device and the offline printing method embodiments provided in the above embodiments belong to the same concept, and the implementation process can be found in the method embodiments, which will not be repeated here.

[0161] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0162] This application also provides a computer storage medium that can store multiple instructions. These instructions are adapted to be loaded by a processor and executed as described in the offline printing method of the embodiments shown in Figures 1-8 above. For details of the execution process, please refer to the specific description of the embodiments shown in Figures 1-8, which will not be repeated here.

[0163] This application also provides a computer program product that stores at least one instruction, which is loaded by the processor and executed as described in the offline printing method of the embodiments shown in Figures 1-8 above. For the specific execution process, please refer to the detailed description of the embodiments shown in Figures 1-8, which will not be repeated here.

[0164] Please refer to Figure 11, which shows a structural block diagram of an electronic device provided in an exemplary embodiment of this application. The electronic device in this application may include one or more components such as a processor 110, a memory 120, an input device 130, an output device 140, and a bus 150. The processor 110, memory 120, input device 130, and output device 140 may be connected to each other via the bus 150.

[0165] Processor 110 may include one or more processing cores. Processor 110 connects to various parts of the electronic device using various interfaces and lines, and executes various functions of terminal 100 and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 120, and by calling data stored in memory 120. Optionally, processor 110 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 110 may integrate one or more of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user page, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into processor 110 and may be implemented separately using a communication chip.

[0166] The memory 120 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 120 may include non-transitory computer-readable storage medium. The memory 120 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the various method embodiments described above, etc. The operating system may be the Android system, including systems deeply developed based on the Android system, the iOS system developed by Apple Inc., including systems deeply developed based on the iOS system, or other systems.

[0167] The memory 120 can be divided into operating system space and user space. The operating system runs in the operating system space, while native and third-party applications run in user space. To ensure that different third-party applications can achieve good running performance, the operating system allocates corresponding system resources for each application. However, different application scenarios within the same third-party application have different requirements for system resources. For example, in local resource loading scenarios, third-party applications have high requirements for disk read speed; in animation rendering scenarios, third-party applications have high requirements for GPU performance. Since the operating system and third-party applications are independent of each other, the operating system often cannot promptly perceive the current application scenario of a third-party application, resulting in the operating system's inability to adapt system resources accordingly.

[0168] In order for the operating system to distinguish the specific application scenarios of third-party applications, it is necessary to establish data communication between the third-party applications and the operating system. This would allow the operating system to obtain the current scenario information of the third-party applications at any time, and then perform targeted system resource adaptation based on the current scenario.

[0169] The input device 130 is used to receive input instructions or data, and includes, but is not limited to, a keyboard, mouse, camera, microphone, or touch device. The output device 140 is used to output instructions or data, and includes, but is not limited to, a display device and a speaker. In one example, the input device 130 and the output device 140 can be combined, and the input device 130 and the output device 140 can be a touch display screen.

[0170] The touch display screen can be designed as a full-screen, curved screen, or irregularly shaped screen. It can also be designed as a combination of a full-screen and a curved screen, or a combination of an irregularly shaped screen and a curved screen; however, this application does not limit the specific design in this regard.

[0171] In addition, those skilled in the art will understand that the structure of the electronic device shown in the above figures does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements. For example, the electronic device may also include radio frequency circuits, input units, sensors, audio circuits, Wireless Fidelity (WiFi) modules, power supplies, Bluetooth modules, etc., which will not be described in detail here.

[0172] In the electronic device shown in Figure 11, the processor 110 can be used to call the offline printing application stored in the memory 120 and specifically perform the following operations:

[0173] Obtain the preset printing pattern sent in advance by the terminal device application;

[0174] When the preset communication connection with the terminal device is disconnected, a trigger command for the physical button of the printing device is obtained;

[0175] Based on the trigger command, the print template corresponding to the preset print mode is retrieved from the storage module and the print operation is performed.

[0176] In one embodiment, when the processor 110 executes the operation of obtaining a preset printing pattern pre-sent by the terminal device application, it specifically performs the following operations:

[0177] Establish a preset communication connection with the terminal device;

[0178] Based on the preset communication connection, a preset printing mode sent by the terminal device application is obtained, and the preset printing mode is set by the user on the application.

[0179] In one embodiment, the preset printing modes include an expiration date printing mode, a historical template printing mode, a real-time printing mode, and a specified template printing mode.

[0180] In one embodiment, the preset printing mode is an expiration printing mode. When the processor 110 executes the print template corresponding to the preset printing mode from the storage module and performs the printing operation based on the trigger instruction, it specifically performs the following operations:

[0181] Based on the triggering instruction, the validity period printing template corresponding to the validity period printing mode is obtained from the storage module;

[0182] Read the current time of the hardware clock circuit and obtain the offset in the validity period printing template;

[0183] Calculate the expiration date based on the current time and the offset, and fill the expiration date into the preset expiration date position in the validity period printing template;

[0184] Print based on the completed validity period print template.

[0185] In one embodiment, when executing the offline printing method, the processor 110 also performs the following operations:

[0186] When a preset communication connection is established with the terminal device, the network time of the terminal device is obtained;

[0187] The hardware clock circuit is calibrated based on the network time.

[0188] In one embodiment, the calibration error of the calibration process is a preset error value.

[0189] In one embodiment, before performing the printing operation based on the filled-in expiration date template, the processor 110 also performs the following operations:

[0190] If the continuous time during which the hardware clock circuit has not been calibrated exceeds a first preset time, then a light flashing prompt will be made.

[0191] In one embodiment, when the processor 110 performs a printing operation based on the filled-in expiration date template, it specifically performs the following operations:

[0192] If the hardware clock circuit is not calibrated within the second preset time after the flashing light prompt, offline printing will be performed based on the filled-in validity period template and the uncalibrated time watermark.

[0193] In one embodiment, if the preset printing mode is the historical template printing mode, then the storage module only stores the printing template used in the last printing operation.

[0194] In one embodiment, when the processor 110 executes the print template corresponding to the preset print mode from the storage module and performs the print operation based on the trigger instruction, it specifically performs the following operations:

[0195] Based on the trigger command, the print template used in the previous printing operation is retrieved from the storage module;

[0196] Perform the printing operation based on the printing template.

[0197] In one embodiment, the preset printing mode is a real-time printing mode. When the processor 110 executes the print template corresponding to the preset printing mode from the storage module and performs the printing operation based on the trigger instruction, it specifically performs the following operations:

[0198] Based on the trigger command, obtain the real-time print template corresponding to the real-time printing mode in the storage module;

[0199] Read the current time from the hardware clock circuit and fill the current time into the preset date position in the real-time printing template;

[0200] The printing operation is performed based on the completed real-time printing template.

[0201] In one embodiment, the preset printing mode is a specified template printing mode. When the processor 110 executes the print template corresponding to the preset printing mode from the storage module and performs the printing operation based on the trigger instruction, it specifically performs the following operations:

[0202] Based on the trigger command, the pre-stored specified print template corresponding to the specified template print mode is obtained from the storage module;

[0203] The printing operation is performed based on the pre-stored specified print template.

[0204] In one embodiment, before performing the printing operation based on the pre-stored specified print template, the processor 110 also performs the following operations:

[0205] If the pre-stored specified print template is not a valid print template, the current time of the hardware clock circuit will not be read.

[0206] In one embodiment, when executing the offline printing method, the processor 110 also performs the following operations:

[0207] When the preset communication connection with the terminal device is disconnected, the preset printing mode is the printing mode sent by the application last time, and switching the preset printing mode based on the physical button is prohibited.

[0208] In one embodiment, when executing the offline printing method, the processor 110 also performs the following operations:

[0209] When the battery level is detected to be lower than the preset power threshold, the expiration date printing mode and the real-time time printing mode are turned off.

[0210] In one embodiment, when executing the offline printing method, the processor 110 also performs the following operations:

[0211] Obtain the preset light color corresponding to the preset printing mode, and provide light indication based on the preset light color, wherein different preset printing modes correspond to different preset light colors.

[0212] In this embodiment, a preset communication connection is established with the terminal device. Based on this connection, a preset printing mode sent by the terminal device's application is obtained. This preset printing mode is set by the user within the application. By obtaining the preset printing mode sent by the terminal device under the preset communication connection, personalized settings are satisfied, simplifying the pre-printing process and avoiding cumbersome settings on the printer's control panel. When the preset communication connection with the terminal device is disconnected, trigger commands for the printer's physical buttons are obtained. Based on these commands, the print template corresponding to the preset printing mode is retrieved from the storage module, and the printing operation is performed. By pre-sending the printing mode to the terminal device, printing can be performed directly by clicking the physical button without establishing a connection, improving the convenience of the printer. Furthermore, the current date and offset are automatically obtained to calculate and fill in the due date, avoiding the tedious operation of manually entering or changing the date. This also avoids printing errors caused by calculation or input mistakes, thereby improving printing accuracy and efficiency, and further enhancing the convenience and flexibility of the printer. If the preset printing mode is the history template printing mode, the storage module will only store the printing template used in the last printing operation, which saves storage module memory space and avoids confusion of printing templates.

[0213] When a preset communication connection is established with the terminal device, the network time of the terminal device is obtained, and the hardware clock circuit is calibrated based on the network time. Calibration using network time reduces the cumulative error of the hardware clock circuit, further improving the accuracy of time information during printing. If the continuous time for which the hardware clock circuit has not been calibrated exceeds a first preset time, a flashing light is activated as a warning. Automated time detection and light flashing reduce the need for regular manual checks of the hardware clock calibration status, facilitating timely detection and handling of uncalibrated hardware clock issues. This reduces vulnerabilities caused by time information errors, further improving the accuracy of printing operations. In cases where time calibration has not been performed for an extended period, an uncalibrated watermark is added, prompting the user to pay attention to the time information on the label while preventing continuous printing interruptions. When the preset communication connection with the terminal device is disconnected, the preset printing mode is the one previously sent by the application, and switching the preset printing mode using physical buttons is prohibited, avoiding human error and further ensuring the accuracy of printing operations. When the battery level is detected to be below a preset threshold, the expiration date printing mode and real-time time printing mode are disabled to avoid obtaining the current time from the hardware clock circuit and to prevent printing inaccurate time information. The preset light color corresponding to the preset printing mode is obtained and used for light indication, allowing users to quickly confirm the status of the printing device and avoiding printing errors caused by incorrect printing mode settings.

[0214] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory, or random access memory, etc.

[0215] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.

[0216] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in the embodiments of this specification are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the print template data and preset print modes involved in this specification were obtained with full authorization.

Claims

1. An off-line printing method, wherein, The method includes: Obtain the preset printing pattern sent in advance by the terminal device application; When the preset communication connection with the terminal device is disconnected, a trigger command for the physical button of the printing device is obtained; Based on the trigger command, the print template corresponding to the preset print mode is retrieved from the storage module and the print operation is performed.

2. The method of claim 1, wherein, The process of obtaining the preset printing mode sent in advance by the terminal device application includes: Establish a preset communication connection with the terminal device; Based on the preset communication connection, a preset printing mode sent by the terminal device application is obtained, and the preset printing mode is set by the user on the application.

3. The method of claim 1, wherein, The preset printing modes include validity period printing mode, historical template printing mode, real-time printing mode, and specified template printing mode.

4. The method of claim 1, wherein, The preset printing mode is an expiration-based printing mode. The step of retrieving the print template corresponding to the preset printing mode from the storage module and performing the printing operation based on the trigger command includes: Based on the triggering instruction, the validity period printing template corresponding to the validity period printing mode is obtained from the storage module; Read the current time of the hardware clock circuit and obtain the offset in the validity period printing template; Calculate the expiration date based on the current time and the offset, and fill the expiration date into the preset expiration date position in the validity period printing template; Print based on the completed validity period print template.

5. The method of claim 4, wherein, The method further includes: When a preset communication connection is established with the terminal device, the network time of the terminal device is obtained; The hardware clock circuit is calibrated based on the network time.

6. The method of claim 5, wherein, The calibration error in the calibration process is a preset error value.

7. The method of claim 5, wherein, Before printing based on the filled-in validity period template, the process also includes: If the continuous time during which the hardware clock circuit has not been calibrated exceeds a first preset time, then a light flashing prompt will be made.

8. The method of claim 7, wherein, The printing operation based on the filled-in validity period template includes: If the hardware clock circuit is not calibrated within the second preset time after the flashing light prompt, offline printing will be performed based on the filled-in validity period template and the uncalibrated time watermark.

9. The method of claim 1, wherein, If the preset printing mode is the historical template printing mode, then the storage module only stores the printing template used in the last printing operation.

10. The method of claim 9, wherein, The step of retrieving the print template corresponding to the preset print mode from the storage module and performing the print operation based on the trigger command includes: Based on the trigger command, the print template used in the previous printing operation is retrieved from the storage module; Perform the printing operation based on the printing template.

11. The method of claim 1, wherein, The preset printing mode is a real-time printing mode. The step of retrieving the print template corresponding to the preset printing mode from the storage module and performing the printing operation based on the trigger command includes: Based on the trigger command, obtain the real-time print template corresponding to the real-time printing mode in the storage module; Read the current time from the hardware clock circuit and fill the current time into the preset date position in the real-time printing template; Print based on the filled real-time print template.

12. The method of claim 1, wherein, The preset print mode is a specified template print mode, and the print operation based on the trigger instruction includes: Based on the trigger instruction, the specified template print mode corresponding to the pre-stored specified print template is obtained in the storage module. Based on the pre-stored specified print template, the print operation is performed.

13. The method of claim 12, wherein, Before the print operation based on the pre-stored specified print template, the method further includes: If the pre-stored specified print template is not a valid period print template, the current time of the hardware clock circuit is not read.

14. The method of claim 1, wherein, The method further includes: In the case of disconnecting the preset communication connection with the terminal device, the preset print mode is the print mode sent by the last application program, and the preset print mode is prohibited to be switched based on the physical key.

15. The method of claim 3, wherein, The method further includes: When it is detected that the battery power is lower than a preset power threshold, the valid period print mode and the real-time time print mode are closed.

16. The method of claim 3, wherein, The method further includes: A preset light color corresponding to the preset print mode is obtained, and light indication is performed based on the preset light color, wherein different preset print modes correspond to different preset light colors.

17. An off-line printing apparatus wherein, The device includes: A print mode acquisition unit configured to acquire a preset print mode sent by a terminal device application program in advance; A trigger instruction acquisition unit configured to acquire a trigger instruction for a physical key of a print device in the case of disconnecting a preset communication connection with the terminal device; A print operation unit configured to acquire a print template corresponding to the preset print mode in a storage module based on the trigger instruction and perform a print operation.

18. A computer storage medium, wherein, The computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded and executed by the processor.

19. An electronic device, comprising:

19. An electronic device, wherein, It includes: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded and executed by the processor to execute the method steps of any one of claims 1-16.