Printing processing method and device, electronic equipment and storage medium
By calling the target instruction sequence of the preset script tool in the CUPS printing system, the custom watermark content is automatically obtained and synthesized, which solves the problem that CUPS does not support automatic watermark addition, and achieves the effect of simplifying user operations and expanding printing universality.
Patent Information
- Application Number
- CN202411635446.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-02-28
AI Technical Summary
The CUPS printing system does not support automatic addition of custom watermark content in printed files, which leads to cumbersome user operations, and the support of pdftk tools is limited, limiting the scope of printing.
By calling the target instruction sequence of the preset script tool in the CUPS printing process, the custom watermark content is automatically obtained, and combined with the target file into a file to be printed, and finally converted into a format supported by the target printer for printing.
It realizes the function of automatically adding custom watermark content in the CUPS printing process, greatly simplifying user operations and expanding the versatility of printing, and is suitable for all Linux systems.
Smart Images

Figure CN119536670A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of printing technology, and in particular to a printing processing method, device, electronic device and storage medium. Background Art
[0002] CUPS (Common UNIX Printing System) is the manager of printers and print tasks in Linux systems.
[0003] Adding watermarks to printed documents can help monitor the spread of protected data, identify authenticity, and control illegal copies, providing reliable evidence for the ownership of information products.
[0004] However, currently CUPS does not support the function of adding watermarks to print files. Users need to make watermark content into watermark images by themselves; then use tools such as pdftk to combine the generated watermark images with the files to be printed into PDF files; finally, print the combined PDF files out as paper files through the CUPS system. The whole process is cumbersome for users to operate. In addition, the Linux operating systems that the pdftk tool can support are limited, which limits the scope of printing. Summary of the invention
[0005] In view of the above problems, an embodiment of the present application is proposed to provide a printing processing method that overcomes the above problems or at least partially solves the above problems, and realizes the function of automatically adding custom watermark content in the CUPS printing process, which greatly simplifies the user's operation and simplifies the process of printing watermark content.
[0006] Correspondingly, the embodiment of the present application also provides a printing processing device, an electronic device, and a storage medium to ensure the implementation and application of the above method.
[0007] In a first aspect, an embodiment of the present application discloses a printing processing method, the method comprising:
[0008] In response to a print task for a target file, a target instruction sequence of a preset script tool is called through a CUPS system to obtain a custom watermark content according to a preset acquisition method, and the custom watermark content and the target file are combined into a file to be printed; the acquisition method is preset by a first instruction of the preset script tool; the first instruction carries a first parameter, and the first parameter indicates the acquisition method of the custom watermark content;
[0009] The file to be printed is converted into data to be printed that matches a format supported by a target printer, and sent to the target printer for printing.
[0010] In a second aspect, an embodiment of the present application discloses a printing processing device, the device comprising:
[0011] The watermark processing module is used to respond to the print task for the target file, call the target instruction sequence of the preset script tool through the CUPS system, so as to obtain the custom watermark content according to the preset acquisition method, and combine the custom watermark content and the target file into a file to be printed; the acquisition method is pre-set by the first instruction of the preset script tool; the first instruction carries a first parameter, and the first parameter indicates the acquisition method of the custom watermark content;
[0012] The file printing module is used to convert the file to be printed into data to be printed that matches the format supported by the target printer, and send the data to the target printer for printing.
[0013] In the third aspect, an embodiment of the present application discloses an electronic device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the steps of any of the printing processing methods described above.
[0014] In a fourth aspect, an embodiment of the present application discloses a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, any printing processing method described in the embodiment of the present application can be implemented.
[0015] The printing processing method, device, electronic device and storage medium provided by the embodiments of the present application have the following advantages:
[0016] The printing processing method provided by the present application can perform a preset operation of the custom watermark content through an instruction provided by the preset script tool before submitting the printing task for the target file to set the acquisition method of the custom watermark content. When CUPS executes the printing task for the target file, the target instruction sequence of the preset script tool is automatically called, and the target instruction sequence automatically executes a series of operations including obtaining the custom watermark content according to the preset acquisition method, generating a watermark image based on the obtained custom watermark content, and synthesizing the generated watermark image with the target file into a file to be printed. Finally, CUPS converts the file to be printed into data to be printed that matches the format supported by the target printer, and sends it to the target printer for printing, thereby printing a paper file with the custom watermark content. The printing processing method provided by the present application realizes the function of automatically adding custom watermark content in the CUPS printing process, and the user only needs to enter one instruction (first instruction) during the whole process, which greatly simplifies the user's operation and simplifies the process of printing the watermark content. In addition, the present application realizes the function of adding custom watermark content to the print file based on the CUPS system, which has a wider versatility and can be applied to all Linux systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 is a flow chart of steps of an embodiment of a printing processing method of the present application;
[0018] Figure 2 This is a flow chart of printing using CUPS in an example of this application;
[0019] Figure 3 It is a flowchart of a target instruction sequence of a CUPS system calling a preset script tool in an example of the present application;
[0020] Figure 4 is a structural block diagram of an embodiment of a printing processing device of the present application;
[0021] Figure 5 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0023] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally a class, and the number of objects is not limited. For example, the first object can be one or more. In addition, the term "and / or" in the specification and claims is used to describe the association relationship of associated objects, indicating that three kinds of relationships can exist, for example, A and / or B can be represented: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the front and back associated objects are a kind of "or" relationship. In the embodiment of the present application, the term "multiple" refers to two or more, and other quantifiers are similar.
[0024] To facilitate understanding, the concepts involved in this application are first explained.
[0025] IPP: Internet Printing Protocol is a standard network protocol for printing on the Internet, allowing users to remotely print and manage printing through the Internet. Users can control various parameters such as the type of paper used for printing and the resolution through the relevant interface.
[0026] LPR: Line Printer Remote is a network protocol that is responsible for submitting print jobs to remote printers. During the whole process, the data stream is sent to a line printer daemon that supports the TCP / IP transmission protocol through the link driver for subsequent distribution or printing in the TCP / IP network.
[0027] LPD: Line Printer Daemon is a background program installed on a UNIX print server. Its function is to wait for print jobs sent by clients using the Line Printer Remote (LPR) protocol. When LPD receives a print job, it first temporarily stores the print job in the print queue, which is a file subdirectory with many print jobs waiting for LPD to process. When the printing device is idle, LPD takes the print job from the print queue and passes it to the printer for printing.
[0028] SMB: Server Message Block is a network protocol name used for Web connections and information communication between clients and servers.
[0029] CUPS: Common UNIX Printing System is a printing system supported in Linux-like systems. It mainly uses IPP to manage print tasks and print queues, and also supports communication protocols such as LPD, SMB, and AppSocket.
[0030] Figure 1 A flowchart of a printing processing method embodiment of the present application is shown, and the method may include the following steps:
[0031] Step 101: In response to a print task for a target file, a target instruction sequence of a preset script tool is called through a CUPS system to obtain a custom watermark content according to a preset acquisition method, and the custom watermark content and the target file are combined into a file to be printed; the acquisition method is preset by a first instruction of the preset script tool; the first instruction carries a first parameter, and the first parameter indicates the acquisition method of the custom watermark content;
[0032] Step 102: convert the file to be printed into data to be printed that matches the format supported by the target printer, and send the data to the target printer for printing.
[0033] The printing processing method provided in the present application can be applied to electronic devices based on the Linux operating system. The electronic devices may include but are not limited to any of the following: servers, smart phones, voice recorders, tablet computers, e-book readers, MP3 (Moving Picture Experts Group Audio Layer III) players, MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, car computers, desktop computers, set-top boxes, smart TVs, wearable devices, etc.
[0034] This application does not limit the type of the Linux operating system. For example, the Linux operating system may include but is not limited to any one of Debian, Ubuntu, CentOS (Community Enterprise Operating System), UOS (Unicom Desktop Operating System), Kylin Operating System, and Fangde Operating System.
[0035] This application is applicable to the scenario of using CUPS for printing in Linux system. CUPS is a printing system widely used in Linux and Unix systems, allowing users to print using almost any type of printer. The CUPS service has been installed and started in the Linux system, and the printer has been configured.
[0036] In Linux system, the process of printing using CUPS can mainly include the following steps:
[0037] 1) Submit a print task. Users can submit print tasks through command line tools or graphical interfaces on the client side, and the print tasks will be sent to the CUPS print queue for processing. The client and CUPS service can be on the same electronic device or on different electronic devices in the network. Print tasks usually include the files to be printed and print options (such as paper size, color, print quality, etc.). After receiving the print task, the CUPS service will parse the print task, including parsing the files to be printed, print options, and target printer.
[0038] 2) Print queue management. CUPS will put the print tasks submitted by users into the print queue and queue them for printing according to the priority and other conditions set by the user. Users can manage the print queue through the CUPS web interface or command line tool, including pausing, canceling or re-arranging print tasks.
[0039] 3) Process the print job. When the print job reaches the top of the queue, CUPS will convert the target file to be printed into a format that the target printer can understand (such as PostScript, PCL or PDF, etc.) according to the configuration information and print options of the target printer.
[0040] 4) Print task execution: CUPS communicates with the target printer and transmits the converted print data to the target printer. The target printer executes the print task, converts the print data into actual print pages and outputs them on paper.
[0041] 5) Job status update. CUPS can track the status of print tasks and update the web interface and print queue status.
[0042] 6) Error handling: If an error occurs during printing, CUPS can record the error information and return it to the client.
[0043] The printing processing method provided in this application realizes the function of automatically adding customized watermark content in the above-mentioned process of printing using CUPS.
[0044] Specifically, the present application installs a pre-set script tool in a Linux system, in which the CUPS service has been installed and started, and the target printer has been configured. The pre-set script tool can achieve the following two functions: one is to implement the pre-setting operation of the custom watermark content through an instruction (such as the first instruction); the other is to automatically execute a series of operations such as obtaining the custom watermark content, generating the watermark image, and synthesizing the file to be printed.
[0045] In a specific implementation, before submitting a print task for a target file, a user can perform a preset operation of a custom watermark content through an instruction provided by the preset script tool. The preset operation can be used to set a method for obtaining the custom watermark content. For example, the acquisition method can be set to a fixed acquisition method, and the specified fixed watermark content will be automatically obtained and printed when the target file is printed. For another example, the acquisition method can be set to a dynamic acquisition method, and a randomly generated watermark content will be printed when the target file is printed.
[0046] It should be noted that the present application does not limit the form of the target file, and the target file may be a text file or a picture file, etc.
[0047] After executing the preset operation of the custom watermark content, a print task can be submitted for the target file. Exemplarily, the target file can be opened in the file editor, and the "Print" button in the file editor is clicked to submit the print task for the target file. When CUPS processes the print task, it will automatically call the target instruction sequence of the preset script tool to obtain the custom watermark content according to the acquisition method set by the preset operation, and convert the obtained custom watermark content into a watermark image, and then synthesize it with the target file into a file to be printed. The file to be printed is the content of the target file with the custom watermark content added to it. The present application does not limit the format of the file to be printed, for example, the file to be printed can be a pdf file. Finally, the file to be printed is converted into the data to be printed that matches the format supported by the target printer, and sent to the target printer for printing, thereby printing out a paper file with the custom watermark content.
[0048] Reference Figure 2 , shows a schematic diagram of the process of using CUPS to print in an example of the present application, including the following steps:
[0049] A1: Receive the print job for the target file.
[0050] Specifically, the user can open the target file in the file editor and click a "print" button in the file editor to submit a print task for the target file.
[0051] It should be noted that, before step A1, the user has already performed a preset operation of customizing the watermark content by inputting a first instruction.
[0052] A2: When CUPS executes the print task, it executes the newly added code segment.
[0053] The present application adds a new code segment in the CUPS source code, and the new code segment is used to automatically call the target instruction sequence of the preset script tool, and then automatically execute a series of operations including obtaining custom watermark content, generating a watermark image based on the obtained custom watermark content, and synthesizing the generated watermark image with the target file into a file to be printed.
[0054] A3: A new code segment calls a target instruction sequence of a preset script tool; if the target instruction sequence is executed successfully, step A4 is executed; if the target instruction sequence fails to be executed, step A7 is executed;
[0055] A4: Generate files to be printed;
[0056] A5: Send the file to be printed to the target printer;
[0057] Specifically, CUPS converts the file to be printed into data to be printed that matches a format supported by a target printer, and then sends the data to the target printer.
[0058] A6: The target printer prints out a paper document containing the customized watermark content.
[0059] A7: It prompts that watermark generation failed.
[0060] In the above whole process, the user only needs to input one instruction (first instruction) and then click the print button to automatically implement multiple steps that originally required manual operation by the user in the related technology, which greatly simplifies the user operation.
[0061] The preset script tool is referred to as "nfs-cups-print" in this application. Exemplarily, the preset script tool can be written in the form of a shell script. The preset script tool can provide a command line interface, and the user can implement the preset operation of the custom watermark content by inputting the first instruction provided by the preset script tool to set the acquisition method of the custom watermark content.
[0062] In the embodiment of the present application, the command of the preset script tool is composed of "nfs-cups-print-x", where "-x" is a parameter of the command, indicating the function of the command. The function of the command indicated by "-x" may include: fixed acquisition method, dynamic acquisition method, synthesis of files to be printed, etc.
[0063] In an optional embodiment of the present application, the acquisition method of the custom watermark content may be a fixed acquisition method, and the first parameter may include a specified path file, and the specified path file includes the fixed watermark content specified by the user.
[0064] Further, the step 101 of obtaining the custom watermark content in a preset acquisition method may include: reading the fixed watermark content from the specified path file. The fixed watermark content contained in the specified path file may be text content and / or image content, etc., which is not limited in this application.
[0065] In example 1, the first instruction may be as follows:
[0066] nfs-cups-print-f / etc / watermark
[0067] Among them, "-f / etc / watermark" is the first parameter, and "-f" means that the function of the instruction is to set the acquisition method of the custom watermark content to a fixed acquisition method. " / etc / watermark" is a specified path file, which can be created by the user, and the content in the file is the fixed watermark content specified by the user. When CUPS calls the second instruction to obtain the custom watermark content, the second instruction will read the fixed watermark content in the file as the custom watermark content. Exemplarily, assuming that the content of the " / etc / watermark" file is "test123456", before printing the target file, the user enters the first instruction of Example 1, and then submits the print task of printing the target file. When CUPS executes the print task, it will call the second instruction to read the custom watermark content "test123456" from the " / etc / watermark" file, and the watermark content of "test123456" will be added to the final printed paper file.
[0068] In an optional embodiment of the present application, the acquisition method of the custom watermark content may be a dynamic acquisition method, and the first parameter may include a specified command, which can be used to dynamically generate the watermark content.
[0069] Further, the step 101 of obtaining the custom watermark content in a preset manner may include: dynamically generating the watermark content by executing the specified command. The watermark content dynamically generated by the specified command may be text content and / or image content, etc., which is not limited in this application.
[0070] In Example 2, the first instruction may be as follows:
[0071] nfs-cups-print-d'cat / etc / profile'
[0072] Among them, "-d'cat / etc / profile'" is the first parameter, and "-d" means that the function of the instruction is to set the acquisition method of the custom watermark content to a dynamic acquisition method. 'cat / etc / profile' is a specified command, and the watermark content can be dynamically generated by executing the specified command, that is, the dynamically generated watermark content can be a random watermark content, rather than a fixed watermark content specified by the user. The specified command can be a command of any tool that can randomly generate text content or image content. For example, the specified command in Example 2 is the cat command, and the watermark content can be dynamically generated and saved in the profile file by executing the command. Exemplarily, before printing the target file, the user enters the first instruction of Example 2, and then submits the print task of printing the target file. When CUPS executes the print task, it will call the second instruction to obtain the custom watermark content. The second instruction will execute the 'cat / etc / profile' command and obtain the dynamically generated custom watermark content from the profile file. For example, if the dynamically generated custom watermark content is "abc", the watermark content of "abc" will be added to the final printed paper file. It is understandable that the next time the 'cat / etc / profile' command is executed, different watermark content may be generated.
[0073] In an optional embodiment of the present application, the method may further include:
[0074] In response to the first instruction of the preset script tool, a method for obtaining the custom watermark content is set in the configuration file according to the first parameter.
[0075] In a specific implementation, after receiving the first instruction input by the user and executing the first instruction, the method for obtaining the custom watermark content set by the first instruction can be saved in a configuration file.
[0076] For example, in Example 1, the method for obtaining the custom watermark content can be saved in the configuration file as a fixed method, and the specified path file in the first parameter (such as " / etc / watermark") can be saved in the configuration file. In Example 2, the method for obtaining the custom watermark content can be saved in the configuration file as a dynamic method, and the specified command in the first parameter (such as 'cat / etc / profile') can be saved in the configuration file.
[0077] Furthermore, the obtaining of the custom watermark content according to a preset obtaining method in step 101 may include: reading an obtaining method preset in the configuration file, and obtaining the custom watermark content according to the read obtaining method.
[0078] When CUPS executes a print task for a target file, it automatically calls the target instruction sequence of the preset script tool, and during the execution of the target instruction sequence, the preset acquisition method in the configuration file will be read. For example, if the second instruction reads from the configuration file that the preset acquisition method is a fixed acquisition method, and the specified path file read is " / etc / watermark", then the second instruction reads the custom watermark content from the specified path file. For another example, if the second instruction reads from the configuration file that the preset acquisition method is a dynamic acquisition method, and the specified command read is 'cat / etc / profile', then the second instruction dynamically generates the custom watermark content by executing the specified command.
[0079] Furthermore, the configuration file can be effective in this printing task, or the configuration file can be effective in all subsequent printing tasks. Thus, the user can achieve the effect of adding the same watermark content to all subsequent target files to be printed by inputting the first instruction once, without having to reset it before each printing, which can further simplify the user's operation.
[0080] In an optional embodiment of the present application, the target instruction sequence of calling the preset script tool in step 101 to obtain the custom watermark content according to a preset acquisition method, and synthesize the custom watermark content and the target file into a file to be printed, may include:
[0081] Step S11, calling the second instruction of the preset script tool to obtain the custom watermark content according to the preset acquisition method;
[0082] Step S12, calling the third instruction of the preset script tool to generate a watermark image based on the obtained custom watermark content;
[0083] Step S13, calling the fourth instruction of the preset script tool to combine the generated watermark image and the target file into a file to be printed.
[0084] The present application modifies the source code of CUPS and adds a new code segment so that when CUPS executes a printing task for a target file, the new code segment automatically calls the preset script tool of the present application to automatically execute a series of operations including obtaining custom watermark content, generating a watermark image based on the obtained custom watermark content, and synthesizing the generated watermark image with the target file into a file to be printed.
[0085] The above series of operations can be automatically executed by calling a target instruction sequence of a preset script tool, where the target instruction sequence includes a second instruction, a third instruction, and a fourth instruction.
[0086] The second instruction is used to obtain the custom watermark content according to the preset acquisition method. Specifically, the second instruction can read the preset custom watermark content acquisition method from the configuration file, and obtain the custom watermark content according to the acquisition method.
[0087] In one example, the second instruction may be as follows:
[0088] nfs-cups-print-r
[0089] Among them, "-r" is the instruction parameter of the second instruction, indicating that the function of this instruction is to obtain the custom watermark content according to the acquisition method preset in the configuration file.
[0090] The third instruction is used to generate a watermark image based on the acquired custom watermark content.
[0091] After CUPS automatically calls the second instruction to obtain the custom watermark content, it can save the read custom watermark content in the cache, and then automatically call the third instruction to generate a watermark image based on the obtained (saved in the cache) custom watermark content.
[0092] In one example, the third instruction may be as follows:
[0093] nfs-cups-print-w
[0094] Among them, "-w" is the instruction parameter of the third instruction, indicating that the function of the instruction is to generate a watermark image based on the obtained (stored in the cache) custom watermark content. For example, if the obtained custom watermark content is the text content "test123456", a watermark image containing the text content is generated.
[0095] In an optional embodiment of the present application, generating a watermark image based on the acquired custom watermark content in step S12 may include:
[0096] The obtained custom watermark content is filled into the picture of the preset format in proportion to the range it occupies to obtain a watermark picture.
[0097] Step S12 can be used to convert the obtained custom watermark content into a watermark image in a preset format. The obtained custom watermark content can be data such as characters / text / images. The present application converts the obtained custom watermark content into a watermark image in a preset format. Furthermore, the preset format can be a PNG format, which can support a transparent effect. The watermark image in the PNG format is synthesized with the target file without affecting the original content in the target file.
[0098] Specifically, the data of the custom watermark content is converted in the manner of a PNG picture, and is filled into the PNG picture in proportion to the range occupied by the custom watermark content (corresponding to the screen position), so that a watermark picture in PNG format can be obtained. The range occupied by the custom watermark content refers to the size of the space occupied by the characters / text / image and other data of the custom watermark content when displayed on the screen. This application fills the range occupied by the custom watermark content into a picture of a preset format in proportion to the range occupied by the custom watermark content, so that the generated watermark picture contains the complete custom watermark content.
[0099] The fourth instruction is used to combine the generated watermark image and the target file into a file to be printed. After CUPS automatically calls the third instruction to generate a watermark image from the custom watermark content in the cache, it automatically calls the fourth instruction to load the target file into the cache, combines it with the generated watermark image, and combines the watermark image into the target file to obtain the file to be printed.
[0100] In one example, the fourth instruction may be as follows:
[0101] nfs-cups-print-p / opt / test
[0102] Among them, "-p / opt / test" is the instruction parameter of the fourth instruction, "-p" means that the function of this instruction is to combine the generated watermark image and the target file into a file to be printed, " / opt / test" means the output file to be printed, and "test" is the name of the file to be printed.
[0103] In an optional embodiment of the present application, the first instruction may further include a second parameter, and the second parameter is used to indicate watermark position information; the step S13 of combining the generated watermark image and the target file into a file to be printed may include:
[0104] The generated watermark image is synthesized into the target file according to the position information to obtain a file to be printed.
[0105] When the application pre-sets the custom watermark content through the first instruction, in addition to setting the method for obtaining the custom watermark content, the location information of the custom watermark content in the target file can also be set. When CUPS automatically calls the fourth instruction to synthesize the watermark image and the target file, the fourth instruction loads the target file into the cache, and then synthesizes the watermark image with the target file in the cache according to the preset location information to generate a file to be printed.
[0106] In a specific implementation, when CUPS executes a printing task for a target file, it automatically calls the preset script tool of the present application. The system can allocate cache space for the operation of the preset script tool. After steps S11 to S13 are completed, the preset script tool can be exited and the resources occupied by it (such as cache space, etc.) can be reclaimed.
[0107] Reference Figure 3 , shows a flow chart of a target instruction sequence of a CUPS system calling a preset script tool in an example of the present application, which may include the following steps:
[0108] Step B1: Call the second instruction of the preset script tool.
[0109] Step B2: The second instruction obtains the custom watermark content according to a preset acquisition method.
[0110] The second instruction may return a message indicating whether the acquisition of the custom watermark content is successful. If the acquisition of the custom watermark content is successful, step B3 is executed; if the acquisition of the custom watermark content fails, step B7 is executed.
[0111] Step B3: calling the third instruction of the preset script tool, the third instruction generates a watermark image based on the obtained custom watermark content.
[0112] Step B4: Call the fourth instruction of the preset script tool.
[0113] Step B5: The fourth instruction combines the generated watermark image and the target file into a file to be printed; if the combination of the file to be printed is successful, execute step B6; if the combination of the file to be printed fails, execute step B8.
[0114] B6: Exit the preset script tool to release resources.
[0115] B7: It indicates that the acquisition of watermark content failed.
[0116] B8: The message indicates that the synthesis file failed.
[0117] In summary, the printing processing method provided by the present application can perform a preset operation of the custom watermark content through an instruction provided by the preset script tool before submitting the printing task for the target file to set the method for obtaining the custom watermark content. When CUPS executes the printing task for the target file, the target instruction sequence of the preset script tool is automatically called, and the target instruction sequence automatically executes a series of operations including obtaining the custom watermark content according to the preset acquisition method, generating a watermark image based on the obtained custom watermark content, and synthesizing the generated watermark image with the target file into a file to be printed. Finally, CUPS converts the file to be printed into data to be printed that matches the format supported by the target printer, and sends it to the target printer for printing, thereby printing a paper file with the custom watermark content. The printing processing method provided by the present application realizes the function of automatically adding custom watermark content in the CUPS printing process, and the user only needs to input one instruction (the first instruction) during the whole process, which greatly simplifies the user's operation and simplifies the process of printing the watermark content. In addition, the present application implements the function of adding custom watermark content to the printed file based on the CUPS system, has wider versatility and is applicable to all Linux systems.
[0118] It should be noted that, for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the described order of actions, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.
[0119] Reference Figure 4 , shows a structural block diagram of an embodiment of a printing processing device of the present application, the device may include:
[0120] The watermark processing module 401 is used to respond to the print task for the target file, call the target instruction sequence of the preset script tool through the CUPS system, so as to obtain the custom watermark content according to the preset acquisition method, and combine the custom watermark content and the target file into a file to be printed; the acquisition method is pre-set by the first instruction of the preset script tool; the first instruction carries a first parameter, and the first parameter indicates the acquisition method of the custom watermark content;
[0121] The file printing module 402 is used to convert the file to be printed into data to be printed that matches the format supported by the target printer, and send it to the target printer for printing.
[0122] Optionally, the watermark processing module includes:
[0123] A first calling processing submodule is used to call the second instruction of the preset script tool to obtain the custom watermark content according to the preset acquisition method;
[0124] A second calling processing submodule is used to call the third instruction of the preset script tool to generate a watermark image based on the obtained custom watermark content;
[0125] The third calling processing submodule is used to call the fourth instruction of the preset script tool to combine the generated watermark image and the target file into a file to be printed.
[0126] Optionally, the first parameter includes a specified path file; the watermark processing module is specifically used to read the fixed watermark content from the specified path file.
[0127] Optionally, the first parameter includes a specified command; the watermark processing module is specifically configured to dynamically generate watermark content by executing the specified command.
[0128] Optionally, the second calling processing submodule is specifically used to fill the range occupied by the acquired custom watermark content into a picture of a preset format in equal proportion to obtain a watermark picture.
[0129] Optionally, the first instruction also includes a second parameter, and the second parameter indicates watermark position information; the third calling processing submodule is specifically used to synthesize the generated watermark image into the target file according to the position information to obtain a file to be printed.
[0130] Optionally, the device further comprises:
[0131] A configuration saving module, configured to respond to the first instruction of the preset script tool and set a method for obtaining the custom watermark content in a configuration file according to the first parameter;
[0132] The watermark processing module is specifically used to read the acquisition method preset in the configuration file, and obtain the custom watermark content according to the read acquisition method.
[0133] The printing processing device provided by the present application can perform a preset operation of the custom watermark content through an instruction provided by the preset script tool before submitting the printing task for the target file to set the acquisition method of the custom watermark content. When CUPS executes the printing task for the target file, the target instruction sequence of the preset script tool is automatically called, and the target instruction sequence automatically executes a series of operations including obtaining the custom watermark content according to the preset acquisition method, generating a watermark image based on the obtained custom watermark content, and synthesizing the generated watermark image with the target file into a file to be printed. Finally, CUPS converts the file to be printed into data to be printed that matches the format supported by the target printer, and sends it to the target printer for printing, thereby printing a paper file with the custom watermark content. The printing processing device provided by the present application realizes the function of automatically adding custom watermark content in the CUPS printing process, and the user only needs to input one instruction (first instruction) during the whole process, which greatly simplifies the user's operation and simplifies the process of printing the watermark content. In addition, the present application realizes the function of adding custom watermark content to the print file based on the CUPS system, which has a wider versatility and can be applied to all Linux systems.
[0134] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0135] Reference Figure 5 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the electronic device includes: a processor, a memory, a communication interface and a communication bus, and the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the steps of the printing processing method of the aforementioned embodiment.
[0136] An embodiment of the present application provides a non-temporary computer-readable storage medium. When instructions in the storage medium are executed by a program or processor of a terminal, the terminal is enabled to execute the steps of the print processing method of the aforementioned embodiment.
[0137] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0138] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0139] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0140] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a predictable manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0141] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0142] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0143] Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A printing processing method, characterized in that: The method comprises: In response to a print task for a target file, a target instruction sequence of a preset script tool is called through a CUPS system to obtain a custom watermark content according to a preset acquisition method, and the custom watermark content and the target file are combined into a file to be printed; the acquisition method is preset by a first instruction of the preset script tool; the first instruction carries a first parameter, and the first parameter indicates the acquisition method of the custom watermark content; The file to be printed is converted into data to be printed that matches a format supported by a target printer, and sent to the target printer for printing.
2. The method according to claim 1, characterized in that The target instruction sequence of calling the preset script tool to obtain the custom watermark content according to the preset acquisition method, and synthesize the custom watermark content and the target file into a file to be printed, includes: Calling the second instruction of the preset script tool to obtain the custom watermark content according to the preset acquisition method; Calling the third instruction of the preset script tool to generate a watermark image based on the obtained custom watermark content; The fourth instruction of the preset script tool is called to combine the generated watermark image and the target file into a file to be printed.
3. The method according to claim 1 or 2, characterized in that: The first parameter includes a specified path file; the obtaining of the custom watermark content according to a preset obtaining method includes: Read the fixed watermark content from the specified path file.
4. The method according to claim 1 or 2, characterized in that: The first parameter includes a specified command; the obtaining of the custom watermark content according to a preset obtaining method includes: The watermark content is dynamically generated by executing the specified command.
5. The method according to claim 2, characterized in that: The step of generating a watermark image based on the obtained custom watermark content includes: The range occupied by the obtained custom watermark content is filled into the picture of the preset format in equal proportion to obtain the watermark picture.
6. The method according to claim 2, characterized in that The first instruction also includes a second parameter, wherein the second parameter indicates watermark position information; The step of synthesizing the generated watermark image and the target file into a file to be printed includes: The generated watermark image is synthesized into the target file according to the position information to obtain a file to be printed.
7. The method according to claim 1 or 2, characterized in that: The method further comprises: In response to the first instruction of the preset script tool, setting a method for obtaining the custom watermark content in a configuration file according to the first parameter; The step of obtaining the custom watermark content in a preset manner includes: The acquisition method preset in the configuration file is read, and the custom watermark content is acquired according to the read acquisition method.
8. A printing processing device, characterized in that: The device comprises: The watermark processing module is used to respond to the print task for the target file, call the target instruction sequence of the preset script tool through the CUPS system, so as to obtain the custom watermark content according to the preset acquisition method, and combine the custom watermark content and the target file into a file to be printed; the acquisition method is pre-set by the first instruction of the preset script tool; the first instruction carries a first parameter, and the first parameter indicates the acquisition method of the custom watermark content; The file printing module is used to convert the file to be printed into data to be printed that matches the format supported by the target printer, and send the data to the target printer for printing.
9. An electronic device, characterized in that: include: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the steps of the printing processing method according to any one of claims 1 to 7.
10. A readable storage medium, characterized in that: The readable storage medium stores a program or an instruction, and when the program or the instruction is executed by the processor, the steps of the printing processing method according to any one of claims 1 to 7 are implemented.