Data processing method for printing operation and related equipment
By identifying and modifying the identifier parameters in the print parameter set, the problem of printing failures caused by abnormal print parameters on Linux systems was solved, achieving high printer compatibility and improved user experience.
Patent Information
- Application Number
- CN202511586308.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-31
- Publication Date
- 2026-02-24
AI Technical Summary
On certain versions of Linux systems, when printing custom paper size documents using specific office software, the printing parameters issued by CUPS are abnormal, causing the print job to fail.
By identifying whether the target application's identifier parameters exist in the print parameter set, the parameter formats for page size and printable area size are modified to conform to system specifications, ensuring that the image forming apparatus can correctly parse the print data.
This solution resolves printing failures caused by incorrect parameter formats, improves printer compatibility and adaptability, and enhances the user experience.
Smart Images

Figure CN121560253A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of printing data processing technology, and in particular to a data processing method and related equipment for printing jobs. Background Technology
[0002] The Common UNIX Printing System (CUPS) is a standard printing system widely used in Unix-like operating systems (such as Linux). It provides a unified printing interface for applications and manages print queues, drives printers, and performs other tasks. CUPS employs a modular design. Its core data processing flow, such as converting print data (e.g., PDFs) sent by applications into raster images or page description languages (e.g., PCL) that the printer can recognize, is achieved through a series of program modules called "filters." Printer manufacturers can develop specific filters according to the CUPS specifications, thereby enabling their products to better integrate with the system.
[0003] However, due to the numerous different distributions within the Linux ecosystem, the built-in versions of CUPS also vary. In practical applications, it has been found that on certain Linux distributions, when printing documents using user-defined paper sizes using specific office software such as [example software name], the printing parameters issued by CUPS become abnormal, leading to print job failures. This issue severely impacts the user experience when printing using specific applications. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a data processing method and related equipment for printing jobs that can solve the problem of printing failure caused by abnormal printing parameters.
[0005] In a first aspect, embodiments of the present invention provide a data processing method for printing jobs, including: Obtain the job data stream and set of print parameters for the target print job; Determine whether the set of printing parameters contains an identifier parameter related to the target application; If so, the first parameter in the print parameter set is modified to a first system parameter, and the second parameter in the print parameter set is modified to a second system parameter; wherein, the first system parameter is used to represent the user-defined page size; and the second system parameter is used to represent the user-defined printable area size; The job data stream is converted into a raster data stream based on the modified set of print parameters.
[0006] In one possible implementation, determining whether an identifier parameter related to the target application exists in the set of print parameters includes: Parse the set of print parameters to identify whether the set of print parameters contains specific parameters that indicate the source of the application; If the specific parameter is identified, it is determined that there is an identification parameter for the target application. In one possible implementation, the specific parameter is part of the command-line arguments.
[0007] In one possible implementation, the first parameter is a page size parameter, and the second parameter is a page area parameter.
[0008] In one possible implementation, the first system parameter and the second system parameter are determined based on the media specification parameters in the set of printing parameters.
[0009] In one possible implementation, the media specification parameter is determined by parsing the document structure information contained in the job data stream.
[0010] In one possible implementation, after converting the job data stream into a raster data stream based on the modified set of print parameters, the method further includes: The raster data stream is sent to the image forming apparatus via a preset transmission method, so that the image forming apparatus can print the target print job according to the raster data stream.
[0011] In a second aspect, embodiments of the present invention provide a data processing apparatus for printing jobs, comprising: The acquisition module is used to acquire the job data stream and set of printing parameters for the target print job; The judgment module is used to determine whether there is an identification parameter related to the target application in the set of print parameters; The modification module is used to modify the first parameter in the print parameter set to a first system parameter and the second parameter in the print parameter set to a second system parameter when the judgment module determines that there is an identifier parameter related to the target application in the print parameter set; wherein, the first system parameter is used to represent the user-defined page size; and the second system parameter is used to represent the user-defined printable area size; The conversion module is used to convert the job data stream into a raster data stream based on the modified set of printing parameters.
[0012] Thirdly, embodiments of the present invention provide an electronic device, comprising: At least one processor; and At least one memory communicatively connected to the processor, wherein: The memory stores program instructions that can be executed by the processor, and the processor can execute the method described in the first aspect by calling the program instructions.
[0013] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer instructions that cause the computer to perform the method described in the first aspect.
[0014] In this embodiment of the invention, the source of the target print job is identified by recognizing whether there are identifier parameters in the set of printed parameters issued, thereby modifying the parameters in the set of printed parameters in a targeted manner to avoid printing failure caused by incorrect printed parameters being issued to the image forming device. Attached Figure Description
[0015] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 A flowchart illustrating a data processing method for a printing job provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of a data processing device for printing jobs provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0017] To better understand the technical solution of the present invention, the embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0018] It should be understood that the described embodiments are merely some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0019] The terminology used in the embodiments of this invention is for the purpose of describing particular embodiments only and is not intended to limit the invention. The singular forms “a,” “the,” and “the” as used in the embodiments of this invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.
[0020] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0021] It should be understood that although terms such as first, second, third, etc., may be used to describe numbers in embodiments of the present invention, these numbers should not be limited to these terms. These terms are only used to distinguish numbers from each other. For example, without departing from the scope of embodiments of the present invention, a first number may also be referred to as a second number, and similarly, a second number may also be referred to as a first number.
[0022] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."
[0023] When an image forming device uses a Graphical Device Interface (GDI) as its printing language, in order to solve the problem of printing failure caused by incorrect printing parameters when printing user-defined size jobs in certain applications, this embodiment of the invention provides a data processing method for printing jobs that can solve this problem. Figure 1 A flowchart illustrating a data processing method for a printing job provided in an embodiment of the present invention. Figure 1 As shown, the method includes: Step 101: Obtain the job data stream and set of printing parameters for the target print job.
[0024] When a user issues a target print job via office software, CUPS responds to the user's action by processing the corresponding document file and generating a set of print parameters based on the user's settings. These print parameters include whether to print double-sided, the print media size, the print page area, and the print orientation.
[0025] Specifically, in the process of converting the original document file into a job data stream, CUPS calls the first filter to convert the document file into a PDF format data stream. Then, CUPS calls the first filter to convert the PDF format data stream into a PDF-to-PDF format data stream. Afterward, CUPS calls the second filter to convert the above data stream into raster data based on the set of printing parameters and sends it to the image forming apparatus. The first filter can be a system filter such as PDF-to-PDF.
[0026] The aforementioned data processing flow, a "filter chain" composed of a series of filters with specific functions, is the core of the CUPS architecture. Each filter is responsible for a specific conversion task, using the output of the previous filter as input and its output as input to the next filter, thus forming an ordered data processing pipeline. The data processing method of this invention is an improvement upon the aforementioned data processing flow. It is activated after the PDF format unification process is completed and before the second filter is called for the final rasterization conversion. Its core function is to "preprocess" and "correct" the set of printing parameters flowing to this point, ensuring that the subsequent second filter can perform the conversion based on accurate and effective parameters. If the parameters at this stage have the aforementioned format errors, the second filter will not be able to correctly understand the page size and printable area, thus generating invalid or blank raster image data, ultimately leading to printing failure. The aforementioned second filter can be a system filter such as gstoraster. Therefore, in this invention, intervening and correcting the parameters at this critical node is the core technical means to solve compatibility issues.
[0027] When users use domestic office software such as WPS or Yongzhong to print on custom media sizes, errors may occur in the print parameter set generated by CUPS due to software compatibility or adaptability issues. These errors primarily manifest as incorrect parameter formats. For example, in WPS, when a user sets the print media size to a custom 200×100, the page size parameter generated by CUPS in the WPS call is set to: PageSize=Custom, and the printable area size parameter is set to: PageRegion=Custom. However, according to the user's custom media size setting, these two parameters should be formatted as: PageSize.Custom200x100 and PageRegion=Custom.200x100. Because of these incorrect parameter formats, the image forming apparatus receives incorrect print parameter sets, leading to error messages or blank paper being printed.
[0028] Step 102: Determine if an identifier parameter related to the target application exists in the print parameter set. If yes, proceed to step 103.
[0029] The target application is the office software with the aforementioned parameter format errors. The presence of an identifier parameter related to the target application in the print parameter set determines whether the target print job was generated by domestic office software such as WPS or Yongzhong.
[0030] Specifically, by parsing the set of print parameters, it is possible to identify whether the set contains a specific parameter indicating the source of the application. If this specific parameter is identified, it is determined that an identifier parameter related to the target application exists. This specific parameter can be implemented as part of the command-line arguments. Command-line arguments are a way to pass input from the command line to the program, widely used to control program behavior or pass data required at runtime. They are typically received through the program's entry function (such as the main function in C / C++) and represented in string form.
[0031] In a specific example, domestic office software such as WPS or Yongzhong includes a specific command-line parameter. Since the print parameter set issued by WPS or Yongzhong typically includes this specific command-line parameter, while other applications do not, it's possible to determine whether the target print job was issued by WPS or Yongzhong by detecting whether the print parameter set contains this specific command-line parameter.
[0032] Step 103: Modify the first parameter in the print parameter set to the first system parameter, and modify the second parameter in the print parameter set to the second system parameter. The first system parameter represents the user-defined page size (i.e., print media size). The second system parameter represents the user-defined printable area size.
[0033] The first parameter is the page size parameter PageSize, and the second parameter is the page region parameter PageRegion. By correcting the incorrectly formatted first parameter PageSize and the incorrectly formatted second parameter PageRegion to the correct format, as in the example above, replacing PageSize=Custom and PageRegion=Custom with PageSize.Custom200x100 and PageRegion=Custom.200x100 respectively, the printing device can avoid printing failures due to receiving incorrect sets of printing parameters.
[0034] In some embodiments, the first system parameters and the second system parameters can be determined based on media specification parameters in the print parameter set. These media specification parameters include user-defined print media size and printable area size.
[0035] In some embodiments, the first system parameters and the second system parameters can also be obtained by parsing the document structure information contained in the job data stream.
[0036] Specifically, obtaining the information from the media specification parameters is an efficient and direct method. Even if the user sets a custom size in the application, CUPS often records the user's intent (i.e., the specific numerical value of the custom media size) in the media specification parameters when generating the print job. Therefore, by parsing the media specification parameter string, size information such as 200x100 can be extracted, and command-line parameters conforming to the parameter format specification, such as PageSize:Custom.200x100 and PageRegion:Custom.200x100, can be constructed. This method relies on the consistency of data within the CUPS system.
[0037] When media specification parameters are also unreliable or missing, a more fundamental PDF document parsing scheme can be used. One of the following keywords is read from the PDF file: media=Custom., PageSize=Custom. If the keyword is found, the custom size defined in the PDF file is used; otherwise, the default A4 size is used. This method does not rely on parameters passed from upstream software, but directly obtains information from the source data, offering higher reliability and versatility, thus providing a strong complement and guarantee to the previous method. Step 104: Convert the job data stream into a raster data stream based on the modified set of print parameters.
[0038] CUPS uses the correct set of print parameters to invoke a second filter (such as a gstoraster filter) to convert the job data stream into a raster data stream. CUPS then sends the converted raster data stream to the image forming apparatus via a preset transmission method (such as a wired connection like USB or a network connection like Wi-Fi). The image forming apparatus then prints the target job based on the raster data stream.
[0039] The data processing method for print jobs provided in this invention ensures that files sent from the target application can be printed in the correct format, improving printer compatibility and adaptability, avoiding printer errors or printing mistakes, and enhancing user experience. Simultaneously, by setting intelligent identification and correction mechanisms at key locations in the aforementioned filter chain, it creatively solves the compatibility problem between specific application software and the printing system, greatly improving the success rate of corrections and the system's fault tolerance.
[0040] In summary, this invention achieves significant technical effects with minor system modifications. It enables the image forming apparatus to consistently receive formatted printing instructions regardless of parameter delivery defects from upstream applications, thereby fundamentally avoiding error messages or blank printing problems caused by incorrect parameter formats. This not only improves the compatibility and adaptability of the image forming apparatus itself but also comprehensively ensures the user's printing experience and work efficiency in complex software environments.
[0041] Corresponding to the above-described data processing method for printing jobs, this embodiment of the invention provides a data processing device for printing jobs. Figure 2 This is a schematic diagram of a data processing device for printing jobs provided in an embodiment of the present invention. Figure 2 As shown, the device includes: an acquisition module 201, a judgment module 202, a modification module 203, and a conversion module 204.
[0042] The acquisition module 201 is used to acquire the job data stream and set of printing parameters for the target print job.
[0043] The judgment module 202 is used to determine whether there is an identifier parameter for the target application in the print parameter set.
[0044] The modification module 203 is used to modify the first parameter in the print parameter set to a first system parameter and the second parameter to a second system parameter when the judgment module determines that there is an identifier parameter related to the target application in the print parameter set. The first system parameter represents the user-defined page size, and the second system parameter represents the user-defined printable area size.
[0045] The conversion module 204 is used to convert the job data stream into a raster data stream based on the modified set of print parameters.
[0046] Figure 2 The data processing apparatus for print jobs provided in the illustrated embodiment can be used to execute this specification. Figure 1 The implementation principle and technical effects of the method embodiment shown can be further referred to the relevant description in the method embodiment.
[0047] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention, such as... Figure 3 As shown, the aforementioned electronic device may include at least one processor and at least one memory communicatively connected to the processor, wherein the memory stores program instructions executable by the processor, and the processor can execute this specification by calling the program instructions. Figure 1 The illustrated embodiment provides a data processing method for a printing job.
[0048] like Figure 3 As shown, the electronic device is represented in the form of a general-purpose computing device. The components of the electronic device may include, but are not limited to: one or more processors 310, communication interface 320 and memory 330, and a communication bus 340 connecting different system components (including memory 330, communication interface 320 and processor 310).
[0049] Communication bus 340 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, Industry Standard Architecture (ISA) buses, Micro Channel Architecture (MAC) buses, Enhanced ISA buses, Video Electronics Standards Association (VESA) local buses, and Peripheral Component Interconnect (PCI) buses.
[0050] Electronic devices typically include a variety of computer-readable media. These media can be any available media that can be accessed by the electronic device, including volatile and non-volatile media, and removable and non-removable media.
[0051] Memory 330 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory. The electronic device may further include other removable / non-removable, volatile / non-volatile computer system storage media. Memory 330 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments described herein.
[0052] A program / utility having a set (at least one) of program modules may be stored in memory 330. Such program modules include—but are not limited to—an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. The program modules typically perform the functions and / or methods described in the embodiments of this specification.
[0053] Processor 310 executes various functional applications and data processing by running programs stored in memory 330, such as implementing the functions described in this specification. Figure 1 The illustrated embodiment provides a data processing method for a printing job.
[0054] This specification provides a computer program product, which includes a computer program that, when executed by a processor, performs the functions described in this specification. Figure 1 The illustrated embodiment provides a data processing method for a printing job.
[0055] This specification provides a computer-readable storage medium storing computer instructions that cause a computer to execute this specification. Figure 1 The illustrated embodiment provides a data processing method for a printing job.
[0056] The aforementioned computer-readable storage medium may be any combination of one or more computer-readable media. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or flash memory, optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium that contains or stores a program that may be used by or in connection with an instruction execution system, apparatus, or device.
[0057] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0058] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this specification. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0059] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this specification, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0060] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this specification includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which the embodiments of this specification pertain.
[0061] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."
[0062] It should be noted that the devices involved in the embodiments of this specification may include, but are not limited to, personal computers (PCs), personal digital assistants (PDAs), wireless handheld devices, tablet computers, mobile phones, MP3 displays, MP4 displays, etc.
[0063] In the several embodiments provided in this specification, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms. Furthermore, the functional units in the various embodiments of this specification can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in a combination of hardware and software functional units.
[0064] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, a connector, or a network device, etc.) or a processor to execute some steps of the methods described in the various embodiments of this specification. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0065] The above description is merely a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of protection of this specification.
[0066] The same or similar parts between the various embodiments in this specification can be referred to mutually. In particular, the device embodiments and terminal embodiments are basically similar to the method embodiments, so the description is relatively simple, and the relevant parts can be referred to the description in the method embodiments.
Claims
1. A data processing method for a printing job, characterized in that, include: Obtain the job data stream and set of print parameters for the target print job; Determine whether the set of printing parameters contains an identifier parameter related to the target application; If so, the first parameter in the print parameter set is modified to a first system parameter, and the second parameter in the print parameter set is modified to a second system parameter; wherein, the first system parameter is used to represent the user-defined page size; and the second system parameter is used to represent the user-defined printable area size; The job data stream is converted into a raster data stream based on the modified set of print parameters.
2. The method according to claim 1, characterized in that, Determining whether the set of print parameters contains an identifier parameter for the target application includes: Parse the set of print parameters to identify whether the set of print parameters contains specific parameters that indicate the source of the application; If the specific parameter is identified, it is determined that there is an identification parameter for the target application.
3. The method according to claim 2, characterized in that, The specific parameter is part of the command-line arguments.
4. The method according to claim 1, characterized in that, The first parameter is the page size parameter, and the second parameter is the page area parameter.
5. The method according to claim 1, characterized in that, The first system parameter and the second system parameter are determined based on the media specification parameters in the set of printing parameters.
6. The method according to claim 5, characterized in that, The media specification parameters are determined by parsing the document structure information contained in the job data stream.
7. The method according to claim 1, characterized in that, After converting the job data stream into a raster data stream based on the modified set of printing parameters, the method further includes: The raster data stream is sent to the image forming apparatus via a preset transmission method, so that the image forming apparatus can print the target print job according to the raster data stream.
8. A data processing device for printing jobs, characterized in that, include: The acquisition module is used to acquire the job data stream and set of printing parameters for the target print job; The judgment module is used to determine whether there is an identification parameter related to the target application in the set of print parameters; The modification module is used to modify the first parameter in the print parameter set to a first system parameter and the second parameter in the print parameter set to a second system parameter when the judgment module determines that there is an identifier parameter related to the target application in the print parameter set; wherein, the first system parameter is used to represent the user-defined page size; and the second system parameter is used to represent the user-defined printable area size; The conversion module is used to convert the job data stream into a raster data stream based on the modified set of printing parameters.
9. An electronic device, characterized in that, include: At least one processor; as well as At least one memory communicatively connected to the processor, wherein: The memory stores program instructions that can be executed by the processor, and the processor can execute the method according to any one of claims 1 to 7 by calling the program instructions.
10. A computer-readable storage medium storing computer instructions that cause the computer to perform the method according to any one of claims 1 to 7.