Printing method, medium and system for automatically inserting color pages into black and white pages
By programming and analyzing PDF files and generating printer-driven insert configuration files, automatic separation and insertion of color and black-and-white pages in digital printing is realized, solving the problems of inefficiency and difficulty in automatic identification in the prior art, and improving printing efficiency and accuracy.
Patent Information
- Application Number
- CN202510160493.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-13
- Publication Date
- 2025-06-13
AI Technical Summary
In the existing digital printing technology, manual separation and insertion are required, which leads to inefficiency, error-prone, and difficult to automatically identify and process paper of different specifications.
By programming and analyzing PDF files on a page, identifying the color dot ratio of each page, creating color and black and white page containers, counting the number of color pages to be inserted between adjacent black and white pages, and generating printer-driven insert configuration files to realize automatic insert printing.
It realizes automatic separation and insertion of black and white and color pages in PDF documents, improves printing efficiency and accuracy, reduces labor costs, and can automatically handle paper of different specifications.
Smart Images

Figure CN120144074A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of digital printing, and discloses a printing method, a system for automatically inserting color pages into black-and-white pages, and a recording medium storing a program capable of executing the method. Background Art
[0002] In the modern digital printing industry, efficient and precise digital printing and binding technologies have become the first choice of many enterprises. With the continuous progress of technology, digital printers not only have the ability of high-speed printing, but also realize the intelligent interleaf function of black-and-white and color pages through advanced software, greatly improving the production efficiency and accuracy of printed materials such as reports, books, manuals, and operation instructions.
[0003] At present, when most digital printing is carried out, in order to save costs, black-and-white / color printing needs to be carried out separately. At this time, it is necessary for manual workers to separate color pages and black-and-white pages into two files at the front end of printing. Mistakes will occur during manual separation, and the speed is slow and the efficiency is not high. During the back-end binding, manual interleafing is also required to match black-and-white and color pages into a complete book and then bind it into a volume by gluing, which is time-consuming and laborious and prone to errors.
[0004] In order to realize the full automation of the whole process of automatic recognition, rapid separation, and intelligent interleafing during printing of digital printing color and black-and-white pages, improve printing efficiency and accuracy, and reduce labor costs. It is very necessary to develop a method for software-assisted digital printer black-and-white and color intelligent interleafing. However, how to identify whether the currently printed page is a black-and-white page or a color page in the program, how to automatically insert color pages into black-and-white pages, and how to incorporate different paper sizes in the same document into the program for automatic processing to avoid situations such as printing A4 black-and-white pages on the back of A3 color pages are problems that need to be solved urgently by those skilled in the art. Summary of the Invention
[0005] In view of the above problems, the present invention provides a printing method for automatically inserting color pages into black-and-white pages. The specific scheme includes the following steps:
[0006] S1. Program to import the PDF file to be printed page by page, ignore the area setting, set the color dot ratio threshold for each page, extract each pixel in each page of the PDF file, obtain the RGB value. When the difference of RGB exceeds the color difference threshold between black and white, it is determined that this point is a color dot, otherwise it is a black dot or a white dot. If the ratio of color dots contained in the current page exceeds the color dot ratio threshold, it is determined that the current page is a color page, otherwise it is determined that the current page is a black-and-white page, and record the page number;
[0007] S2. Create a color page container and a black-and-white page container in the program; import color pages into the color page container in sequence, and import black-and-white pages into the black-and-white page container in sequence;
[0008] S3. Create a black-and-white and color insert structure container, and count the total number of color pages to be inserted between two adjacent black-and-white pages in the black-and-white page container according to the recorded page numbers; if the total number = 0, import the black-and-white pages sequentially; if the total number is greater than 0, import the required color pages to be inserted between two adjacent black-and-white pages until the last black-and-white page; if the page number of the first black-and-white page is not 1, all the color pages before the first black-and-white page also need to be imported sequentially before the first black-and-white page; if the page number of the last black-and-white page is less than the page number of the last page, all the color pages after the last black-and-white page also need to be imported sequentially after the last black-and-white page.
[0009] S4. Modify the printer driver insert template according to the arrangement order in the black-and-white and color insert structure container, generate a printer driver insert configuration file and import it into the printer driver settings to achieve automatic insert printing.
[0010] Preferably, a step of creating and marking sub-classification segments according to the page specifications in the same classification container is inserted between steps S3 and S4.
[0011] Preferably, when double-sided printing, if the total number of pages in the same sub-classification segment is odd, add a blank page of the same specification as the last page of this segment, and increment the page numbers of the subsequent pages by 1.
[0012] Preferably, the step of creating and marking sub-classification segments according to the page specifications in the same classification container includes: traversing all pages in the PDF document to be printed in sequence, obtaining the size of the current calculated PDF page, converting it into a bitmap, comparing the page size of the bitmap with the national standard paper specifications to determine the corresponding page specifications, setting the allowable error tolerance threshold within 6%, and the page specifications with an error exceeding the standard are non-standard.
[0013] Another aspect of the present invention is to provide a non-transitory readable recording medium for storing one or more programs containing a plurality of instructions, which when executed, will cause the processing circuit to execute the above-described printing method of automatically inserting color pages into black-and-white pages.
[0014] The present invention also provides a printing system for automatically inserting color pages into black-and-white pages, including a processing circuit and a memory electrically coupled thereto, characterized in that the memory is configured to store at least one program, the program contains a plurality of instructions, and the processing circuit runs the program to be able to execute the above-described printing method of automatically inserting color pages into black-and-white pages.
[0015] Compared with the prior art, the present invention has the following beneficial effects:
[0016] The present invention solves the problems of mistakes, slow speed, and low efficiency during manual separation by automatically separating black-and-white and color pages in a PDF document during printing. Through a software program to assist the digital printer in automatically inserting color pages into black-and-white pages, automatically identifying pages of different specifications, and automatically making the number of pages in the current specification printing segment even by inserting blank pages during double-sided printing, different paper sizes in the same document can be automatically processed by the program, making digital printing and binding work efficient and accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a schematic flow chart of the program automatically identifying the page specifications of a printed document in an embodiment of the present invention;
[0018] Figure 2 It is a schematic diagram of making the total number of pages in the same sub-classification segment even when it is odd in an embodiment of the present invention;
[0019] Figure 3 It is a schematic diagram of the program automatically identifying the color attributes of the pages of a printed document in an embodiment of the present invention;
[0020] Figure 4 It is a schematic flow chart of the program automatically inserting pages in an embodiment of the present invention;
[0021] Figure 5 It is a schematic diagram of generating a printer driver file with automatic page insertion in an embodiment of the present invention;
[0022] Figure 6 It is a schematic diagram of the printer running to print a document with automatic page insertion in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0023] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be described below with reference to the accompanying drawings in the embodiments of the present invention. The described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts fall within the scope of protection of the present invention.
[0024] An embodiment of a printing method for automatically inserting color pages into black-and-white pages includes the following steps:
[0025] Step 1: Import a PDF file and set conversion configurations as Figure 3 shown; mainly including judging color image tolerance, ignoring image area settings, other settings, and output retention directory settings;
[0026] Step 1.1: Determine the tolerance of color images, mainly including the color difference threshold and the proportion of color dots. After extracting each page of the PDF file, extract each pixel in each page of the PDF file to obtain the RGB value. When the difference in RGB exceeds the color difference threshold, the extracted pixel is determined to be colored. Count the total number of colored dots and the total number of pixels in each page to obtain the proportion of color dots. When the proportion of color dots exceeds the set color dot proportion threshold, the currently calculated page is determined to be a color page;
[0027] Step 1.2 Ignore image area settings, ignore the left margin, right margin, top margin, and bottom margin in the PDF page, and the unit of the set value is centimeter (cm);
[0028] Step 1.3 Other settings: Among them, determine whether to extract A2 - A0. The default extraction sizes of the system are A4, A3, and non-standard. When checking the extraction of A2 - A0, the extraction sizes are A4, A3, A2, A1, A0, and non-standard.
[0029] Step 1.4 Output save directory settings: It is divided into the directory where the source file is located and the specified directory. When checking the directory where the source file is located, the generated file will be in the directory where the source file is located. When checking the specified directory, the generated file will be in the specified directory.
[0030] Step 2: Automatically separate black and white and color in PDF. By adopting advanced color space analysis technology, it can accurately identify black and white and color content in PDF pages, and can also judge the color difference threshold and the proportion of color dots of color images. In this way, some scanned grayscale pages can be better separated into black and white, which is more practical and accurate. At the same time, the setting of ignoring the image area is added, which can better solve the problem of separating the color logo on the header of individual files into black and white pages. The system software also has a high level of automation and intelligence. Users only need to simply set parameters to achieve fast and accurate separation operations. It perfectly solves the problem of low efficiency of manual separation at the front end of digital printing that we want to solve, and greatly improves work efficiency and work accuracy. In the processing of drawing files, it can also automatically separate large and small drawings, further exerting its function and improving the efficiency of file processing at the front end of digital printing;
[0031] Step 2.1: Create classification containers, classify according to the size "A4 / A3 / non-standard", and at the same time create different sub-classification containers according to color and black and white in the classification. The process of classifying and importing PDF pages into the corresponding classification containers is as Figure 3 shown;
[0032] Step 2.1.1: Traverse all pages in the PDF;
[0033] Step 2.1.2: Obtain the size of the currently calculated PDF page and convert it into a bitmap;
[0034] Step 2.1.2: Obtain the page classification by calculating the size of the PDF page. The algorithm flow is as Figure 1 shown;
[0035] Step 2.1.2.1: Obtain the page classification through the page size. The A4 size is (210, 297), and the A3 size is (420, 297). Since there is a certain error in the extracted PDF pages, the allowed A4 tolerance size here is (220, 307), and the A3 tolerance size is (430, 307);
[0036] Step 2.1.2.2: Compare the PDF page size (width, height) with the A4 tolerance size and the A3 tolerance size in turn. Because there is landscape and portrait printing during the printing process, the width and height of the PDF page size need to be compared with the width and height of the tolerance size. As long as one method is established, the corresponding type is returned;
[0037] Step 2.1.2.3: When the judgment that the PDF page size does not match both the A4 tolerance size and the A3 tolerance size fails, return the non-standard type.
[0038] Step 2.1.3: Judge whether the classification of the current page is the same as that of the previous page. If different, go to Step 2.1.4; if the same, go to Step 2.1.6;
[0039] Step 2.1.4: Whether the total number of pages in the classification where the previous page is located is a multiple of 2. If not, go to Step 2.1.5; if so, go to Step 2.1.6;
[0040] Step 2.1.5: Insert a blank page into the classification where the previous page is located, as Figure 2 shown;
[0041] Step 2.1.6: Obtain whether the bitmap is color or black and white according to the calculated bitmap of the page. By using advanced color space analysis technology, it can accurately identify black and white and color content in the PDF page, and can also judge the color difference threshold and color dot ratio of color images. In this way, some scanned grayscale pages can be better separated into black and white, which is more practical and accurate. At the same time, the setting of ignoring the image area is added, which can better solve the problem of separating the color logo on the header of individual files into black and white pages.
[0042] Step 2.1.6.1: Obtain the bitmap of the PDF page;
[0043] Step 2.1.6.2: Traverse each pixel of the bitmap from top to bottom and from left to right;
[0044] Step 2.1.6.3: Ignore the preset top, bottom, left, and right margins;
[0045] Step 2.1.6.4: Count the colored dots (colored pixels) in the valid area, obtain the RGB of the pixels, and when the difference of the RGB exceeds the set color difference threshold, determine that pixel as a colored dot;
[0046] Step 2.1.6.5: Calculate the ratio of the counted colored dots to the total pixels in the valid area, and determine whether the ratio exceeds the preset colored dot ratio. If it is greater, it is a color page; if it is less than or equal, it is a black and white page;
[0047] Step 2.1.7: Perform intelligent classification and import it into the corresponding classification container;
[0048] Step 2.2: Export different classified PDFs from the PDF file according to the classification container. The format of the exported PDF name is: double / single - color / black and white - page number - A4 / A3 / non - standard - PDF name.pdf. For example: double - color - 197 pages - A4 - professional calculation model research report.pdf, double - black and white - 148 pages - A4 - professional calculation model research report.pdf.
[0049] Step 3: Intelligent black and white and color page insertion. Through advanced software algorithm technology, realize the whole - process automation of automatic recognition, rapid separation, and intelligent page insertion during the printing process for digital printing of black and white and color. This method greatly improves the printing and binding efficiency and accuracy, and saves the binding labor cost. Especially when dealing with books or reports containing color and black - and - white content, its advantages are particularly significant;
[0050] Step 3.1: Create and export the black and white and color page insertion structure container;
[0051] Step 3.1.1: Create the black and white and color structure {int iBegin, int iCount};
[0052] Step 3.1.2: Create the black and white and color page insertion structure container;
[0053] Step 3.1.3: Traverse the A4 black - and - white page number container (through Step 2, the A4 black - and - white page container can be obtained). If the traversal ends, enter Step 3.1.8; if the traversal does not end, enter Step 3.1.4;
[0054] Step 3.1.4: Traverse the A4 color page container;
[0055] Step 3.1.5: Count the total number of A4 color pages between two adjacent black - and - white pages; if the total number is greater than 0, perform Step 3.1.6; if the total number is less than or equal to 0, perform Step 3.1.3;
[0056] Step 3.1.6: Create black-and-white and color insert objects. When the first page is in color, iBegin = -1 (belonging to pre-insertion); when the first page is not in color, iBegin = the smaller one of two adjacent A4 black-and-white pages; iCount = the total number of A4 color pages;
[0057] Step 3.1.7: Import the black-and-white and color insert objects into the black-and-white and color insert structure container, and proceed to Step 3.1.3;
[0058] Step 3.1.8: Export the black-and-white and color insert structure container;
[0059] Step 3.2: Convert the black-and-white and color insert structure container into an insert file required by the printer driver;
[0060] Step 3.2.1: Obtain the black-and-white and color insert structure container in Step 3.1;
[0061] Step 3.2.2: Load the printer driver insert template (taking the Kemei printer as an example here);
[0062] Step 3.2.3: Modify the printer driver insert template according to the format required by the printer driver for the black-and-white and color insert structure container;
[0063] Step 3.2.4: Generate the printer driver insert configuration file.
[0064] Step 3.3: Black-and-white and color intelligent insertion;
[0065] Step 3.3.1: Import the generated insert configuration file into the printer driver, as Figure 5 shown;
[0066] Step 3.3.2: Through printer driver settings, at this time the printed document will be automatically inserted and printed according to the driver settings;
[0067] Step 3.3.3: When a color page needs to be inserted, the driver will automatically read the paper tray where the color page is placed and perform an automatic insertion operation according to the insert settings;
[0068] Step 3.3.4: After the color pages are inserted, the printer will automatically return to black-and-white printing operation according to the driver;
[0069] Step 3.3.5: In this way, the insertion process is looped until the entire printed document is completely printed and inserted, see Figure 6 .
[0070] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) that contain computer-usable program code.
[0071] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be realized by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate means for realizing the functions specified in Figure 1 one or more of the flows Figure 1 or blocks or the combination of blocks.
[0072] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing devices to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including instruction means, and the instruction means realizes the functions specified in Figure 1 one or more of the flows Figure 1 or blocks or the combination of blocks.
[0073] These computer program instructions can also be loaded onto a computer or other programmable data processing devices, so that a series of operation steps are executed on the computer or other programmable devices to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable devices provide steps for realizing the functions specified in Figure 1 one or more of the flows Figure 1 or blocks or the combination of blocks.
[0074] Compiling the above method steps into a program and then storing it on a hard disk or other non-transitory storage medium constitutes an embodiment of the "non-transitory readable recording medium" of the present invention; and electrically connecting the storage medium to a computer processor and being able to complete the printing of automatically inserting color pages into black-and-white pages through data processing constitutes an embodiment of the "printing system for automatically inserting color pages into black-and-white pages" of the present invention.
[0075] Finally, it should be noted that the above are only preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or perform equivalent replacements for some of the technical features. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A printing method for automatically inserting a color page into a black and white page, characterized in that The following steps are involved: S1. Program to import the PDF file to be printed page by page, ignore the regional settings, set the color dot ratio threshold for each page, extract each pixel in each page of the PDF file, obtain the RGB value, and when the RGB difference exceeds the black and white color difference threshold, the point is judged as a color point, otherwise it is a black point or a white point. If the ratio of the color dots contained in the current page exceeds the color dot ratio threshold, the current page is judged as a color page, otherwise it is judged as a black and white page, and the page number is recorded; S2. Create a color page container and a black and white page container in the program; import the color pages into the color page container in sequence, and import the black and white pages into the black and white page container in sequence; S3. Create a black-and-white color insert structure container, and count the total number of color pages to be inserted between two adjacent black-and-white pages in the black-and-white page container according to the recorded page number; if the total number = 0, then import the black-and-white pages in sequence; if the total number is greater than 0, then import the color pages to be inserted between the two adjacent black-and-white pages until the last black-and-white page; if the page number of the first black-and-white page is not 1, all color pages before the first black-and-white page must be imported in sequence before the first black-and-white page; if the page number of the last black-and-white page is less than the page number of the last page, all color pages after the last black-and-white page must be imported in sequence after the last black-and-white page; S4. Modify the printer driver insert template according to the arrangement order in the black and white color insert structure container, generate a printer driver insert configuration file and import it into the printer driver settings to achieve automatic insert printing.
2. A printing method for automatically inserting a color page into a black-and-white page according to claim 1, characterized in that: A step of creating and marking sub-classification segments according to page specification order in the same classification container is inserted between steps S3 and S4.
3. A printing method for automatically inserting a color page into a black-and-white page according to claim 2, characterized in that: When printing on both sides, if the total number of pages in the same sub-category is an odd number, a blank page of the same specification will be added as the last page of the segment, and the page numbers of subsequent pages will be increased by 1.
4. A printing method for automatically inserting a color page into a black-and-white page according to claim 3, characterized in that: The steps of creating and marking sub-classification segments according to page specification order in the same classification container include: traversing all pages in the PDF document to be printed in order, obtaining the size of the current calculated PDF page and converting it into a bitmap, comparing the page size of the bitmap with the national standard paper specification, determining the corresponding page specification, setting the allowable tolerance threshold within 6%, and the out-of-tolerance page specification is non-standard.
5. A non-transitory readable recording medium for storing one or more programs including a plurality of instructions, characterized in that: When the instruction is executed, the processing circuit will be caused to execute a printing method for automatically inserting a color page into a black-and-white page as described in any one of claims 1-4.
6. A printing system for automatically inserting color pages into black and white pages, characterized in that It includes a processing circuit and a memory electrically coupled thereto, wherein the memory is configured to store at least one program, the program includes a plurality of instructions, and the processing circuit runs the program to execute a printing method for automatically inserting a color page into a black-and-white page as described in any one of claims 1-4.