Data processing method and device, computing equipment and storage medium
By identifying and modifying the data sources that the printer driver cannot process, and using the printing software's print setting commands to make it comply with printer specifications, it solves the problem that printers cannot recognize multiple printing languages in Linux systems, and improves printer compatibility and security.
Patent Information
- Application Number
- CN202510690527.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-27
- Publication Date
- 2025-09-05
AI Technical Summary
In Linux operating systems, printers fail to recognize and process printing languages, such as PCL, that are not supported by CUPS programs, resulting in printing failures, especially on securely enhanced printers that cannot be used for encrypted data verification and printing.
The source of the data to be printed is identified through the printer driver. If the printing software is included, the printing setting commands it generates are obtained, and the data to be printed is modified according to these commands to make it comply with the predefined specifications of the printer, including the encryption process and sent to the secure enhanced printer.
Ensure that the printer can correctly identify and process multiple printing languages, improve printing accuracy and stability, solve printer compatibility issues, and ensure data security of secure printers.
Smart Images

Figure CN120596042A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of printer technology, and in particular to a data processing method, apparatus, computing device, and storage medium. Background Art
[0002] When printing on a Linux operating system, a printer typically requires the use of printing software, the CUPS program, and a printer driver. Specifically, the printing software is typically user-facing and detects print requests, retrieves the pages to be printed, and sends them to the CUPS program. The CUPS program converts the pages to be printed into files in formats such as PDF or Postscript and provides the converted files to the print filter program. The printer driver processes the files sent by the CUPS program and sends them to the printer for printing.
[0003] However, CUPS only supports files in formats such as PDF or Postscript. For data that cannot be recognized, CUPS will continue to send this data to the subsequent modules. If the printer cannot recognize this data, the file will fail to print. Summary of the Invention
[0004] The present application provides a data processing method, apparatus, computing device and storage medium, which convert commands that a printer cannot recognize into commands that it can recognize through a printer driver, thereby completing normal printing.
[0005] According to one aspect of the present application, a data processing method is provided, comprising:
[0006] The printer driver receives the print data;
[0007] Identify the data source of the data to be printed;
[0008] If the data source of the data to be printed includes printing software, then a print setting command generated by the printing software is obtained, where the print setting command is used to set specific printing parameters of the data to be printed; this is part of the function of the printing software to replace the printer driver;
[0009] The data to be printed is modified according to the print setting command so that the modified data to be printed conforms to a predefined specification of the printer.
[0010] Furthermore, according to one aspect of the present application, a data processing method is applied to an operating system pre-installed with a universal Yonex printing system CUPS program, and identifying the data source of the data to be printed includes:
[0011] Identify the type of print description language corresponding to the data to be printed;
[0012] Determine whether the type of the print description language is not supported by the CUPS program;
[0013] If the data source is a type not supported by the CUPS program, the data source is identified as including printing software.
[0014] Furthermore, according to a data processing method in one aspect of the present application, determining whether the type of the print description language is a type not supported by the CUPS program includes:
[0015] Read at least one characteristic flag in the characteristic file;
[0016] If the data to be printed includes one or more of the at least one characteristic flag, it is determined that the data source of the data to be printed includes printing software.
[0017] In addition, according to the data processing method of one aspect of the present application, the printing software is used to replace at least one of the following functions of the printer driver:
[0018] Print data generation function, print data conversion function, and print data delivery function.
[0019] Furthermore, according to a data processing method in one aspect of the present application, obtaining a print setting command generated by printing software includes:
[0020] Recognizing a preset keyword in the data to be printed to obtain a print setting command; or
[0021] Call the application programming interface API related to print settings to obtain print setting commands.
[0022] Furthermore, according to a data processing method in one aspect of the present application, modifying the data to be printed according to the print setting command so that the modified data to be printed conforms to the predefined printing specification of the printer includes:
[0023] Determine the modification mode from the feature file according to the print setting command;
[0024] The data for representing the print job language PJL command and / or the data for representing the print control language PCL command in the data to be printed are modified according to the modification method, so that the modified data to be printed conforms to the predefined printing specification of the printer.
[0025] In addition, according to one aspect of the data processing method of the present application, the printer is a security-enhanced printer, and the method further includes:
[0026] encrypting the modified data to be printed to obtain encrypted data;
[0027] The encrypted data is sent to the security-enhanced printer, so that the security-enhanced printer decrypts the encrypted data to obtain the decrypted data to be printed, and prints the data content in the decrypted data to be printed according to the print setting command.
[0028] According to another aspect of the present application, a data processing device is provided, which may include:
[0029] A data receiving unit, used for the printer driver to receive data to be printed;
[0030] A source identification unit, used to identify the data source of the data to be printed;
[0031] a command acquisition unit, configured to acquire a print setting command generated by the printing software if the data source of the data to be printed includes printing software, the print setting command being used to set specific printing parameters of the data to be printed; the printing software being used to replace at least a portion of the functions of the printer driver;
[0032] The data modification unit is used to modify the data to be printed according to the print setting command so that the modified data to be printed conforms to the predefined printing specification of the printer.
[0033] According to yet another aspect of the present application, there is provided a computing device comprising a memory and a processor;
[0034] The memory is used to store computer programs, including but not limited to printer drivers, printing software and CUPS programs;
[0035] The processor executes any one of the data processing methods through the printer driver.
[0036] According to another aspect of the present application, a computer-readable storage medium is provided, on which a printer driver is stored. When the printer driver is executed by a processor, the steps of any one of the methods are implemented.
[0037] According to another aspect of the present application, a printer driver product is provided, including a printer driver, wherein the printer driver implements the steps of any one of the methods when executed by a processor.
[0038] As will be described in detail below, according to the data processing method, computing device, storage medium and product of the embodiments of the present application, the printer driver first receives the print data and then identifies the data source of the data to be printed. When the data source of the data to be printed includes printing software, it means that the printer driver cannot directly process the data to be printed containing the printing software and needs to take special processing measures. That is, the print setting command generated by the printing software is obtained, and the print setting command is used to modify the data to be printed so that the modified data to be printed can meet the predefined specifications of the printer. The print setting command is used to set the specific printing parameters of the data to be printed. Therefore, using the print setting command to modify the data to be printed can enable the modified data to be printed to be normally recognized and printed by the printer. By modifying the print setting command generated by the printing software to the data to be printed according to the printing specifications of the printer, the modified data to be printed can be correctly understood and printed by the printer. Printing errors or anomalies caused by command incompatibility can be avoided, thereby improving the accuracy and stability of printing.
[0039] It is to be understood that both the foregoing general description and the following detailed description are exemplary, and are intended to provide further explanation of the technology as claimed. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The above and other purposes, features, and advantages of the present application will become more apparent through a more detailed description of the embodiments of the present application in conjunction with the accompanying drawings. The accompanying drawings are intended to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. In the drawings, the same reference numerals generally represent the same components or steps.
[0041] Figure 1 is a schematic diagram illustrating an existing printing system according to an embodiment of the present application;
[0042] Figure 2 is a schematic diagram illustrating a printing system according to an embodiment of the present application;
[0043] Figure 3 is a flow chart illustrating a data processing method according to an embodiment of the present application;
[0044] Figure 4 is a flow chart further illustrating the data processing method according to an embodiment of the present application;
[0045] Figure 5 is a flow chart further illustrating the data processing method according to an embodiment of the present application;
[0046] Figure 6 is a schematic structural diagram illustrating a data processing device according to an embodiment of the present application;
[0047] Figure 7 is a hardware block diagram illustrating a computing device according to an embodiment of the present application. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solutions and advantages of this application more apparent, the following exemplary embodiments of this application will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of this application, rather than all the embodiments of this application, and it should be understood that this application is not limited to the exemplary embodiments described herein.
[0049] The technical solution of the present application can be applied to file printing scenarios in the Linux operating system. The printer driver converts data that the printer cannot print into data that can be printed, so that the printer can print files normally, solving the technical problem that the printer cannot print special data.
[0050] In related technologies, Figure 1 An example diagram of a conventional printing system is shown. Figure 1 The printing system may include a computing device 10 and a printer 20. The computing device 10 may use a Linux operating system or other operating systems developed based on the Linux system, and the operating system may be installed with application programs such as a printing program 10a, a CUPS (Common UNIX Printing System) program 10b, and a printer driver (filter program) 10c.
[0051] The print program 10a can be user-facing and provide services such as file browsing and printing. When the print program 10a detects that a user has triggered a print operation for a page to be printed, it can invoke the CUPS program 10b to convert the page to be printed into a PDF or PostScript file. The file is then transmitted to the printer driver 10c provided by the device manufacturer. The printer driver 10c executes existing driver methods to convert the file transmitted by CUPS into data that the printer can recognize. The converted data is then sent to the printer 20, which then prints the corresponding data.
[0052] However, printer drivers can recognize files of fixed data types. For example, the current version of CUPS only supports data types such as PDF or PostScript, and cannot process other types of print languages (such as PCL). Therefore, printer drivers for Linux systems do not have modules for processing PCL. However, the inventors have discovered that some Linux-based printing programs may issue print data described in languages such as PCL that are not supported by CUPS. If the printer driver cannot distinguish this special print data from regular print data, it may cause errors in the print results.
[0053] In particular, when the printer 20 is a security-enhanced printer, if the printer driver cannot recognize and encrypt the data in a special format, but directly sends the data in the special format to the printer, the printer cannot perform security verification on the data and execute the corresponding printing process, which also causes printing failure.
[0054] In order to solve the above problems, in order to solve the problem of printing data in special formats, the embodiment of the present application combines with the printing software to obtain the print setting commands generated by the printing software, and modifies the data in the data to be printed that is related to the print setting commands that do not comply with the predefined printing specifications of the printer to obtain the modified data to be printed, so that the modified data to be printed complies with the predefined specifications of the printer and can be printed normally by the printer.
[0055] The technical solutions of the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0056] Figure 2 A schematic diagram of a printing system provided in an embodiment of the present application, wherein the printing system is Figure 1 The difference of the printing system shown is that the printer driver 10c can execute the data processing method provided by this application. In the technical solution of this application, the printing program 10a can be divided into document printing software 10a1 and general printing software 10a2.
[0057] The data output by printing software may not be supported by CUPS, but the data output by common printing software can be supported by CUPS.
[0058] In an embodiment of the present application, the data to be printed output by the printing software is input into the CUPS program. Since the CUPS program does not support the data to be printed, the data to be printed is sent to the printer driver. The printer driver can be specifically used to execute: 201, data processing, that is, receiving the data to be printed sent by the CUPS program. 202, source identification, that is, identifying the data source of the data to be printed. 203, source discrimination, that is, judging whether the data source of the data to be printed includes the printing software. If so, execute 204 command acquisition, that is, obtain the print setting command generated by the printing software. Then execute 205 data modification, modify the data to be printed according to the print setting command, so that the modified data to be printed meets the predefined specifications of the printer. If not, execute 206 and execute the existing driver processing method.
[0059] In some designs, the modified data to be printed may also be encrypted to obtain encrypted data, and the encrypted data may be sent to the security-enhanced printer 20 .
[0060] It should be noted that Figure 1 and Figure 2 In the printing system shown, the printer driver 10c is set in the computing device. In some possible designs, the printer driver can also be set on a server that has a communication relationship with the computing device and the printer. The embodiment of the present application does not impose too many restrictions on the device that executes the printer driver.
[0061] Exemplarily, the printing system may include a computing device and a printer. The computing device may be installed with a CUPS program, a printing program, and document printing software. The printer may be installed with a printer driver. The computing device executes the print triggering and format conversion of the pages to be printed, and the printer executes the data processing method provided in the embodiments of the present application.
[0062] like Figure 3 FIG. 1 is a flowchart of a data processing method provided in an embodiment of the present application. The method may be configured as a data processing device, which may be located in a computing device. The data processing method may include the following steps:
[0063] S301: The printer driver receives data to be printed.
[0064] S302: Identify the data source of the data to be printed.
[0065] The execution subject of the present application may be a computing device, and specifically the data processing method of the present application may be executed by a printer driver installed on the computing device.
[0066] The printer driver may refer to a driver provided by a printer manufacturer for the printers it produces.
[0067] The data to be printed can be a file or data stream constructed using a page description language. Specifically, under Linux systems, printer drivers usually receive print data sent by CUPS. CUPS directly outputs data in PDF or PS format. In this case, the data to be printed can be the data stream corresponding to the PDF file or PS file. If CUPS receives data that it does not support, such as PCL data, it will transparently pass the PCL data to the printer driver. In this case, the data to be printed can be a PCL data stream. Transparent transmission means that CUPS does not modify or process the data content in any way and passes it to the printer driver in its entirety.
[0068] The data source of the data to be printed may refer to the program type / category of the printing program of the data to be printed. In this embodiment, the printing programs are divided into two types, one is document printing software and the other is general printing software.
[0069] Typically, standard printing software converts pages to be printed into data to be printed by calling the CUPS program. Because the printer driver is compatible with the operating system, it defaults to treating the received data as PDF or PS files supported by the CUPS program. Printing software can be a variety of printing-related applications. Some of this software has its own format conversion capabilities, allowing it to send data in formats not supported by CUPS. This data stream is then transmitted to the printer via the CUPS program's transparent transmission feature. Therefore, the source of the data can be determined by whether the data format received by the printer driver is in a format supported by CUPS. If it is in a format not supported by CUPS, it can be inferred that it originated from the printing software. For example, if the current version of the CUPS program only supports PDF and PS formats, then if the data stream received by the printer driver is in a format other than PDF and PS (such as PCL), the data source can be assumed to be the printing software. It is understood that as the CUPS program is updated, the types of formats it supports may change, and the process of determining the data source based on the data format can be adjusted accordingly.
[0070] Optionally, the printer driver may determine the data source of the data to be printed according to the print description language of the data to be printed.
[0071] It is understood that the printing software can display the file that the user wants to print, and the page displaying the file can become the print page. The printing software can send the data stream corresponding to the print page, that is, the data to be printed, to the CUPS program. However, in some cases, the CUPS program may not support the data stream input by the printing software and cannot perform corresponding processing on the data stream. Therefore, the CUPS program directly sends the data to be printed to the printer driver.
[0072] S303: If the data source of the data to be printed includes printing software, obtain a print setting command generated by the printing software, where the print setting command is used to set specific printing parameters of the data to be printed; the printing software is used to replace at least part of the functions of the printer driver.
[0073] The data source of the data to be printed may include a printing program, a CUPS program, etc. The printing program may be a document printing software or a common printing program.
[0074] Printing software can be used to replace at least some of the functions of a printer driver. Specifically, the printing software can replace at least one of the following functions in the printer driver: print data generation function, print data conversion function, and print data delivery function. The print data generation function may refer to the function of generating a page to be printed or setting printing parameters. The print data conversion function may refer to the function of converting a page to be printed into data to be printed, or performing format conversion on the data to be printed. For example, the function of converting a page to be printed into a page description language file or performing format conversion between two page description language files. The print data delivery function may refer to the function of sending the data to be printed to the CUPS program or printer.
[0075] Some document printing software is designed to replace some of the printer driver's functions, eliminating the need for printer driver processing. Instead, the software directly generates print commands that the printer can recognize, facilitating the installation, deployment, and application of document printing management systems. Therefore, these documents printing software can replace the printer driver to implement one or more of the following functions: print data generation, print data conversion, and print data transmission. However, this may cause some print processing anomalies. Specifically:
[0076] When the printing software performs parameter settings instead of the printer driver, the parameters in the data to be printed may not meet the parameter specifications of the printer. After the data to be printed is sent to the printer, the printing result may not meet the user's expectations.
[0077] When the file software performs format conversion instead of the print driver, the printing software may not be able to determine the formats supported by the printer, resulting in the converted print data sometimes not being correctly processed by the printer.
[0078] When printing software transmits print data instead of the print driver, for example, bypassing the printer driver and sending the data to be printed directly to the printer, if the target printer is a secure printer that can only receive encrypted data, the data to be printed will not be correctly recognized by the printer because it has not undergone encryption and two-way authentication processing by the printer driver.
[0079] As can be seen, if printing software performs any one or more of the print data generation, print data conversion, and print data delivery functions in place of the printer driver, anomalies may occur. Therefore, it is necessary to identify whether the data source of the data to be printed includes the printing software. If the data source is determined to include file software, the print setting commands generated by the printing software are obtained to determine the printing software's intent. Print setting commands can be program instructions used by the printing software to generate the data to be printed, and they contain information related to the print settings.
[0080] S304 : Modify the data to be printed according to the print setting command, so that the modified data to be printed conforms to the predefined printing specification of the printer.
[0081] Optionally, after obtaining the modified data to be printed, corresponding data processing may be performed on the modified data to be printed, and the processed data may be sent to the printer.
[0082] Furthermore, performing corresponding data processing on the modified data to be printed and sending the processed data to the printer may include: encrypting the data to be printed and sending the encrypted data to the printer.
[0083] Optionally, modifying the data to be printed according to the print setting command may include: deleting data related to the print setting command in the data to be printed, generating new data related to the print setting command according to the predefined printing specifications of the printer, and adding the new data to the location of the deleted data to obtain the modified data to be printed.
[0084] It is understood that the print setting command can be used to set specific print parameters of the data to be printed. The print setting command can be, for example, a command such as "double-sided printing" or "print paper type".
[0085] It is also understandable that the data to be printed includes data related to the print setting command. For example, "01" in the data to be printed may represent "double-sided printing".
[0086] There are multiple types of print setting commands corresponding to print parameters. For example, some print parameters are controlled by PJL commands, others by PCL commands, and some are controlled by both (i.e., the same function parameter is set by both PCL and PJL commands).
[0087] Optionally, when modifying the data related to the print setting command in the data to be printed, modification methods such as adding, modifying and / or deleting may be included.
[0088] For example, the data related to the print setting command can be modified or deleted, or the data related to the print setting command can be added as a new piece of data to the modified data to be printed.
[0089] Furthermore, a new data row may be added after the corresponding print setting command to obtain the modified data to be printed.
[0090] For example, in a Linux system, the printer driver determines that the data source of the data to be printed includes printing software, and then obtains the print setting command issued by the printing software by calling a command acquisition function (such as cupsParseOptions() or cupsGetOption()). For example, if the printing software calls the print setting command lp test.pcl–osides=two-sided-long-edge, the printer driver can obtain the printing software's print setting command after calling cupsParseOptions() or cupsGetOption() and determine that the printing software's intention is to issue a duplex long-edge flip job based on "sides=two-sided-long-edge". Then, the printer driver determines whether the printing software correctly issued the duplex job based on the actual received data stream. For example, if the data stream describes @PJL SET DUPLEX=OFF, that is, duplex printing is "no", or the PCL command data stream does not contain the DuplexPageMod=eDuplexHorizontalBinding command, it means that the printing software's intention is inconsistent with the actual data stream issued. This may be caused by differences in parameter specifications. At this time, the printer driver can correct the data stream according to the printing software's intention so that the printer can complete the print job according to the duplex long-edge flip.
[0091] In another example, suppose the printing software uses the command "lp test.pcl –oStapleJob=TopDual" to specify top-stapling, but the stapling parameters are not included in the data stream. This may be because functions like stapling and hole punching don't have standard PCL commands and are sometimes implemented using PJL commands. However, different printer manufacturers may have different PJL command specifications, making it difficult to generate stapling parameters and include them in the data stream. In this case, the printer driver can add a new line of data to the appropriate location in the PJL command set: @PJL SET LSTAPLE=DUALTOP, indicating top-stapling. This ensures that the data corresponding to this print setup command conforms to the printing software's intent and the printer's predefined printing specifications. If the data source does not include the printing software, it can be assumed that no software attempting to replace the printer driver's functionality exists in this printing process, and therefore no correction is required.
[0092] Furthermore, data related to the print setting command in the data to be printed can be revised. Specifically, the data corresponding to the print setting command is revised to align with the printer's printing specifications, thereby obtaining updated data. Specifically, if "01" in the printer's printing specifications represents automatic duplex printing, while the predefined specifications in the printer memory use "00" for automatic duplex printing, then the data related to "duplex printing" in the data to be printed, "00," must be revised to "01."
[0093] For example, assuming that the data corresponding to the print setting command may be a character string “01 0C 00F8…”, the character “00” therein may be modified to “01” to obtain new data “01 0C 01F8…”.
[0094] In an embodiment of the present application, the printer driver first receives the data to be printed, and then identifies the data source of the data to be printed. When the data source of the data to be printed includes printing software, it means that the printer driver cannot directly process the data to be printed that includes the printing software, and special processing measures need to be taken. That is, the print setting command generated by the printing software is obtained, and the print setting command is used to modify the data to be printed so that the modified data to be printed can meet the predefined specifications of the printer. The print setting command is used to set the specific printing parameters of the data to be printed. Therefore, using the print setting command to modify the data to be printed can enable the modified data to be printed to be normally recognized and printed by the printer. By modifying the print setting command generated by the printing software to the data to be printed according to the printing specifications of the printer, the modified data to be printed can be correctly understood and printed by the printer. Printing errors or anomalies caused by command incompatibility can be avoided, thereby improving the accuracy and stability of printing.
[0095] like Figure 4 FIG. 1 is a flow chart of a data processing method provided in an embodiment of the present application. The data processing method may include the following steps:
[0096] S401: The printer driver receives data to be printed.
[0097] S402: Identify the type of the print description language corresponding to the data to be printed.
[0098] S403: Determine whether the printer data is of a type of print description language that is not supported by the CUPS program. If so, execute S404.
[0099] S404: If the data type is not supported by the CUPS program, the data source is identified as including printing software.
[0100] S405: If the data source of the data to be printed includes printing software, obtain a print setting command generated by the printing software, where the print setting command is used to set specific printing parameters of the data to be printed; the printing software is used to replace at least part of the functions of the printer driver.
[0101] S406 : Modify the data to be printed according to the print setting command, so that the modified data to be printed conforms to the predefined printing specification of the printer.
[0102] In the embodiment of the present application, the source of the data to be printed is determined based on the type of the print description language of the data to be printed. That is, the print description language implicitly corresponds to the source of the data, and the print description language is relatively simple to distinguish, quickly and accurately completing the data source analysis of the data to be printed, thereby improving the efficiency and accuracy of data source identification.
[0103] As described above, the printer driver can determine whether the data source includes printing software based on whether the print description language type is not supported by the CUPS program. The print description language type can be determined using a preset feature flag. Specifically, the preset feature flag can be used to determine whether the print description language type is not supported by the CUPS program. To facilitate the management of feature flags for print description languages not supported by the CUPS program, an external feature file can be added to store the corresponding feature flags.
[0104] As an embodiment, identifying the data type of the data to be printed may include the following steps:
[0105] S1. Read at least one feature flag in a feature file.
[0106] The characteristic flag may refer to a command or a character string related to a certain type of print description language, specifically a command or a character string related to a type of print description language not supported by the CUPS program.
[0107] Taking the PCL type of the print description language as an example, the at least one characteristic flag of the PCL type may include but is not limited to at least one of the following: a PCL command header, a PCL start character string, and a PCL end character string.
[0108] For example, the PCL command header can be represented by a character string “ENTER LANGUAGE=PCLXL”, the PCL start character string can be represented by “BeginSession”, and the PCL end character string can be represented by “Exit Language”.
[0109] S2. Determine whether the data to be printed contains one or more of the at least one characteristic flag. If so, execute S3; if not, execute S4.
[0110] For example, taking the example that at least one characteristic flag includes three characteristic flags: ENTER LANGUAGE=PCLXL, BeginSession, and Exit Language, if the data to be printed includes one or more of the three characteristic flags, S3 is executed.
[0111] For example, if the search and comparison determines that the data to be printed contains ENTERLANGUAGE=PCLXL and BeginSession, it means that the data to be printed conforms to the beginning of the command of the PCL data type; and if the search and comparison also determines that the data to be printed contains Exit Language, it means that the data to be printed conforms to the end of the command of the PCL data type, then it is determined that the data to be printed is PCL data, that is, the PCL data type is determined to be the data type of the data to be printed.
[0112] S3. Determine that the type of the print description language is a type not supported by the CUPS program.
[0113] S4. Determine whether the type of the print description language is a type supported by the CUPS program.
[0114] In an embodiment of the present application, to determine whether the print description language of the data to be printed is a type not supported by the CUPS program, a signature file can be used to manage at least one characteristic flag of the print description language not supported by CUPS. The characteristic flag can be updated at any time through the signature file, thereby improving the efficiency of characteristic flag management. Based on at least one characteristic flag in the signature file, it is determined whether the data to be printed contains one or more of the at least one characteristic flag, thereby determining whether the data to be printed contains a special flag. Directly performing the flag determination can improve the efficiency and accuracy of data type determination.
[0115] Optionally, in addition to including at least one feature flag related to the print description language not supported by CUPS, the feature file may also include a modification method for each feature or command or data.
[0116] Furthermore, modifying the data to be printed according to the print setting command so that the modified data to be printed conforms to the predefined printing specification of the printer may include:
[0117] The modification method is determined from the profile file according to the print setting command.
[0118] The data for representing the print job language PJL command and / or the data for representing the print control language PCL command in the data to be printed are modified according to the modification method, so that the modified data to be printed conforms to the predefined printing specification of the printer.
[0119] The modification method may refer to a data replacement method. Specifically, for a PJL command P, the correct data for PJL command P is stored in the signature file. Therefore, the data related to PJL command P in the to-be-printed data may be replaced with the correct data, so that the modified to-be-printed data conforms to the printer's predefined specifications.
[0120] It is understandable that during the data printing process, it is necessary to set printing-related functional parameters through the printing software, such as parameters related to printing setting commands such as "double-sided printing", "binding", and "punching".
[0121] Optionally, the data to be printed may include data related to print setting commands and specific print content. The print content refers to the specific data to be printed. The print command refers to a command for setting parameters related to printing. The print command needs to be revised according to the printer's printing specifications, while the print content generally does not need to be revised.
[0122] PCL commands are generally used to set corresponding printing parameters, such as paper size and paper tray. PJL commands are generally used to set specific printing parameters, such as controlling print density, binding, folding, and other printing parameters and functions. PJL commands usually precede PCL commands.
[0123] In some embodiments, PCL commands and PJL commands are used to indicate complete printing function parameters.
[0124] The following is an example of a PJL command and a PCL command:
[0125] @PJL SET LOLLORMODEL=CWYK
[0126] @PJL SET RENDERMODE=COLOR
[0127] @PJL SET PAPER=A4
[0128] @PJL SET MEDIASOURCE=AUTOSELECT
[0129] @PJL SET MEDIATYPE=PLAIN1
[0130] @PJL SET PAPERMISMATCH=ENABLE
[0131] @PJL SET REMODE=DISABLE
[0132] @PJL SET ORIENTATION=PORTRAIT
[0133] @PJL SET NOMARGINPRINT=ENABLE
[0134] @PJL ENTER LANGUAGE=PCLXL
[0135] [XL OPERATOR]Stream Header
[0136] HP-PCL XL;3;0;Comment Copyright 2020Zhuhai-
[0137] Pantum Technology Company
[0138] [XL OPERATOR]BeginSession
[0139] UnitsPerMeasure(600, 600)
[0140] ErrorReport NoReporting PCL Command
[0141] Measure Inch
[0142] [XL OPERATOR]OpenDataSource
[0143] DataOrg BinaryLowByteFirst
[0144] SourceType DefaultDataSource
[0145] [XL OPERATOR]VendorFxn
[0146] Vendor Strip Count 0
[0147] Vendor Begin Image 1752178690(0x68702002)
[0148] [XL OPERATOR]BeginPage
[0149] For example, @PJL SET RENDERMODE=RGB is a PJL command, which indicates that the currently set function parameter is "color printing".
[0150] PJL commands generally begin with a first string (e.g., %-12345X) and end with a second string (e.g., @PJLENTER LANGUAGE=PCLXL). Each line in between represents a command, and the beginnings of each command can be the same or different. Furthermore, PJL commands are not sequence-sensitive, so you can insert PJL command parameters supported by the printer at any point in the command.
[0151] In an embodiment of the present application, after the data source is identified as including document printing software, a modification method corresponding to the print setting command can be determined from the feature file, thereby modifying the data for representing the print task language PJL command and / or the data for representing the print control language PCL command in the data to be printed according to the modification method, so that the modified data to be printed conforms to the predefined printing specifications of the printer, thereby ultimately completing the printing of the data to be printed. This enables parsing and modifying the print setting command for the data to be printed for specific document printing software, solving the problem that current printer drivers cannot directly print data of a type not supported by the CUPS program, ensuring that all print tasks of the document printing software can be normally printed by a printer including the printer driver provided by the embodiment of the present application, thereby increasing printer compatibility and effectively improving the printing success rate.
[0152] Furthermore, based on any of the above embodiments, the printer driver receiving the data to be printed may refer to the printer driver receiving the data to be printed sent by the CUPS program. The data to be printed may be sent to the printer driver by the CUPS program.
[0153] Specifically, a printing program (such as a document printing software or a common printing software) may display a page to be printed, and the page to be printed may refer to a page displaying a file to be printed.
[0154] In an embodiment of the present application, for a specific printing scenario, the printer driver can receive the data to be printed sent by the CUPS program. If the print description language of the data to be printed is a type not supported by CUPS, the data to be printed is sent by the printing software, thereby achieving accurate analysis of the data source of the data to be printed.
[0155] Furthermore, based on any of the above embodiments, obtaining the print setting command generated by the printing software may include:
[0156] Recognizing preset keywords in the data to be printed to obtain a print setting command;
[0157] Alternatively, an application programming interface API related to obtaining a print setting command is called to obtain the print setting command.
[0158] It is understood that the data to be printed may include data related to print setting commands, and this data may be pre-set keywords for the print commands. For example, if the pre-set keyword for "double-sided printing" is "01," then when "01" is read, it is determined that a print setting command for "double-sided printing" exists. Therefore, keywords for each print setting command can be pre-set. If a pre-set keyword is detected in the data to be printed, the print setting command matching the keyword can be determined.
[0159] It is also understood that the steps related to obtaining print setting commands can be packaged into a plug-in or a third-party program. The plug-in or third-party program can provide an API for the printer driver to call. Therefore, the printer driver can query the API related to obtaining print setting commands and quickly complete the acquisition of print setting commands through the API.
[0160] In the embodiment of the present application, the print setting command can be directly obtained through keyword recognition, which is simple and efficient. Alternatively, the print setting command can be obtained by calling an API, reducing local processing pressure and improving the efficiency and accuracy of obtaining the print setting command.
[0161] Furthermore, based on any of the above embodiments, the printer may be a security-enhanced printer. Figure 5is a flow chart further illustrating a data processing method according to an embodiment of the present application. The method differs from other embodiments in that, after modifying the data to be printed according to the print setting command so that the modified data to be printed conforms to the predefined printing specifications of the printer, the method may further include:
[0162] S501 , encrypting the modified data to be printed to obtain encrypted data.
[0163] S502: Send the encrypted data to the security-enhanced printer, so that the security-enhanced printer decrypts the encrypted data to obtain the decrypted data to be printed, and prints the data content in the decrypted data to be printed according to the print setting command.
[0164] It is understood that a security-enhanced printer may refer to a printer that requires security verification of received data.
[0165] For example, the printer driver may encrypt received data to obtain encrypted data. The printer driver may be installed in a computing device. Under the control of the printer driver, the computing device may send the encrypted data to the security-enhanced printer. The security-enhanced printer may receive the encrypted data sent by the computing device and decrypt the encrypted data to obtain decrypted data.
[0166] It is understood that the encryption algorithm of the computing device and the decryption algorithm of the security-enhanced printer may correspond, that is, the decryption algorithm can decrypt the encrypted data obtained by the encryption algorithm. The specific types of the encryption algorithm and the decryption algorithm are not limited in the present embodiment.
[0167] In an embodiment of the present application, when faced with to-be-printed data of a first data type that cannot be processed by a printer driver, after command conversion and data modification, the modified print data can be encrypted by the printer driver to obtain encrypted data, which is then sent to the security-enhanced printer. The security-enhanced printer can normally perform security verification on the encrypted data and print it after verification is passed. This solves the problem of the security-enhanced printer being unable to print unverified to-be-printed data due to the printer driver's inability to encrypt the to-be-printed data. This ensures the complete execution of the security printer's printing process, and improves printing security while ensuring that data in a special format is normally printed.
[0168] like Figure 6 FIG. 1 is a schematic diagram of a data processing device according to an embodiment of the present application. The data processing device 600 may be located in a computing device and is specifically configured to execute a data processing method executed by a printer driver. The data processing device may include:
[0169] The data receiving unit 601 is used for the printer driver to receive data to be printed.
[0170] The source identification unit 602 is used to identify the data source of the data to be printed.
[0171] The command acquisition unit 603 is used to acquire a print setting command generated by the printing software if the data source of the data to be printed includes printing software. The print setting command is used to set specific printing parameters of the data to be printed; the printing software is used to replace at least part of the functions of the printer driver.
[0172] The data modification unit 604 is configured to modify the data to be printed according to the print setting command, so that the modified data to be printed conforms to the predefined printing specification of the printer.
[0173] As an embodiment, the device is located in an operating system pre-installed with the universal Yonex printing system CUPS program. The source identification unit 602 may include:
[0174] The type identification module is used to identify the type of the printing description language corresponding to the data to be printed.
[0175] The type judgment module is used to judge whether the type of the print description language is a type not supported by the CUPS program.
[0176] The software determination module is used to identify the data source as including printing software if the data source is of a type not supported by the CUPS program.
[0177] As another embodiment, the type determination module may be specifically used to:
[0178] Read at least one feature flag in the feature file; if the data to be printed contains one or more of the at least one feature flag, determine that the type of the print description language is a type not supported by the CUPS program; if the data to be printed does not contain one or more of the at least one feature flag, determine that the type of the print description language is a type supported by the CUPS program.
[0179] As another embodiment, the printing software is used to replace at least one of the following functions of the printer driver:
[0180] Print data generation function, print data conversion function, and print data delivery function.
[0181] As yet another embodiment, the command acquisition unit may include:
[0182] A first recognition module is configured to recognize a preset keyword in the data to be printed to obtain a print setting command; or
[0183] The second identification module is configured to call an application programming interface (API) related to obtaining a print setting command to obtain the print setting command.
[0184] As yet another embodiment, the data modification unit is specifically configured to:
[0185] Determine the modification method from the feature file according to the print setting command; modify the data for representing the print task language PJL command and / or the data for representing the print control language PCL command in the data to be printed according to the modification method, so that the modified data to be printed conforms to the predefined printing specifications of the printer.
[0186] As yet another embodiment, the printer is a security-enhanced printer, further comprising:
[0187] The data encryption unit is used to encrypt the modified data to be printed to obtain encrypted data.
[0188] The data sending unit is used to send the encrypted data to the security-enhanced printer so that the security-enhanced printer decrypts the encrypted data to obtain the decrypted data to be printed, and prints the data content in the decrypted data to be printed according to the print setting command.
[0189] It should be understood that the data processing apparatus herein is embodied in the form of a functional unit. The term "unit" herein may refer to an application specific integrated circuit (ASIC), an electronic circuit, a processor (e.g., a shared processor, a dedicated processor, or a group processor, etc.) and memory for executing one or more software or firmware programs, combined logic circuits, and / or other suitable components that support the described functionality.
[0190] Figure 7 A schematic block diagram of another computing device 700 provided in an embodiment of the present application is shown. The computing device 700 includes a processor 701 and a memory 702. The processor 701 and the memory 702 communicate with each other via an internal connection path. The memory 702 is used to store computer programs, including but not limited to printer drivers, CUPS programs, and printing programs.
[0191] The processor 701 is configured to execute the printer driver stored in the memory 702 to perform any of the above-mentioned data processing methods.
[0192] Optionally, the memory 702 may include read-only memory and random access memory, and provide instructions and data to the processor. A portion of the memory may also include non-volatile random access memory. For example, the memory may also store device category information. The processor 701 may be configured to execute a computer program stored in the memory, and when the processor 701 executes a printer driver stored in the memory, the processor 701 is configured to execute the various steps and / or processes of the aforementioned data processing method embodiment corresponding to the printer driver.
[0193] It should be understood that in the embodiments of the present application, the processor of the above-mentioned device may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
[0194] The basic principles of the present application have been described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, and effects mentioned in this application are merely illustrative and not restrictive, and it should not be assumed that these advantages, strengths, and effects are required of each embodiment of this application. In addition, the specific details disclosed above are merely illustrative and facilitating understanding, and are not restrictive. The above details do not limit this application to necessarily being implemented using the above specific details.
[0195] The block diagrams of the devices, devices, equipment, and systems involved in this application are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, devices, equipment, and systems can be connected, arranged, or configured in any manner. Words such as "include," "comprise," "have," and the like are open-ended words, meaning "including but not limited to," and can be used interchangeably therewith. The words "or" and "and" used herein refer to the words "and / or" and can be used interchangeably therewith, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to," and can be used interchangeably therewith.
[0196] Additionally, as used herein, "or" used in a list of items beginning with "at least one" indicates a separate list, so that, for example, a list of "at least one of A, B, or C" means A or B or C, or AB or AC or BC, or ABC (i.e., A and B and C). Furthermore, the word "exemplary" does not mean that the example described is preferred or better than other examples.
[0197] It should also be noted that in the system and method of the present application, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present application.
[0198] Various changes, substitutions, and modifications may be made to the technology herein without departing from the teachings defined by the appended claims. Furthermore, the scope of the claims herein is not limited to the specific aspects of the processes, machines, manufactures, compositions of things, means, methods, and actions described above. Currently existing or later developed processes, machines, manufactures, compositions of things, means, methods, or actions that perform substantially the same functions or achieve substantially the same results as the corresponding aspects herein may be utilized. Accordingly, the appended claims include within their scope such processes, machines, manufactures, compositions of things, means, methods, or actions.
[0199] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present application. Therefore, the present application is not intended to be limited to the aspects shown herein, but rather to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0200] The above description has been provided for the purpose of illustration and description. Furthermore, this description is not intended to limit the embodiments of the present application to the forms disclosed herein. Although a number of example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations thereof.
Claims
1. A data processing method, characterized in that: include: The printer driver receives the data to be printed; Identifying a data source of the data to be printed; If the data source of the data to be printed includes printing software, obtaining a print setting command generated by the printing software, wherein the print setting command is used to set specific printing parameters of the data to be printed; The printing software is used to replace at least part of the functions of the printer driver; The data to be printed is modified according to the print setting command so that the modified data to be printed complies with a predefined printing specification of the printer.
2. The method according to claim 1, characterized in that The method is applied to an operating system pre-installed with the universal Yonex printing system CUPS program, and the data source of the data to be printed is identified by: Identifying the type of the print description language corresponding to the data to be printed; Determining whether the type of the print description language is a type not supported by the CUPS program; If the data source is of a type not supported by the CUPS program, the data source is identified as including the printing software.
3. The method according to claim 2, characterized in that The determining whether the type of the print description language is a type not supported by the CUPS program includes: Read at least one characteristic flag in the characteristic file; If the data to be printed includes one or more of the at least one characteristic flag, determining that the type of the print description language is a type not supported by the CUPS program; If the data to be printed does not include one or more of the at least one characteristic flag, it is determined that the type of the print description language is a type supported by the CUPS program.
4. The method according to claim 3, characterized in that Modifying the data to be printed according to the print setting command so that the modified data to be printed conforms to a predefined printing specification of the printer includes: determining a modification mode from the feature file according to the print setting command; The data for representing the print job language PJL command and / or the data for representing the print control language PCL command in the data to be printed are modified according to the modification method, so that the modified data to be printed conforms to the predefined printing specification of the printer.
5. The method according to any one of claims 1 to 4, characterized in that The printing software is used to replace at least one of the following functions of the printer driver: Print data generation function, print data conversion function, and print data delivery function.
6. The method according to any one of claims 1 to 4, characterized in that The obtaining of the print setting command generated by the printing software includes: identifying a preset keyword in the data to be printed to obtain the print setting command; or An application programming interface (API) related to obtaining a print setting command is called to obtain the print setting command.
7. The method according to any one of claims 1 to 4, characterized in that The printer is a security-enhanced printer, and the method further includes: encrypting the modified data to be printed to obtain encrypted data; The encrypted data is sent to the security-enhanced printer, so that the security-enhanced printer decrypts the encrypted data to obtain decrypted data to be printed, and prints data content in the decrypted data to be printed according to the print setting command.
8. A data processing device, characterized in that: The data processing device may include: A data receiving unit, used for the printer driver to receive data to be printed; A source identification unit, configured to identify a data source of the data to be printed; a command acquisition unit, configured to, if the data source of the data to be printed includes printing software, acquire a print setting command generated by the printing software, the print setting command being used to set specific printing parameters for the data to be printed; the printing software being used to replace at least a portion of the functions of the printer driver; A data modification unit is used to modify the data to be printed according to the print setting command so that the modified data to be printed conforms to the predefined printing specification of the printer.
9. A computing device, characterized in that including memory and processor; The memory is used to store computer programs, including printer drivers, CUPS programs, and printing software; The processor executes the data processing method according to any one of claims 1 to 7 through the printer driver.
10. A computer-readable storage medium having a printer driver stored thereon, characterized in that: When the printer driver is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Printing control method and printing control device based on CUPS system
CN112799614A
Printing control method, printing driving device, image forming apparatus, and storage medium
CN113064560A
System and method for dynamic translation of printer specific PJL commands
US20250094103A1