Method and device for printing express sheet, electronic equipment and computer readable storage medium
By generating page sheet data described in the printing language on the server and sending it to the printer, the problem of slow page sheet printing speed in the prior art is solved, fast printing is achieved and dependence on the browser is reduced.
Patent Information
- Application Number
- CN202311676022.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-07
- Publication Date
- 2025-06-10
AI Technical Summary
In the prior art, in the page sheet printing scheme that depends on browser capabilities, the rendering process of page sheet data takes a long time, resulting in a slow printing speed.
By obtaining the face sheet data of the face sheet to be printed, it is sent to the server to generate the face sheet data of the print language description, that is, the print description, and sending it to the printer, and the printer is controlled to print based on the print description.
It realizes fast printing of page sheets, improves printing speed, and no longer depends on the browser.
Smart Images

Figure CN120122897A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of printing technology. Specifically, it relates to the waybill printing technology in the field of printing technology. More specifically, it relates to a method, device, electronic device and computer-readable storage medium for printing waybills. Background Art
[0002] Desktop applications, also known as desktop software. This is a type of software used to manage the items placed on the desktop or to make the computer more convenient to use. For example, time calendars, desktop alarms, etc. With the continuous development of related technologies, the functions of desktop applications are no longer limited to the management of the computer desktop. More and more desktop applications with specific functions have been developed. For example, some desktop applications dedicated to printing waybills.
[0003] Currently, in the implementation solutions for printing waybills using desktop applications, most of them are implemented based on the capabilities provided by browsers. The printing process is as Figure 1 shown. After triggering printing in the desktop application, an interface is requested to obtain waybill data. Then, the waybill data is forwarded through the main process of the program, and then the waybill data is rendered into DOM (Document Object Model) elements. Finally, printing is initiated to print the waybill based on the DOM elements.
[0004] However, in the above printing solution that relies on browser capabilities, the rendering process of waybill data is essential and usually takes a long time, which causes the technical problem of slow printing speed. Summary of the Invention
[0005] To solve the above technical problems, this application provides a method, device, electronic device and computer-readable storage medium for printing waybills to improve the waybill printing speed and achieve the purpose of quickly printing waybills.
[0006] To achieve the above technical objectives, the embodiments of this application provide the following technical solutions:
[0007] In a first aspect, an embodiment of this application provides a method for printing a waybill, which is applied to a terminal device. The method for printing a waybill includes: obtaining the waybill data of the waybill to be printed; sending the waybill data to a server so that the server generates a print description of the waybill to be printed according to the waybill data and sends the print description to the terminal device; wherein, the print description is the waybill data described in a printing language; receiving the print description returned by the server and sending the print description to a printer so that the printer prints the waybill to be printed based on the print description.
[0008] Optionally, sending the waybill data to the server includes: calling the printing interface of the operating system of the terminal device through the bridging layer, and sending the print description to the printer, where the bridging layer is an intermediate layer between the application program and the operating system of the terminal device.
[0009] Optionally, calling the printing interface of the operating system of the terminal device through the bridging layer and sending the print description to the printer includes: creating a new process; in the new process, calling the printing interface of the operating system of the terminal device through the bridging layer and sending the print description to the printer.
[0010] In a second aspect, an embodiment of the present application provides a method for printing a waybill, which is applied to a server. The method for printing a waybill includes: receiving the waybill data of the waybill to be printed sent by the terminal device; generating a print description of the waybill to be printed based on the waybill data, where the print description is the waybill data described in a printing language; sending the print description to the terminal device so that the terminal device controls the printer to print the waybill to be printed based on the print description.
[0011] Optionally, before generating a print description of the waybill to be printed based on the waybill data, the method further includes: receiving the current print identifier sent by the terminal device; where the current print identifier is the printer identifier of the printer currently connected to the terminal device; generating a print description of the waybill to be printed based on the waybill data includes: in the case where the current print identifier is the target identifier, generating a print description of the waybill to be printed according to the waybill data; where the target identifier is the printer identifier of at least one pre-configured printer.
[0012] In a third aspect, an embodiment of the present application provides a device for printing a waybill, which is applied to a terminal device. The device for printing a waybill includes: a waybill acquisition module, configured to acquire the waybill data of the waybill to be printed; a waybill sending module, configured to send the waybill data to the server so that the server generates a print description of the waybill to be printed according to the waybill data and sends the print description to the terminal device; where the print description is the waybill data described in a printing language; a waybill printing module, configured to receive the print description returned by the server and send the print description to the printer so that the printer prints the waybill to be printed based on the print description.
[0013] In a fourth aspect, an embodiment of the present application provides a device for printing a waybill, which is applied to a server. The device for printing a waybill includes: a waybill receiving module, configured to receive the waybill data of the waybill to be printed sent by the terminal device; a print description module, configured to generate a print description of the waybill to be printed based on the waybill data, where the print description is the waybill data described in a printing language; a print description sending module, configured to send the print description to the terminal device so that the terminal device controls the printer to print the waybill to be printed based on the print description.
[0014] Fifth aspect, an embodiment of the present application provides an electronic device, including: a processor and a memory; wherein, the memory is connected to the processor, and the memory is used to store a computer program; the processor is used to implement the method for printing a shipping label as described in the first aspect or the second aspect by running the computer program stored in the memory.
[0015] Sixth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, the method for printing a shipping label as described in the above first aspect or second aspect is implemented.
[0016] Seventh aspect, an embodiment of the present application provides a computer program product or a computer program. The computer program product includes a computer program, and the computer program is stored in a computer-readable storage medium; a processor of a computer device reads the computer program from the computer-readable storage medium, and when the processor executes the computer program, the steps of the method for printing a shipping label as described in the first aspect or the second aspect are implemented.
[0017] For the method for printing a shipping label provided by the present application, after obtaining the shipping label data of the shipping label to be printed, the shipping label data described in the printing language, that is, the print description, is generated with the help of a server. Then, the print description is sent to a printer, and the printer is controlled to print the shipping label to be printed based on the print description. Since the printing language is the native language that the printer can recognize. Therefore, printing the shipping label to be printed according to the shipping label data described in the printing language is a very efficient way, which can achieve fast printing of the shipping label and no longer depends on a browser. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts.
[0019] Figure 1 It is a schematic flowchart of a method for printing a shipping label in the prior art;
[0020] Figure 2 It is one of the schematic flowcharts of a method for printing a shipping label provided by an embodiment of the present application;
[0021] Figure 3 It is a schematic diagram of a call chain for calling a printing interface under the Windows operating system provided by an embodiment of the present application;
[0022] Figure 4Schematic flowchart of batch printing of waybills to be printed provided by an embodiment of the present application;
[0023] Figure 5 Practical application schematic diagram of a method for printing waybills provided by an embodiment of the present application;
[0024] Figure 6 Second schematic flowchart of a method for printing waybills provided by an embodiment of the present application;
[0025] Figure 7 First structural block diagram of a device for printing waybills provided by an embodiment of the present application;
[0026] Figure 8 Second structural block diagram of a device for printing waybills provided by an embodiment of the present application;
[0027] Figure 9 Structural schematic diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0028] Unless otherwise defined, technical terms or scientific terms used in the embodiments of the present application shall have the ordinary meanings understood by those of ordinary skill in the art to which the present application pertains. The "first", "second" and similar terms used in the embodiments of the present application do not denote any order, quantity or importance, but are only used to avoid confusion of components.
[0029] Unless otherwise required by the context, throughout the specification, "a plurality of" means "at least two", and "including" is interpreted as open and inclusive, that is, "including, but not limited to". In the description of the specification, the terms "an embodiment", "some embodiments", "exemplary embodiments", "examples", "specific examples" or "some examples" etc. are intended to indicate that specific features, structures, materials or characteristics related to the embodiment or example are included in at least one embodiment or example of the present application. The schematic representations of the above terms do not necessarily refer to the same embodiment or example.
[0030] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0031] Exemplary method
[0032] An embodiment of the present application provides a method for printing a waybill, which is applied to a terminal device. The terminal device includes: a mobile phone, a laptop, a desktop computer, a smart wearable device, etc. This embodiment takes the application to a computer as an example for illustrative purposes. Among them, the method for printing the waybill can be executed through an application installed on the computer, but it is not limited thereto. As shown in Figure 2, the method for printing the waybill may include:
[0033] Step S201: Obtain the waybill data of the waybill to be printed.
[0034] In this step, the waybill to be printed is the waybill that needs to be printed. Among them, the waybill can be an express waybill, that is, a document used in the express industry to record relevant information such as the sender, recipient, and product weight and price during the process of transporting goods. It can be understood that in some scenarios, according to specific business requirements, a waybill that can meet the business requirements can be designed, and then the designed waybill can be printed and used in specific businesses. The waybill that can meet the business requirements during this process is the waybill to be printed. For example, when sending a certain express item, an express waybill containing information such as the recipient, sender, recipient address, and sender address is required. Correspondingly, this express waybill is the waybill to be printed. After it is designed and printed, it can be pasted on the express item to enter the subsequent logistics transportation link.
[0035] The waybill data is the data contained or required to be contained in the waybill to be printed, and can also be regarded as another representation of the waybill to be printed. For example, the recipient, sender, recipient address, sender address, etc. in the express waybill can all be regarded as waybill data. In the embodiment of the present application, the specific data content of the waybill data is not limited.
[0036] Step S202: Send the waybill data to the server so that the server generates a print description of the waybill to be printed according to the waybill data and sends the print description to the terminal device.
[0037] In this step, the server is an electronic device communicatively connected to the terminal device. The terminal device and the server can achieve data interaction through wired or wireless means. For example, both the terminal device and the server are connected to the Internet, so that the two can achieve data interaction through the Internet.
[0038] It should be noted that the print description is the label data described in the print language, that is, the print language representation of the label to be printed. That is to say, for a device that can recognize the print language, it can recognize the label data / the label to be printed from the print description and perform printing. Among them, the print language is the native language that the printer can recognize. For example, the print language can be ZPL (Zebra Printer Language), PCL (Printer Control Language), etc., but not limited to this.
[0039] In this embodiment, the server is integrated with a preset translation function, which can translate the data into the representation of the print language, that is, the data described in the print language. Here, the terminal device can obtain the print description of the label to be printed by means of the translation function of the server. Specifically, the terminal device can call the interface provided by the server, use the label data as a parameter of the request, and send it to the server together with the request. The server will generate the print description of the label to be printed in response to the request and return the print description to the terminal device.
[0040] Step S203: Receive the print description returned by the server and send the print description to the printer so that the printer prints the label to be printed based on the print description.
[0041] In this step, the terminal device is communicatively connected to the printer. Among them, the connection method between the terminal device and the printer can be a wired connection, a wireless connection or other connection methods, and the embodiments of the present application do not make any limitations in this regard. It can be understood that the terminal device can control the printer to perform printing by transmitting data to the printer. Since the print description is the label data described in the print language, the printer can quickly recognize the print description to obtain the label data and print the label to be printed according to the label data.
[0042] It should be noted that if the print description returned by the server is not received for a long time or other data returned by the server is received, and this other data indicates that the server fails to generate a print description according to the label data. At this time, the local printing function of the terminal device can be selected to implement the printing of the label to be printed. Among them, the process of using the local printing function of the terminal device to implement the printing of the label to be printed can be the same as that Figure 1 shown in the process, but not limited to this.
[0043] In the embodiments of the present application, after obtaining the waybill data of the waybill to be printed, the waybill data described in the printing language is generated with the help of the server, that is, the printing description. Then, the printing description is sent to the printer, and the printer is controlled to print the waybill to be printed based on the printing description. Since the printing language is the native language that the printer can recognize. Therefore, printing the waybill to be printed according to the waybill data described in the printing language is a very efficient method, which can realize the fast printing of the waybill and no longer depends on the browser.
[0044] In some embodiments, sending the waybill data to the server includes: calling the printing interface of the operating system of the terminal device through the bridging layer, and sending the printing description to the printer, where the bridging layer is the intermediate layer between the application program and the operating system of the terminal device.
[0045] It should be noted that the printing interface of the operating system, as the native interface at the bottom layer of the terminal device, is more convenient and efficient to use. Therefore, the printing interface of the operating system can be used to print the waybill to be printed. However, the printing interface of the operating system has fixed attributes and calling rules, and not all application programs installed on the terminal device can directly call the printing interface of the operating system. Therefore, in this embodiment, a bridging layer is built between the application program and the operating system, and the bridging layer is used to realize the calling of the printing interface of the operating system by the application program.
[0046] Specifically, the bridging layer is related to the operating system, and the bridging layers under different operating systems are not the same. Here, it only needs to be ensured that the bridging layer can communicate with the application program of the terminal device and the printing interface of the operating system respectively. For example, assume that the operating system of the terminal device is the Windows operating system, and a certain application program of the terminal device can execute the above method of printing the waybill. This application program can be an application program developed based on the front-end development framework Electron. In this case, Electron is mainly based on the JS (JavaScript) language, and the JS language does not have the ability to call the printing interface under the Windows operating system. However, the C / C++ language has the ability to directly call the printing interface under the Windows operating system. Therefore, the bridging layer can be written through Node-API. Among them, Node-API is also based on the C / C++ language. Then, the application program under Electron realizes the interaction with the C / C++ language with the help of Node-API, and realizes the calling of the printing interface under the Windows operating system with the help of the C / C++ language. Finally, the application program under Electron indirectly has the ability to call the printing interface under the Windows operating system. The call chain of this process is as Figure 3As shown in the figure. The client, as an application under Electron, has its main process in the Node.js environment, so that the bridging layer can be directly written by calling the Node-API in this environment. Then, the C / C++ function module is called through the bridging layer written with the Node-API, and finally, the ability of the C / C++ language to directly call the printing interface under the Windows operating system is utilized to achieve the call of the printing interface under the Windows operating system.
[0047] In the embodiment of the present application, the underlying native interface of the terminal device is called to participate in the printing task, making the entire printing process more convenient and efficient.
[0048] In some embodiments, the printing interface of the operating system of the terminal device is called through the bridging layer, and the print description is sent to the printer, including: creating a new process; in the new process, the printing interface of the operating system of the terminal device is called through the bridging layer, and the print description is sent to the printer.
[0049] It should be noted that the new process is different from the main process. It is another newly created process while the main process continues to exist. For example, when the method for printing a shipping label provided in this embodiment is executed through the target application, the main process is created in the terminal device to run the target application. When the printing interface needs to be called, a new process is created, and in the new process, the printing interface of the operating system of the terminal device is called through the bridging layer, and the print description is sent to the printer. Since the printing interfaces under some operating systems are synchronous blocking interfaces, directly calling such an interface will cause the main process to block. For example, the writePrinter interface under the Windows operating system is a synchronous blocking interface. If the application directly calls this interface, it will cause the main process to block, making the application unresponsive and showing the phenomenon of "freezing". Therefore, it is necessary to implement the call of the printing interface under the operating system in the new process.
[0050] In some embodiments, the printer itself supports a queue mechanism. When the number of shipping labels to be printed is large, it is only necessary to send the print descriptions of each shipping label to be printed to the printer. These print descriptions of the shipping labels to be printed form a queue in the printer, and the printer selects each print description in the queue based on its own queue mechanism to print the shipping labels to be printed. Specifically, when processing the printing of a batch of shipping labels to be printed, such as Figure 4As shown in the figure, the processing process includes: Step S401: Each bill of lading to be printed triggers a printing task respectively. Step S402: Through the main thread request interface, the bill of lading data is obtained for each bill of lading to be printed respectively. Step S403: The main process is continued to forward the bill of lading data of each bill of lading to be printed to the server, so that the server generates a print description for each bill of lading to be printed. Step S404: A new process is created, and in the new process, the print descriptions of each bill of lading to be printed are sent to the printing module. The printing module is a functional module corresponding to the native printing interface of the hardware device. Step S405: In the new process, the print descriptions of each bill of lading to be printed are transmitted to the printer queue. The printer prints the bills of lading to be printed indicated by the print descriptions in the printer queue based on the queue mechanism.
[0051] In the embodiment of the present application, by calling the printing interface of the operating system in the new process, the blockage caused by the printing interface can be avoided.
[0052] In order to ensure that the printer can recognize the print description returned by the server, in some embodiments of the present application, before sending the bill of lading data to the server, the method further includes: obtaining the current print identifier; wherein, the current print identifier is the printer identifier of the printer currently connected to the terminal device; sending the bill of lading data to the server, so that the server generates a print description of the bill of lading to be printed according to the bill of lading data, including: sending the current print identifier and the bill of lading data to the server, so that when the current print identifier is the target identifier, the server generates a print description of the bill of lading to be printed according to the bill of lading data; wherein, the target identifier is the printer identifier of at least one pre-configured printer.
[0053] It should be noted that the printer identifier includes but is not limited to the driver name of the printer driver. For example, it can also be the name, model, etc. of the printer. It can be understood that the printing languages of different printers are not the same. In order to ensure that the printer receiving the print description can recognize the print description, it is necessary for the server to generate a print description that the printer can recognize according to the bill of lading data. That is, it is necessary for the server to adapt to the printer / printing language. However, the more printers / printing languages the server adapts to, the more complex the server is and the greater the pressure is. Therefore, only a small number of printers / printing languages can be adapted in the server. In this embodiment, the printer identifiers of the printers adapted by the server can be stored in a fixed storage location of the server in advance. When a print description needs to be generated, the printer identifier in the fixed storage location is used to determine whether the printer currently connected to the terminal device has been adapted in the server. Only for the printers that have been adapted, a print description is generated. In some embodiments, printers with strong versatility or wide use can be adapted in the server. The printer identifiers of these printers are stored in the server as the target identifier.
[0054] In the embodiments of the present application, a print description is generated only for the printers adapted in the server, so as to ensure that the printers can recognize the print description returned by the server.
[0055] In some embodiments of the present application, obtaining the waybill data of the waybill to be printed includes: receiving the target input of the user on the waybill printing page; in response to the target input, determining each constituent element of the waybill to be printed and the attribute information of each constituent element, and determining the constituent elements and the attribute information of each constituent element as the waybill data of the waybill to be printed.
[0056] It should be noted that the target input includes inputs such as clicking, swiping, and long pressing, but is not limited thereto. When executing the method for printing a waybill provided in this embodiment through the application installed on the terminal device, the waybill printing page is the page in the application for receiving waybill data. The constituent elements of the waybill to be printed are the elements that make up the waybill to be printed. For example, recipient information, sender information, recipient address information, sender address information, boxes, barcodes, etc., but are not limited thereto. The attribute information includes the coordinates, data type, font, color, paragraph format, etc. of the element, and is also not limited thereto.
[0057] In one embodiment, the waybill printing page includes a plurality of page elements, and each page element corresponds to a constituent element of the waybill to be printed. The user can input specific data in the page element. The application determines the input data as each constituent element of the waybill to be printed and the attribute information of each constituent element.
[0058] In the embodiments of the present application, the user can determine the waybill data of the waybill to be printed according to their actual needs, improving the flexibility of waybill printing.
[0059] See Figure 5 , which is a schematic diagram of the actual application of the method for printing a waybill provided in the embodiments of the present application. Among them, the parties involved in the printing process are the user, the client, the Node-API module, the C / C++ module, and the printer respectively. The client is a desktop application installed on the terminal device, and it is an application program developed based on the front-end development framework Electron. The operating system of the terminal device is the Windows operating system. The Node-API module is a bridging layer implemented based on Node-API, and the C / C++ module can directly access the native interfaces of the Windows operating system.
[0060] After the user triggers printing, the client will call the cloud printing instruction interface and send the waybill data of the waybill to be printed to the cloud printing platform. The cloud printing platform is equivalent to the server in the above embodiments, can generate the print description of the waybill to be printed, and the generation process is the same, which will not be elaborated here. It can be understood that the print description can be the waybill data described by ZPL, and can also be called a printing instruction. For example, the print description can be: ^MMT; ^CW0,E:MHEIGB18.TTF; ^CI26; ^CF0^FS; ^LH0,0; ^PW596, etc. The explanations of each statement in the print description are: set the label rotation mode to "rotate 90 degrees"; set not to perform a cleaning operation; set the character set to ISO-8859-1; clear the current font format setting; set the origin coordinates of the printing position to the upper left corner (0,0); set the printing width to 596 units.
[0061] After the client receives the printing instruction from the cloud printing platform, it starts a new process, and in the new process, calls the printing interface of the operating system through the bridging layer to send the printing instruction to the printer. The printer prints based on the received printing instruction and returns a prompt of successful printing to the user after printing is completed.
[0062] In the embodiments of the present application, by introducing the Node-API module and the C / C++ module to call the underlying printing interface of the Windows operating system, the printing efficiency and stability can be improved. At the same time, printing supporting facilities can be integrated, including online / offline status, printing preferences, etc. Further, combined with the printer language ZPL instruction, the waybill offset problem can be optimized.
[0063] As Figure 6 shown, the embodiments of the present application also provide a method for printing a waybill, which is applied to a server. The method for printing a waybill includes:
[0064] Step S601: Receive the waybill data of the waybill to be printed sent by the terminal device.
[0065] Step S602: Generate a print description of the waybill to be printed based on the waybill data, where the print description is the waybill data described by the printing language.
[0066] Step S603: Send the print description to the terminal device so that the terminal device controls the printer to print the waybill to be printed based on the print description.
[0067] It should be noted that for the terminal device, the waybill to be printed, the waybill data, and the print description, reference can be made to the relevant descriptions in the embodiments of the method for printing a waybill applied to the terminal device above. This will not be elaborated here. It should be noted that this embodiment is the execution process on the server side during the process of printing a waybill.
[0068] In the embodiments of the present application, after receiving the waybill data of the waybill to be printed, waybill data described in the printing language is generated, that is, the printing description. Then, the printing description is sent to the terminal device, so that the printer prints the waybill to be printed based on the printing description. Since the printing language is the native language that the printer can recognize. Therefore, printing the waybill to be printed according to the waybill data described in the printing language is a very efficient way, which can achieve the fast printing of the waybill and no longer depends on the browser.
[0069] In some embodiments of the present application, in order to ensure that the printer can recognize the printing description returned by the server, before generating the printing description of the waybill to be printed based on the waybill data, the method further includes: receiving a current printing identifier sent by the terminal device; wherein, the current printing identifier is the printer identifier of the printer currently connected to the terminal device; generating the printing description of the waybill to be printed based on the waybill data, including: when the current printing identifier is the target identifier, generating the printing description of the waybill to be printed according to the waybill data; wherein, the target identifier is the printer identifier of at least one printer pre-configured.
[0070] It should be noted that the printer identifier includes but is not limited to the driver name of the printer driver. For example, it can also be the name, model, etc. of the printer. It can be understood that the printing languages of different printers are not the same. To ensure that the printer receiving the printing description can recognize the printing description, it is necessary for the server to generate the printing description that the printer can recognize according to the waybill data. That is, it is necessary for the server to adapt to the printer / printing language. However, the more printers / printing languages the server adapts to, the more complex the server is and the greater the pressure is. Therefore, only a small number of printers / printing languages can be adapted in the server. In this embodiment, the printer identifiers of the printers adapted by the server can be pre-stored in a fixed storage location of the server. When generating the printing description, use the printer identifiers in this fixed storage location to determine whether the printer currently connected to the terminal device has been adapted in the server. Only for the printers that have been adapted, generate the printing description. In some embodiments, printers with strong generality or wide use can be adapted in the server. The printer identifiers of these printers are stored in the server as the target identifier.
[0071] In the embodiments of the present application, the printing description is only generated for the printers adapted in the server, so as to ensure that the printer can recognize the printing description returned by the server.
[0072] Regarding the feasible execution manners and possible beneficial effects of the methods in the terminal device and the server, reference can be made to the relevant descriptions in the embodiments of the method for printing a waybill applied to the terminal device and the method for printing a waybill applied to the server above, which will not be elaborated here.
[0073] Exemplary device
[0074] Some embodiments of the present application further provide a device for printing waybills, which is applied to a terminal device, such as Figure 7 As shown, the device for printing waybills includes: a waybill acquisition module 71, configured to acquire waybill data of a waybill to be printed; a waybill sending module 72, configured to send the waybill data to a server, so that the server generates a print description of the waybill to be printed according to the waybill data, and sends the print description to the terminal device; wherein, the print description is the waybill data described in a printing language; a waybill printing module 73, configured to receive the print description returned by the server, and send the print description to a printer, so that the printer prints the waybill to be printed based on the print description.
[0075] In some embodiments, the waybill sending module 72 is specifically configured to call a print interface of the operating system of the terminal device through a bridging layer, and send the print description to the printer, wherein the bridging layer is an intermediate layer between an application program of the terminal device and the operating system.
[0076] In some embodiments, the waybill sending module 72 is specifically configured to: create a new process; and in the new process, call a print interface of the operating system of the terminal device through a bridging layer, and send the print description to the printer.
[0077] In some embodiments, the device further includes: an identification acquisition module, configured to acquire a current print identification; wherein, the current print identification is a printer identification of a printer currently connected to the terminal device; the waybill sending module 72 is specifically configured to send the current print identification and the waybill data to the server, so that the server generates a print description of the waybill to be printed according to the waybill data when the current print identification is a target identification; wherein, the target identification is a printer identification of at least one pre-configured printer.
[0078] In some embodiments, the waybill acquisition module 71 is specifically configured to: receive a target input of a user on a waybill printing page; in response to the target input, determine each constituent element of the waybill to be printed and attribute information of each constituent element, and determine the each constituent element and the attribute information of each constituent element as the waybill data of the waybill to be printed.
[0079] The device for printing waybills provided by the embodiments of the present application belongs to the same inventive concept as the method for printing waybills applied to a terminal device provided by the above embodiments of the present application. For technical details not described in detail in this embodiment, reference may be made to the specific processing content of the method for printing waybills applied to a terminal device provided by the above embodiments of the present application, which will not be elaborated herein.
[0080] Some embodiments of the present application further provide a device for printing waybills, which is applied to a server, such as Figure 8As shown in the figure, the device for printing a shipping label includes: a label receiving module 81 for receiving label data of a to-be-printed label sent by a terminal device; a print description module 82 for generating a print description of the to-be-printed label based on the label data, where the print description is label data described in a print language; and a print description sending module 83 for sending the print description to the terminal device so that the terminal device controls a printer to print the to-be-printed label based on the print description.
[0081] In some embodiments, the device further includes: an identification receiving module for receiving a current print identification sent by the terminal device; where the current print identification is a printer identification of a printer currently connected to the terminal device; and the print description module 82 is specifically configured to generate a print description of the to-be-printed label according to the label data when the current print identification is a target identification; where the target identification is a printer identification of at least one pre-configured printer.
[0082] The device for printing a shipping label provided in the embodiments of the present application belongs to the same inventive concept as the method for printing a shipping label applied to a server provided in the above embodiments of the present application. Technical details not described in detail in this embodiment can be seen in the specific processing content of the method for printing a shipping label applied to a server provided in the above embodiments of the present application, and will not be elaborated here.
[0083] Exemplary electronic device
[0084] Another embodiment of the present application also proposes an electronic device. See Figure 9 As shown in the figure, an exemplary embodiment of the present application also provides an electronic device, including: a memory and a processor, where the memory stores a computer program, and the processor executes the steps in the method for printing a shipping label according to various embodiments of the present application described in the above embodiments of the present application when executing the computer program.
[0085] The internal structure of the electronic device can be as Figure 9 As shown in the figure, the electronic device includes a processor, a memory, a network interface, and an input device connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal through a network connection. The computer program, when executed by the processor, performs the steps in the method for printing a shipping label according to various embodiments of the present application described in the above embodiments of the present application.
[0086] The processor may include a main processor and may also include a baseband chip, a modem, etc.
[0087] The memory stores a program for implementing the technical solution of the present invention, and may also store an operating system and other key services. Specifically, the program may include program code, and the program code includes computer operation instructions. More specifically, the memory may include a read-only memory (ROM), other types of static storage devices that can store static information and instructions, a random access memory (RAM), other types of dynamic storage devices that can store information and instructions, a disk memory, flash, and so on.
[0088] The processor may be a general-purpose processor, such as a general-purpose central processing unit (CPU), a microprocessor, etc., or an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present invention solution. It may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0089] The input device may include a device for receiving user input data and information, such as a keyboard, a mouse, a camera, a scanner, a light pen, a voice input device, a touch screen, a pedometer or a gravity sensor, etc.
[0090] The output device may include a device for allowing output of information to the user, such as a display screen, a printer, a speaker, etc.
[0091] The communication interface may include a device using any transceiver type, so as to communicate with other devices or communication networks, such as Ethernet, a radio access network (RAN), a wireless local area network (WLAN), etc.
[0092] The processor executes the program stored in the memory and calls other devices, which can be used to implement each step of any one of the methods for printing a shipping label provided in the above embodiments of the present application.
[0093] The electronic device may further include a display component and a voice component. The display component may be a liquid crystal display screen or an electronic ink display screen. The input device of the electronic device may be a touch layer covering the display component, or a button, a trackball or a touchpad provided on the housing of the electronic device, or an external keyboard, a touchpad or a mouse, etc.
[0094] Those skilled in the art can understand, Figure 9The structure shown is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the electronic device to which the solution of this application is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0095] Exemplary computer program product and storage medium
[0096] In addition to the above methods and devices, the method for printing shipping labels provided by the embodiments of this application may also be a computer program product, which includes computer program instructions. When the computer program instructions are run by a processor, the processor is caused to execute the steps in the method for printing shipping labels according to various embodiments of this application described in the "Exemplary Method" section above.
[0097] The computer program product can be written in any combination of one or more programming languages for the program code to perform the operations of the embodiments of this application. The programming languages include object-oriented programming languages such as Java, C++, etc., and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, executed as an independent software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0098] In addition, the embodiments of this application also provide a computer-readable storage medium, on which a computer program is stored. The computer program is executed by a processor to perform the steps in the method for printing shipping labels according to various embodiments of this application described in the "Exemplary Method" section above.
[0099] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the embodiments provided in the present application can include non-volatile and / or volatile memories. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.
[0100] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered to be within the scope recorded in the present application.
[0101] The above embodiments only represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the solutions provided by the embodiments of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.
Claims
1. A method for printing a shipping label, characterized in that, applied to a terminal device, the method for printing a shipping label includes: Obtaining the label data of the shipping label to be printed; Sending the label data to a server so that the server generates a print description of the shipping label to be printed according to the label data and sends the print description to the terminal device; wherein, the print description is the label data described in a printing language; Receiving the print description returned by the server and sending the print description to a printer so that the printer prints the shipping label to be printed based on the print description.
2. The method according to claim 1, characterized in that, Sending the label data to the server includes: Calling the printing interface of the operating system of the terminal device through a bridging layer and sending the print description to the printer, wherein the bridging layer is an intermediate layer between the application program of the terminal device and the operating system.
3. The method according to claim 2, characterized in that, The step of calling the printing interface of the operating system of the terminal device through the bridging layer and sending the print description to the printer includes: Creating a new process; In the new process, calling the printing interface of the operating system of the terminal device through the bridging layer and sending the print description to the printer.
4. The method according to claim 1, characterized in that, Before sending the label data to the server, the method further includes: Obtaining the current print identifier; wherein, the current print identifier is the printer identifier of the printer currently connected to the terminal device; The step of sending the label data to the server so that the server generates a print description of the shipping label to be printed according to the label data includes: Sending the current print identifier and the label data to the server so that the server generates a print description of the shipping label to be printed according to the label data when the current print identifier is a target identifier; wherein, the target identifier is the printer identifier of at least one pre-configured printer.
5. The method according to claim 1, characterized in that, Obtaining the label data of the shipping label to be printed includes: Receiving a target input from a user on a shipping label printing page; In response to the target input, determining each constituent element of the shipping label to be printed and the attribute information of each constituent element, and determining each constituent element and the attribute information of each constituent element as the label data of the shipping label to be printed.
6. A method for printing a shipping label, characterized in that, applied to a server, the method for printing a shipping label includes: Receiving the label data of the shipping label to be printed sent by a terminal device; Generating a print description of the shipping label to be printed based on the label data, wherein the print description is the label data described in a printing language; Sending the print description to the terminal device so that the terminal device controls the printer to print the shipping label to be printed based on the print description.
7. The method according to claim 6, characterized in that, Before generating a print description of the shipping label to be printed based on the label data, the method further includes: Receive the current print identifier sent by the terminal device; wherein, the current print identifier is the printer identifier of the printer currently connected to the terminal device; Generate a print description of the waybill to be printed based on the waybill data, including: When the current print identifier is the target identifier, generate a print description of the waybill to be printed according to the waybill data; Wherein, the target identifier is the printer identifier of at least one pre-configured printer.
8. A device for printing waybills Characterized in that Applied to a terminal device, the device for printing waybills includes: A waybill acquisition module, configured to acquire waybill data of a waybill to be printed; A waybill sending module, configured to send the waybill data to a server, so that the server generates a print description of the waybill to be printed according to the waybill data, and send the print description to the terminal device; wherein, the print description is the waybill data described in a printing language; A waybill printing module, configured to receive the print description returned by the server, and send the print description to a printer, so that the printer prints the waybill to be printed based on the print description.
9. A device for printing waybills Characterized in that Applied to a server, the device for printing waybills includes: A waybill receiving module, configured to receive waybill data of a waybill to be printed sent by a terminal device; A print description module, configured to generate a print description of the waybill to be printed based on the waybill data, wherein the print description is the waybill data described in a printing language; A print description sending module, configured to send the print description to the terminal device, so that the terminal device controls a printer to print the waybill to be printed based on the print description.
10. An electronic device Characterized in that Includes: A processor and a memory; Wherein, the memory is connected to the processor, and the memory is used to store a computer program; The processor is configured to implement the method for printing waybills according to any one of claims 1 to 7 by running the computer program stored in the memory.
11. A computer-readable storage medium Characterized in that A computer program is stored on the computer-readable storage medium, and when the computer program is run by a processor, the method for printing waybills according to any one of claims 1 to 7 is implemented.