Method, device, electronic device and computer-readable medium for printing documents
By querying the print file record table and generating a session identifier or a uniform resource locator, the problem of high development cost in the prior art is solved, and the decoupling of file printing and business functions and the satisfaction of user personalized needs are achieved.
Patent Information
- Application Number
- CN202210320670.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-29
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2042-03-29
AI Technical Summary
The existing printing mode is implemented by each business segment according to business needs, which results in high development costs and difficulty in unified management of file printing and installation modes.
By receiving a print request, querying the print file record table according to the business serial number, determining whether the business serial number exists, obtaining the session identifier if it exists, and if not, obtaining the data to be printed and generating a file according to the installation mode and the preset printing mode, generating a session identifier or a uniform resource locator, and realizing dynamic configuration of the installation mode and the printing mode.
It reduces development costs, decouples document printing from business functions, meets user personalized needs, and implements multiple printing modes and installation modes through a unified printing method.
Smart Images

Figure CN114721609B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of big data intelligent analysis, and in particular to a method, device, electronic device and computer-readable medium for printing documents. Background Art
[0002] Currently, document printing methods typically utilize a single printing mode and a secondary printing mode. For example, during provident fund transactions, there are many scenarios where business vouchers need to be printed, and some of these vouchers require secondary printing with features like CA signatures and watermarks. Implementing this functionality separately for each business module would result in high development costs and hinder unified voucher management.
[0003] In the process of implementing the present invention, the inventors discovered that the prior art has at least the following problems:
[0004] The existing printing mode is implemented by each business unit according to business needs, and the corresponding printing mode and secondary installation mode are implemented separately. Developers often need to repeatedly develop corresponding functions, and there is a lack of a unified method to print files, making it difficult to manage file printing and installation modes. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a method, apparatus, electronic device, and computer-readable medium for printing a file to solve the technical problem of high development costs.
[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for printing a file is provided, comprising:
[0007] Receive a print request, wherein the input parameters of the print request include a service serial number and an installation mode;
[0008] querying a print file record table according to the service serial number to determine whether the service serial number exists in the print file record table; if so, obtaining a session identifier corresponding to the service serial number from the print file record table; if not, obtaining data to be printed, generating a file according to the installation mode and a preset printing mode, and thereby generating a session identifier or a uniform resource locator corresponding to the file;
[0009] Return the session identifier or the uniform resource locator.
[0010] Optionally, if the installation mode is selected from one of the following:
[0011] Watermark mode, stamp mode, watermark and stamp mode;
[0012] Then, the data to be printed is obtained, and a file is generated according to the installation mode and the preset printing mode, thereby generating a session identifier corresponding to the file, including:
[0013] Acquiring data to be printed according to the business serial number, thereby generating a file according to the installation mode and the preset printing mode;
[0014] The file is stored locally, and the storage address of the file is written into the session, thereby generating a session identifier corresponding to the storage address of the file.
[0015] Optionally, after writing the storage address of the file into the session to generate a session identifier, the method further includes:
[0016] The service sequence number, the session identifier and the current timestamp are written into the print file record table.
[0017] Optionally, obtaining the data to be printed according to the business serial number, thereby generating a file according to the installation mode and the preset printing mode, includes:
[0018] Acquire the storage address of the data to be printed according to the business serial number, thereby acquiring the data to be printed;
[0019] generating a file according to a preset printing mode and the data to be printed;
[0020] Performing installation processing on the file according to the installation mode;
[0021] The additional installation process includes one of the following:
[0022] Add watermark, stamp, add watermark and stamp.
[0023] Optionally, performing installation processing on the file according to the installation mode includes:
[0024] Querying the print file record table according to the business serial number to determine whether the business serial number exists in the print file record table;
[0025] If so, obtaining the session identifier corresponding to the business serial number from the print file record table;
[0026] If not, the file is installed according to the installation mode.
[0027] Optionally, if the installation mode is a signature mode;
[0028] Then, the data to be printed is obtained, and a file is generated according to the installation mode and the preset printing mode, thereby generating a uniform resource locator corresponding to the file, including:
[0029] Acquiring the data to be printed according to the business serial number, thereby generating a file according to a preset printing mode;
[0030] Call the signature interface, the input parameter of the signature interface is the file;
[0031] Receive the uniform resource locator returned by the signature interface.
[0032] Optionally, if the installation mode is empty;
[0033] Then, the data to be printed is obtained, and a file is generated according to the installation mode and the preset printing mode, thereby generating a session identifier corresponding to the file, including:
[0034] Acquiring the data to be printed according to the business serial number, thereby generating a file according to a preset printing mode;
[0035] Storing the file locally;
[0036] The storage address of the file is written into the session, thereby generating a session identifier corresponding to the storage address of the file.
[0037] Optionally, the preset printing mode is flash mode or PDF mode.
[0038] In addition, according to another aspect of an embodiment of the present invention, there is provided an apparatus for printing a document, comprising:
[0039] A receiving module, configured to receive a print request, wherein the input parameters of the print request include a service serial number and an installation mode;
[0040] a printing module, configured to query a print file record table according to the service serial number and determine whether the service serial number exists in the print file record table; if so, obtain a session identifier corresponding to the service serial number from the print file record table; if not, obtain data to be printed, generate a file according to the installation mode and a preset printing mode, and thereby generate a session identifier or a uniform resource locator corresponding to the file;
[0041] The returning module is configured to return the session identifier or the uniform resource locator.
[0042] Optionally, if the installation mode is selected from one of the following:
[0043] Watermark mode, stamp mode, watermark and stamp mode;
[0044] Then the printing module is further used for:
[0045] Acquiring data to be printed according to the business serial number, thereby generating a file according to the installation mode and the preset printing mode;
[0046] The file is stored locally, and the storage address of the file is written into the session, thereby generating a session identifier corresponding to the storage address of the file.
[0047] Optionally, the printing module is further used to:
[0048] The storage address of the file is written into the session to generate a session identifier, and then the service sequence number, the session identifier and the current timestamp are written into the print file record table.
[0049] Optionally, the printing module is further used to:
[0050] Acquire the storage address of the data to be printed according to the business serial number, thereby acquiring the data to be printed;
[0051] generating a file according to a preset printing mode and the data to be printed;
[0052] Performing installation processing on the file according to the installation mode;
[0053] The additional installation process includes one of the following:
[0054] Add watermark, stamp, add watermark and stamp.
[0055] Optionally, the printing module is further used to:
[0056] Querying the print file record table according to the business serial number to determine whether the business serial number exists in the print file record table;
[0057] If so, obtaining the session identifier corresponding to the business serial number from the print file record table;
[0058] If not, the file is installed according to the installation mode.
[0059] Optionally, if the installation mode is a signature mode;
[0060] Then the printing module is further used for:
[0061] Acquiring the data to be printed according to the business serial number, thereby generating a file according to a preset printing mode;
[0062] Call the signature interface, the input parameter of the signature interface is the file;
[0063] Receive the uniform resource locator returned by the signature interface.
[0064] Optionally, if the installation mode is empty;
[0065] Then the printing module is further used for:
[0066] Acquiring the data to be printed according to the business serial number, thereby generating a file according to a preset printing mode;
[0067] Storing the file locally;
[0068] The storage address of the file is written into the session, thereby generating a session identifier corresponding to the storage address of the file.
[0069] Optionally, the preset printing mode is flash mode or PDF mode.
[0070] According to another aspect of an embodiment of the present invention, there is further provided an electronic device, including:
[0071] one or more processors;
[0072] a storage device for storing one or more programs,
[0073] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any one of the above embodiments.
[0074] According to another aspect of the embodiments of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in any one of the above embodiments is implemented.
[0075] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the method described in any one of the above embodiments is implemented.
[0076] One embodiment of the above invention has the following advantages or beneficial effects: by querying the print file record table based on the business sequence number to determine whether the business sequence number exists in the print file record table; if so, obtaining the session identifier from the print file record table; if not, obtaining the data to be printed and generating the file according to the installation mode and the preset printing mode, thereby generating the session identifier or uniform resource locator, the technical problem of high development costs in the prior art is overcome. This embodiment of the present invention implements file printing and secondary installation by dynamically configuring the installation mode and the printing mode. Each business module only needs to call a unified printing method and configure the corresponding parameters to achieve the corresponding requirements, meeting the personalized needs of users. This not only reduces development costs but also decouples file printing from business functions.
[0077] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work. Among them:
[0079] Figure 1 is a schematic diagram of the main process of a method for printing a file according to a first embodiment of the present invention;
[0080] Figure 2 is a schematic diagram of the main process of a method for printing a file according to a second embodiment of the present invention;
[0081] Figure 3 is a schematic diagram of the main process of a method for printing a file according to a third embodiment of the present invention;
[0082] Figure 4 is a schematic diagram of main modules of an apparatus for printing a document according to an embodiment of the present invention;
[0083] Figure 5 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
[0084] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0085] The following description of exemplary embodiments of the present invention is made in conjunction with the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding. These details should be considered as merely exemplary. Therefore, it should be appreciated by those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0086] The acquisition, storage, use, and processing of data in this application's technical solution comply with relevant national laws and regulations.
[0087] Figure 1 FIG. 1 is a schematic diagram of the main process of the method for printing a file according to the first embodiment of the present invention. As an embodiment of the present invention, Figure 1 As shown, the method for printing a file may include:
[0088] Step 101: Receive a print request, where the input parameters of the print request include a service serial number and an installation mode.
[0089] First, a print request from the front end is received, wherein the input parameters of the print request include at least a business serial number and an installation mode, so that file printing can be realized through the business serial number and the installation mode in subsequent steps.
[0090] Step 102 , querying the print file record table according to the business serial number to determine whether the business serial number exists in the print file record table; if so, executing step 103 ; if not, executing step 104 .
[0091] In this step, the print file record table is queried according to the service serial number to determine whether the service serial number exists in the print file record table; wherein the print file record table stores each service serial number and its corresponding session identifier and storage timestamp.
[0092] Step 103: Obtain the session identifier corresponding to the service serial number from the print file record table.
[0093] If the business serial number in the print request input parameter exists in the print file record table, the session ID corresponding to the business serial number is directly obtained from the print file record table. Optionally, if there are multiple session IDs corresponding to the business serial number in the print file record table, the session ID with the most recent timestamp is obtained so that the front-end displays the most recent file.
[0094] It should be pointed out that if the business serial number in the print request input parameter exists in the print file record table, it means that the file has been printed. In order to avoid duplicate printing, the front end can directly obtain the printed file for display.
[0095] Step 104 : acquiring data to be printed, generating a file according to the installation mode and the preset printing mode, and thereby generating a session identifier or uniform resource locator corresponding to the file.
[0096] If the business serial number in the print request input parameter does not exist in the print file record table, it means that the file has not been printed yet. Therefore, it is necessary to obtain the data to be printed based on the business serial number, and then generate a file based on the installation mode in the print request input parameter and the pre-configured print mode. Then, a session identifier or uniform resource locator (URL) corresponding to the file is generated. Optionally, the pre-configured print mode is Flash mode or PDF mode, and the business personnel can configure the print mode as needed.
[0097] In the embodiment of the present invention, different processing methods are used for different installation modes. The installation mode can be configured when initiating a print request or when developing a business, and the embodiment of the present invention does not limit this.
[0098] If the installation mode is selected from one of the following: watermark mode, seal mode, watermark and seal mode; then step 104 may include: obtaining the data to be printed according to the business serial number, thereby generating a file according to the installation mode and the preset printing mode; storing the file locally, writing the storage address of the file into the session, thereby generating a session identifier corresponding to the storage address of the file. If the installation mode in the print request input parameter is one of the watermark mode, seal mode, watermark and seal mode, then obtaining the data to be printed according to the business serial number in the print request input parameter, then generating a file according to the loading mode and the preset printing mode (such as flash mode or PDF mode), then storing the generated file locally on the server, and finally writing the storage address of the file into the session, thereby generating a session identifier (session ID) corresponding to the file.
[0099] Optionally, after writing the storage address of the file into the session to generate a session identifier, the method further includes writing the service serial number, the session identifier, and the current timestamp into a print file record table. To avoid duplicate printing of files, the service serial number, the session identifier, and the current timestamp (i.e., the timestamp at which the service serial number and session identifier are written into the print file record table) may be written into the print file record table to facilitate querying whether the file has been printed.
[0100] Optionally, obtaining the data to be printed based on the service serial number, thereby generating a file based on the installation mode and a preset printing mode, includes: obtaining the storage address of the data to be printed based on the service serial number, thereby obtaining the data to be printed; generating a file based on the preset printing mode and the data to be printed; and performing installation processing on the file based on the installation mode; wherein the installation processing includes one of the following: adding a watermark, stamping, or adding a watermark and stamping. Generally speaking, the backend stores the data to be printed locally on the server and stores the storage address of the data to be printed in the session. Therefore, the storage address of the data to be printed can be obtained from the session based on the service serial number, thereby obtaining the data to be printed based on the storage address. A PDF file is then generated based on a preset printing mode (e.g., PDF mode), and finally, the PDF file is subjected to installation processing based on the installation mode. For example, if the installation mode is to add a watermark, a watermark is added to the PDF file; if the installation mode is to stamp, a stamp is stamped on the PDF file; and if the installation mode is to both watermark and stamp, a watermark and a stamp are added to the PDF file.
[0101] If the installation mode is the signature mode; then step 104 may include: obtaining the data to be printed according to the business serial number, thereby generating a file according to the preset printing mode; calling the signature interface, the input parameter of the signature interface is the file; receiving the uniform resource locator returned by the signature interface. In an embodiment of the present invention, if the installation mode is the signature mode, it is implemented by calling a third-party interface. Specifically, the storage address of the data to be printed is obtained from the session according to the business serial number, thereby obtaining the data to be printed according to the storage address, and then generating a PDF file according to the preset printing mode (such as PDF mode), and then calling the signature interface provided by the third party, calling the interface with the input parameter of the PDF file, and finally receiving the URL returned by the signature interface. It should be pointed out that after the third party receives the signature request through the signature interface, it will sign the file and store the processed file in the URL for front-end loading.
[0102] If the loading mode is empty, step 104 may include: obtaining the data to be printed based on the service sequence number, thereby generating a file according to a preset printing mode; storing the file locally; and writing the storage address of the file into the session, thereby generating a session identifier corresponding to the storage address of the file. In an embodiment of the present invention, if the loading mode is empty, the storage address of the data to be printed is obtained from the session based on the service sequence number, thereby obtaining the data to be printed based on the storage address, then generating a PDF file according to a preset printing mode (such as PDF mode), then storing the generated PDF file locally on the server, and finally writing the storage address of the file into the session, thereby generating a session identifier corresponding to the PDF file. Optionally, after writing the storage address of the file into the session, thereby generating a session identifier, the process further includes: writing the service sequence number, the session identifier, and the current timestamp into a print file record table. To avoid duplicate printing of files, the service sequence number, session identifier, and current timestamp (i.e., the timestamp when the service sequence number and session identifier are written into the print file record table) may be written into the print file record table, thereby facilitating querying whether the file has been printed.
[0103] Step 105: Return the session identifier or the uniform resource locator.
[0104] After the session identifier or uniform resource locator is generated, the session identifier or uniform resource locator is returned to the front end, and the front end obtains the corresponding file according to the session identifier or uniform resource locator for display.
[0105] The method provided by the embodiment of the present invention can be encapsulated as an openWin method, and the front end calls the openWin method to implement the technical solution of the present application. The embodiment of the present invention can integrate multiple printing modes and installation modes. After development is completed, each business module only needs to configure parameters to meet the corresponding requirements without affecting the original business module code.
[0106] Based on the various embodiments described above, it can be seen that the embodiments of the present invention query the print file record table based on the business sequence number to determine whether the print file record table contains the business sequence number; if so, obtain the session identifier from the print file record table; if not, obtain the data to be printed, generate the file according to the installation mode and the preset printing mode, and thus generate the session identifier or uniform resource locator. This technical means solves the technical problem of high development costs in the prior art. The embodiments of the present invention implement file printing and secondary installation by dynamically configuring the installation mode and the printing mode. Each business module only needs to call a unified printing method and configure the corresponding parameters to achieve the corresponding requirements and meet the personalized needs of users. This not only reduces development costs but also decouples file printing from business functions.
[0107] Figure 2 Schematic diagram of the main process of the method for printing a file according to the second embodiment of the present invention. As another embodiment of the present invention, Figure 2 As shown, the method for printing a file may include:
[0108] Step 201: Receive a print request, where the input parameters of the print request include a service serial number and an installation mode.
[0109] Step 202, query the print file record table according to the business serial number to determine whether the print file record table contains the business serial number; if so, execute step 203; if not, execute step 204, step 207 or step 210.
[0110] The print file record table stores each service serial number and its corresponding session identifier and storage timestamp. The print file record table is queried to determine whether the service serial number and its corresponding session identifier and storage timestamp in the print request input parameter already exist.
[0111] Step 203: Obtain the session identifier corresponding to the service serial number from the print file record table.
[0112] If the print request input parameter contains the business serial number in the print file record table, it means that the file has already been printed. To avoid duplicate printing, you can directly obtain the session ID corresponding to the business serial number from the print file record table. It should be noted that if the print file record table contains multiple session IDs corresponding to the business serial number, the session ID with the most recent timestamp is obtained so that the front-end displays the most recent file.
[0113] If the installation mode is selected from the following: watermark mode, seal mode, watermark and seal mode, then execute steps 204-206. If the installation mode is signature mode, then execute steps 207-209. If the installation mode is empty, then execute step 210.
[0114] Step 204: Acquire the data to be printed according to the business serial number, thereby generating a file according to the installation mode and the preset printing mode.
[0115] Optionally, step 204 may include: obtaining the storage address of the data to be printed based on the service serial number, thereby obtaining the data to be printed; generating a file based on a preset printing mode and the data to be printed; and performing installation processing on the file based on the installation mode; wherein the installation processing includes one of the following: adding a watermark, stamping, or adding a watermark and stamping. The backend stores the data to be printed locally on the server and stores the storage address of the data to be printed in the session. Therefore, the storage address of the data to be printed can be obtained from the session based on the service serial number, thereby obtaining the data to be printed based on the storage address. The file is then generated based on the preset printing mode, and finally, the file is installed based on the installation mode. For example, if the installation mode is adding a watermark, the file is watermarked; if the installation mode is stamping, the file is stamped; if the installation mode is watermark and stamping, the file is watermarked and stamped.
[0116] Optionally, the file is subjected to installation processing according to the installation mode, including: querying the print file record table according to the business serial number to determine whether the business serial number exists in the print file record table; if so, obtaining the session identifier corresponding to the business serial number from the print file record table; if not, performing installation processing on the file according to the installation mode. In an embodiment of the present invention, files can be subjected to installation processing in a synchronous or asynchronous manner. If the file is subjected to installation processing in an asynchronous manner, it is necessary to determine whether the file has been printed by querying the print file record table to prevent duplicate printing. Therefore, before performing installation processing on the file, first query the print file record table to determine whether the business serial number in the print request input parameter exists. If so, it means that the file has been printed. Then, the session identifier corresponding to the business serial number is directly obtained from the print file record table. If not, the file is subjected to installation processing according to the installation mode in the print request input parameter.
[0117] Step 205: Store the file locally and write the storage address of the file into the session, thereby generating a session identifier corresponding to the storage address of the file.
[0118] Step 206: Write the service serial number, the session identifier, and the current timestamp into the print file record table.
[0119] Step 207: Acquire the data to be printed according to the business serial number, thereby generating a file according to a preset printing mode.
[0120] If the installation mode is the signature mode, it is implemented by calling a third-party interface. Specifically, the signature interface provided by the third party is called to receive the URL returned by the signature interface.
[0121] Step 208: calling a signature interface, wherein the input parameter of the signature interface is the file.
[0122] Step 209: Receive the uniform resource locator returned by the signature interface.
[0123] Step 210, obtaining the data to be printed according to the business serial number, thereby generating a file according to a preset printing mode, storing the file locally, and writing the storage address of the file into the session, thereby generating a session identifier corresponding to the storage address of the file.
[0124] If the loading mode is empty, the storage address of the data to be printed is obtained from the session according to the business serial number, and the data to be printed is obtained according to the storage address. Then, the file is generated according to the preset printing mode, and the generated file is stored locally on the server. Finally, the storage address of the file is written to the session, thereby generating a session identifier corresponding to the PDF file.
[0125] Step 211: Return the session identifier or the uniform resource locator.
[0126] The embodiments of the present invention have the following beneficial effects: when the front-end page display results are modified according to user needs, system changes are reduced, which facilitates system maintenance; and the system is more flexible, and the front-end page can be quickly adjusted to improve system functions; development costs are saved and the response speed to user needs is improved.
[0127] Figure 3 Schematic diagram of the main process of the method for printing a file according to the third embodiment of the present invention. As another embodiment of the present invention, Figure 3 As shown, the method for printing a file may include:
[0128] Step 301: Receive a print request, where the input parameters of the print request include a service serial number and an installation mode.
[0129] Step 302 , query the print file record table according to the business serial number to determine whether the business serial number exists in the print file record table; if so, execute step 303 ; if not, execute step 304 .
[0130] Step 303: Obtain the session identifier corresponding to the service serial number from the print file record table.
[0131] Step 304: Acquire the data to be printed according to the business serial number, thereby generating a file according to a preset printing mode.
[0132] Step 305: Obtain the installation mode in the print request input parameter, where the installation mode is selected from one of the following: watermark mode, seal mode, or watermark and seal mode; then proceed to step 306. If the installation mode is signature mode, proceed to step 309. If the installation mode is null, proceed to step 307.
[0133] Step 306: perform installation processing on the file according to the installation mode, such as adding a watermark, stamping, or adding a watermark and stamping.
[0134] Step 307: Store the file locally and write the storage address of the file into the session, thereby generating a session identifier corresponding to the storage address of the file.
[0135] Step 308: Write the service serial number, the session identifier, and the current timestamp into the print file record table.
[0136] Step 309: calling the signature interface, where the input parameter of the signature interface is the file.
[0137] Step 310: Receive the uniform resource locator returned by the signature interface.
[0138] Step 311: Return the session identifier or the uniform resource locator.
[0139] In addition, the specific implementation content of the method for printing a file in the third embodiment of the present invention has been described in detail in the above-mentioned method for printing a file, so the repeated content will not be described again here.
[0140] Figure 4 FIG. 1 is a schematic diagram of the main modules of the device for printing a document according to an embodiment of the present invention. Figure 4 As shown, the device 400 for printing files includes a receiving module 401, a printing module 402 and a returning module 403; wherein the receiving module 401 is used to receive a printing request, and the input parameters of the printing request include a business serial number and an installation mode; the printing module 402 is used to query the printing file record table according to the business serial number, and determine whether the printing file record table contains the business serial number; if so, obtain the session identifier corresponding to the business serial number from the printing file record table; if not, obtain the data to be printed, generate a file according to the installation mode and the preset printing mode, and thus generate a session identifier or uniform resource locator corresponding to the file; the returning module 403 is used to return the session identifier or the uniform resource locator.
[0141] Optionally, if the installation mode is selected from one of the following:
[0142] Watermark mode, stamp mode, watermark and stamp mode;
[0143] Then the printing module 402 is further used for:
[0144] Acquiring data to be printed according to the business serial number, thereby generating a file according to the installation mode and the preset printing mode;
[0145] The file is stored locally, and the storage address of the file is written into the session, thereby generating a session identifier corresponding to the storage address of the file.
[0146] Optionally, the printing module 402 is further configured to:
[0147] The storage address of the file is written into the session to generate a session identifier, and then the service sequence number, the session identifier and the current timestamp are written into the print file record table.
[0148] Optionally, the printing module 402 is further configured to:
[0149] Acquire the storage address of the data to be printed according to the business serial number, thereby acquiring the data to be printed;
[0150] generating a file according to a preset printing mode and the data to be printed;
[0151] Performing installation processing on the file according to the installation mode;
[0152] The additional installation process includes one of the following:
[0153] Add watermark, stamp, add watermark and stamp.
[0154] Optionally, the printing module 402 is further configured to:
[0155] Querying the print file record table according to the business serial number to determine whether the business serial number exists in the print file record table;
[0156] If so, obtaining the session identifier corresponding to the business serial number from the print file record table;
[0157] If not, the file is installed according to the installation mode.
[0158] Optionally, if the installation mode is a signature mode;
[0159] Then the printing module 402 is further used for:
[0160] Acquiring the data to be printed according to the business serial number, thereby generating a file according to a preset printing mode;
[0161] Call the signature interface, the input parameter of the signature interface is the file;
[0162] Receive the uniform resource locator returned by the signature interface.
[0163] Optionally, if the installation mode is empty;
[0164] Then the printing module 402 is further used for:
[0165] Acquiring the data to be printed according to the business serial number, thereby generating a file according to a preset printing mode;
[0166] Storing the file locally;
[0167] The storage address of the file is written into the session, thereby generating a session identifier corresponding to the storage address of the file.
[0168] Optionally, the preset printing mode is flash mode or PDF mode.
[0169] Based on the various embodiments described above, it can be seen that the embodiments of the present invention query the print file record table based on the business sequence number to determine whether the print file record table contains the business sequence number; if so, obtain the session identifier from the print file record table; if not, obtain the data to be printed, generate the file according to the installation mode and the preset printing mode, and thus generate the session identifier or uniform resource locator. This technical means solves the technical problem of high development costs in the prior art. The embodiments of the present invention implement file printing and secondary installation by dynamically configuring the installation mode and the printing mode. Each business module only needs to call a unified printing method and configure the corresponding parameters to achieve the corresponding requirements and meet the personalized needs of users. This not only reduces development costs but also decouples file printing from business functions.
[0170] It should be noted that the specific implementation content of the device for printing documents of the present invention has been described in detail in the method for printing documents described above, so the details will not be repeated here.
[0171] Figure 5 An exemplary system architecture 500 is shown to which the method for printing a file or the apparatus for printing a file according to an embodiment of the present invention can be applied.
[0172] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0173] Users can use terminal devices 501, 502, and 503 to interact with server 505 via network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, and 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0174] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0175] Server 505 may be a server that provides various services, such as a backend management server (for example only) that supports shopping websites browsed by users using terminal devices 501, 502, and 503. The backend management server may analyze and process received data such as item information query requests, and feed back the processing results to the terminal devices.
[0176] It should be noted that the method for printing a file provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the device for printing a file is generally provided in the server 505 .
[0177] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.
[0178] Reference below Figure 6 , which shows a schematic structural diagram of a computer system 600 of a terminal device suitable for implementing an embodiment of the present invention. Figure 6 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0179] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage unit 608 into a random access memory (RAM) 603. Various programs and data required for the operation of the system 600 are also stored in the RAM 603. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0180] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, and the like; an output section 607 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 608 including a hard disk; and a communication section 609 including a network interface card such as a LAN card or a modem. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 610 as needed, so that computer programs read therefrom can be installed into the storage section 608 as needed.
[0181] In particular, according to the embodiments disclosed in the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present invention include a computer program comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 609, and / or installed from a removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are performed.
[0182] It should be noted that the computer-readable medium described in the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media can include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. This propagated data signal can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, or any suitable combination thereof.
[0183] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer programs according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0184] The modules described in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be provided in a processor. For example, a processor may be described as including a receiving module, a printing module, and a returning module. The names of these modules do not, in some cases, limit the modules themselves.
[0185] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device implements the following method: receiving a print request, wherein the input parameters of the print request include a business serial number and an installation mode; querying a print file record table according to the business serial number to determine whether the print file record table contains the business serial number; if so, obtaining a session identifier corresponding to the business serial number from the print file record table; if not, obtaining data to be printed, generating a file according to the installation mode and a preset print mode, thereby generating a session identifier or a uniform resource locator corresponding to the file; and returning the session identifier or the uniform resource locator.
[0186] As another aspect, an embodiment of the present invention further provides a computer program product, including a computer program, which implements the method described in any of the above embodiments when executed by a processor.
[0187] The technical solution of the embodiment of the present invention overcomes the technical problem of high development costs in the prior art by querying the print file record table based on the business serial number to determine whether the business serial number exists in the print file record table; if so, obtaining the session identifier from the print file record table; if not, obtaining the data to be printed and generating the file based on the installation mode and the preset printing mode, thereby generating the session identifier or uniform resource locator. The embodiment of the present invention implements file printing and secondary installation by dynamically configuring the installation mode and the printing mode. Each business module only needs to call a unified printing method and configure the corresponding parameters to achieve the corresponding requirements and meet the personalized needs of users. This not only reduces development costs but also decouples file printing from business functions.
[0188] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. A method for printing a document, characterized in that: include: Receive a print request, wherein the input parameters of the print request include a service serial number and an installation mode; Querying the print file record table according to the service serial number to determine whether the service serial number exists in the print file record table; if so, obtaining the session identifier corresponding to the service serial number from the print file record table; If not, obtaining the data to be printed, generating a file according to the installation mode and the preset printing mode, thereby generating a session identifier or uniform resource locator corresponding to the file; Returning the session identifier or the uniform resource locator; Acquiring data to be printed, generating a file according to the installation mode and the preset printing mode, and thereby generating a session identifier corresponding to the file, including: Acquiring data to be printed according to the business serial number, thereby generating a file according to the installation mode and the preset printing mode; The file is stored locally, and the storage address of the file is written into the session, thereby generating a session identifier corresponding to the storage address of the file; Acquiring the data to be printed according to the business serial number, thereby generating a file according to the installation mode and the preset printing mode, including: Acquire the storage address of the data to be printed according to the business serial number, thereby acquiring the data to be printed; generating a file according to a preset printing mode and the data to be printed; Querying the print file record table according to the business serial number to determine whether the business serial number exists in the print file record table; If so, obtaining the session identifier corresponding to the business serial number from the print file record table; If not, the file is installed according to the installation mode.
2. The method according to claim 1, characterized in that If the installation mode is selected from the following: Watermark mode, stamp mode, watermark and stamp mode.
3. The method according to claim 2, characterized in that After writing the storage address of the file into the session to generate a session identifier, the method further includes: The service sequence number, the session identifier and the current timestamp are written into the print file record table.
4. The method according to claim 2, characterized in that The additional installation process includes one of the following: Add watermark, stamp, add watermark and stamp.
5. The method according to claim 1, characterized in that If the installation mode is the signature mode; Then, the data to be printed is obtained, and a file is generated according to the installation mode and the preset printing mode, thereby generating a uniform resource locator corresponding to the file, including: Acquiring the data to be printed according to the business serial number, thereby generating a file according to a preset printing mode; Call the signature interface, the input parameter of the signature interface is the file; Receive the uniform resource locator returned by the signature interface.
6. The method according to claim 1, characterized in that If the installation mode is empty; Then, the data to be printed is obtained, and a file is generated according to the installation mode and the preset printing mode, thereby generating a session identifier corresponding to the file, including: Acquiring the data to be printed according to the business serial number, thereby generating a file according to a preset printing mode; Storing the file locally; The storage address of the file is written into the session, thereby generating a session identifier corresponding to the storage address of the file.
7. The method according to claim 1, characterized in that The preset printing mode is flash mode or PDF mode.
8. A device for printing documents, characterized in that: include: A receiving module, configured to receive a print request, wherein the input parameters of the print request include a service serial number and an installation mode; a printing module, configured to query a print file record table according to the service serial number, and determine whether the service serial number exists in the print file record table; if so, obtain a session identifier corresponding to the service serial number from the print file record table; If not, obtaining the data to be printed, generating a file according to the installation mode and the preset printing mode, thereby generating a session identifier or uniform resource locator corresponding to the file; A return module, configured to return the session identifier or the uniform resource locator; The printing module is also used for: Acquiring data to be printed according to the business serial number, thereby generating a file according to the installation mode and the preset printing mode; The file is stored locally, and the storage address of the file is written into the session, thereby generating a session identifier corresponding to the storage address of the file; The printing module is also used for: Acquire the storage address of the data to be printed according to the business serial number, thereby acquiring the data to be printed; generating a file according to a preset printing mode and the data to be printed; Querying the print file record table according to the business serial number to determine whether the business serial number exists in the print file record table; If so, obtaining the session identifier corresponding to the business serial number from the print file record table; If not, the file is installed according to the installation mode.
9. The device according to claim 8, characterized in that If the installation mode is selected from the following: Watermark mode, stamp mode, watermark and stamp mode.
10. The device according to claim 9, characterized in that The printing module is also used for: The storage address of the file is written into the session to generate a session identifier, and then the service sequence number, the session identifier and the current timestamp are written into the print file record table.
11. The device according to claim 9, characterized in that The additional installation process includes one of the following: Add watermark, stamp, add watermark and stamp.
12. The device according to claim 8, characterized in that If the installation mode is the signature mode; Then the printing module is further used for: Acquiring the data to be printed according to the business serial number, thereby generating a file according to a preset printing mode; Call the signature interface, the input parameter of the signature interface is the file; Receive the uniform resource locator returned by the signature interface.
13. The device according to claim 8, characterized in that If the installation mode is empty; Then the printing module is further used for: Acquiring the data to be printed according to the business serial number, thereby generating a file according to a preset printing mode; Storing the file locally; The storage address of the file is written into the session, thereby generating a session identifier corresponding to the storage address of the file.
14. The device according to claim 8, characterized in that The preset printing mode is flash mode or PDF mode.
15. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
16. A computer-readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
File signature method and device based on asynchronous processing and computer equipment
CN112306977A
Print recording system and method for controlling print recording system
WO2020195408A1