File printing method, device and equipment based on stylus printer and storage medium
By means of technical means for the dot matrix printer and the target file, the technical problems existing in the prior art are solved, the problems of blurred fonts and broken strokes when the dot matrix printer prints PDF files are solved, and the printing quality and readability are improved.
Patent Information
- Application Number
- CN202510774061.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-11
- Publication Date
- 2025-09-19
AI Technical Summary
When printing PDF files, especially when using fonts such as Songti, dot matrix printers may have problems with fuzzy and unclear fonts. This is especially due to the lack of support for vector graphics in the existing technology, which leads to font rendering and display problems.
The target printing file is converted into a bitmap image by performing a first format conversion, and then converted into an image in a pixel color coding format including transparency, and then image optimization processing is performed, including sharpening and binarization processing, to improve font clarity.
It significantly improves the printing quality of dot matrix printers, avoids font blur and stroke breakage, and improves the clarity and readability of character edges.
Smart Images

Figure CN120669935A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of printing technology, and in particular to a file printing method, device, equipment and storage medium based on a dot matrix printer. Background Art
[0002] Dot matrix printers are a type of printing device widely used in scenarios such as bill printing, tax invoices, and bank vouchers. They are widely used in many industries due to their low cost, durability, and ability to adapt to a variety of paper.
[0003] However, when printing PDF (Portable Document Format) files, especially when using vector fonts like Songti, dot-matrix printers often produce blurry and unclear fonts, affecting print quality and readability. Dot-matrix printers typically use command sets like ESC / P (Escape Printing) or PCL (Printer Control Language), which have limited support for vector graphics and are primarily suitable for bitmap images or simple text modes.
[0004] Therefore, when a PDF file is directly converted into a data format supported by a dot matrix printer, the font shape and spacing will change due to format compatibility issues, which will affect the printing clarity. Summary of the Invention
[0005] The present invention provides a document printing method, device, equipment and storage medium based on a dot matrix printer, so as to improve the printing quality of the dot matrix printer.
[0006] According to one aspect of the present invention, a method for printing a file based on a dot matrix printer is provided, the method comprising:
[0007] Reading a target print file and parsing file information of the target print file; wherein the target print file is a file to be printed by a dot matrix printer, and the file information includes text information, image information, vector graphics information, page layout information, and font information;
[0008] Performing a first format conversion on the target print file to convert file information of the target print file into a target bitmap image;
[0009] performing a second format conversion on the target bitmap image based on the bitmap information of the target bitmap image, converting the target bitmap image into an image in a format to be optimized; wherein the image format of the image in the format to be optimized is a pixel color coding format including transparency;
[0010] The image in the format to be optimized is subjected to image optimization processing based on the brightness information of the image in the format to be optimized, and a target printing image is generated and printed.
[0011] According to another aspect of the present invention, there is provided a document printing device based on a dot matrix printer, the device comprising:
[0012] A file parsing module is used to read a target print file and parse the file information of the target print file; wherein the target print file is a file to be printed by a dot matrix printer, and the file information includes text information, image information, vector graphics information, page layout information, and font information;
[0013] A first conversion module, configured to perform a first format conversion on the target print file, converting the file information of the target print file into a target bitmap image;
[0014] a second conversion module, configured to perform a second format conversion on the target bitmap image based on the bitmap information of the target bitmap image, converting the target bitmap image into an image in a format to be optimized; wherein the image format of the image in the format to be optimized is a pixel color coding format including transparency;
[0015] The image optimization module is used to perform image optimization processing on the image in the format to be optimized based on the brightness information of the image in the format to be optimized, generate a target printing image, and print it.
[0016] According to another aspect of the present invention, an electronic device is provided, comprising:
[0017] at least one processor;
[0018] and a memory communicatively coupled to the at least one processor;
[0019] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the file printing method based on a dot matrix printer as described in any embodiment of the present invention.
[0020] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the file printing method based on a dot matrix printer according to any embodiment of the present invention when executed.
[0021] According to another aspect of the present invention, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the file printing method based on a dot matrix printer according to any embodiment of the present invention is implemented.
[0022] The technical solution of the embodiment of the present invention greatly improves the printing quality of PDF files printed by a dot matrix printer by performing a first format conversion, a second format conversion and image optimization processing on the target printing file, and performing bitmap conversion, format conversion, sharpening and binarization processing on the target printing file, and effectively avoids the problems of blurred fonts, broken font strokes and unclear character edges in traditional dot matrix printer printing methods.
[0023] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0025] Figure 1 This is a flowchart of a method for printing a file based on a dot matrix printer according to a first embodiment of the present invention;
[0026] Figure 2 This is a flowchart of a method for printing a file based on a dot matrix printer according to a second embodiment of the present invention;
[0027] Figure 3 2 is a schematic structural diagram of a document printing device based on a dot matrix printer according to a third embodiment of the present invention;
[0028] Figure 4 The present invention is a schematic structural diagram of an electronic device for implementing the dot matrix printer-based file printing method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] Example 1
[0032] Figure 1 A flowchart of a method for printing a file based on a dot matrix printer is provided for the first embodiment of the present invention. This embodiment is applicable to the case of printing a PDF file using a dot matrix printer. The method can be executed by a file printing device based on a dot matrix printer. The file printing device based on a dot matrix printer can be implemented in the form of hardware and / or software. The file printing device based on a dot matrix printer can be configured in various general-purpose computing devices. Figure 1 As shown, the method includes:
[0033] S110: Read the target print file and parse the file information of the target print file.
[0034] The target print file may be a file to be printed by a dot matrix printer, and the file information includes text information, image information, vector graphics information, page layout information, font information, and the like.
[0035] Specifically, before starting to print, the printing program will first parse the target print file, including parsing the text information, image information, vector graphics information, page layout information, and font information of the target print file. Optionally, in an embodiment of the present invention, the format of the target print file can be applicable to any format. Preferably, the format of the target print file can be a PDF file.
[0036] S120 , performing a first format conversion on the target print file, converting file information of the target print file into a target bitmap image.
[0037] Specifically, during the first format conversion process, the file information in the target print file is converted into a bitmap image, and the file information of each page in the target print file will be rendered as a separate bitmap image. It should be noted that during the first format conversion process of the target print file, the user can specify the resolution (pixels per inch) of the converted bitmap image, and the text information and vector graphics information in the target print file will be rendered into pixel information to generate an image.
[0038] S130 : Perform a second format conversion on the target bitmap image based on the bitmap information of the target bitmap image, and convert the target bitmap image into an image in a format to be optimized.
[0039] The bitmap information of the target bitmap image may refer to file header information in a bitmap image file, such as a BMP file header. The image format of the image to be optimized may be a pixel color encoding format including transparency. For example, the image format of the image to be optimized is RGBA format.
[0040] S140 , performing image optimization processing on the image in the format to be optimized based on the brightness information of the image in the format to be optimized, generating a target printing image, and printing the image.
[0041] The image optimization processing may include image sharpening processing and image binarization processing.
[0042] It should be noted that when traditional dot matrix printers print PDF documents, the default anti-aliasing grayscale rendering method is adopted, which results in blurred character edges, especially for fonts such as Songti and Kaiti, which have thin strokes and low contrast and are difficult to print clearly. By performing image optimization processing on the optimized format image, the printing clarity of the font can be improved. For example, sharpening processing can enhance the font edges, increase the contrast, and make the font strokes clearer. Binarization processing can remove the grayscale information in the image and retain only black and white pixels, making the printed output vivid and improving readability.
[0043] Optionally, in an embodiment of the present invention, before printing the target print image, it also includes: initializing the printing parameters of the dot matrix printer according to preset printing configuration information; wherein the printing parameters may include printing resolution, zoom mode, page range and paper feed mode.
[0044] Initialize the printer to ensure that the printed content complies with the size and margins of the printing paper.
[0045] The technical solution of the embodiment of the present invention greatly improves the printing quality of PDF files printed by a dot matrix printer by performing a first format conversion, a second format conversion and image optimization processing on the target printing file, and performing bitmap conversion, format conversion, sharpening and binarization processing on the target printing file, effectively avoiding the problems of blurred fonts, broken font strokes and unclear character edges in traditional dot matrix printer printing methods, and improving the readability and archiving quality of the printed results.
[0046] Example 2
[0047] Figure 2 This is a flowchart of a method for printing a document based on a dot matrix printer provided in the second embodiment of the present invention. This embodiment further refines the above embodiment and provides specific steps for performing image optimization processing on the image in the format to be optimized based on the brightness information of the image in the format to be optimized. It should be noted that, for the parts not described in detail in the embodiment of the present invention, please refer to the relevant descriptions of other embodiments, which will not be repeated here. Figure 2 As shown, the method includes:
[0048] S210: Read the target print file and parse the file information of the target print file.
[0049] S220 , performing a first format conversion on the target print file, converting file information of the target print file into a target bitmap image.
[0050] It should be noted that the conversion method for converting the target print file into the first format can be adaptively set according to those skilled in the art. For example, a Python library can be used to convert a PDF file into a bitmap image, a Ghostscript processing tool can be used to perform the PDF file conversion to a bitmap image operation through a command line, and Adobe Acrobat software can be used to convert a PDF file into a bitmap image. The conversion method for the first format conversion is not specifically limited here.
[0051] S230 : Perform a second format conversion on the target bitmap image based on the bitmap information of the target bitmap image, and convert the target bitmap image into an image in a format to be optimized.
[0052] Optionally, a second format conversion is performed on the target bitmap image based on the bitmap information of the target bitmap image to convert the target bitmap image into an image in a format to be optimized, including: reading file header information of the target bitmap image; wherein the file header information includes width information, height information and color depth information; according to the width information and height information of the target bitmap image, traversing the color depth information of each pixel in the target bitmap image, and converting the data format of the color depth information of the pixel into a pixel color coding format including transparency; and using the target bitmap image after the pixel traversal is completed as the image in the format to be optimized.
[0053] For example, if the pixel color depth information is 24-bit color depth, that is, the pixel is represented by 3 bytes as blue (B), green (G), and red (R), the pixel does not contain transparency information. Therefore, it is necessary to add transparency channel information for the pixel. In other words, the pixel in the converted image in the optimized format has four channel information of blue (B), green (G), red (R), and transparency (A), and each channel occupies four bytes.
[0054] Traditional grayscale conversion methods may lead to the loss of pixel information in the image. By converting the bitmap image to RGBA8 format, the integrity of the image information is improved and the stability of subsequent sharpening and binarization processing is ensured.
[0055] S240: Determine a sharpening radius for sharpening processing according to image information of the image in the format to be optimized, and perform sharpening processing on the image in the format to be optimized according to the sharpening radius.
[0056] The image information may include resolution information, edge density information, and texture complexity information.
[0057] Optionally, in the embodiment of the present invention, the sharpening radius may be manually adjusted by a user, or may be automatically updated based on image information.
[0058] For example, edge density information of the image to be optimized can be calculated, and image regions with a density less than a preset density threshold can be sharpened using a first sharpening radius; and image regions with a density greater than the preset density threshold can be sharpened using a second sharpening radius. It should be noted that the first sharpening radius is smaller than the second sharpening radius, and the preset density threshold can be adaptively set by those skilled in the art.
[0059] The texture complexity of the image to be optimized can be analyzed using a gray level co-occurrence matrix (GLCM) or local variance analysis. For regions with less than a preset texture complexity, the image to be optimized is sharpened using a first sharpening radius to preserve image detail information; for regions with greater than the preset texture complexity, the image to be optimized is sharpened using a second sharpening radius to enhance image contrast. It should be noted that the preset texture complexity can be adaptively set by those skilled in the art.
[0060] For example, when printing PDF files, traditional dot matrix printers use an anti-aliased grayscale rendering method by default, resulting in blurred character edges. This is especially true for fonts such as Songti and Kaiti, which have thin strokes and low contrast, making them difficult to print clearly. Furthermore, traditional dot matrix printers use vector rendering, and fonts are easily distorted when the printer's resolution is low. Furthermore, traditional binarization methods are prone to blurring fonts, broken or thinned strokes when printing at low resolutions. Data for printing PDF files using the technical solutions of the embodiments of the present invention can be shown in Table 1.
[0061] Table 1
[0062]
[0063] S250 : performing binarization processing on the image in the format to be optimized according to the brightness information of the image in the format to be optimized.
[0064] Optionally, the image in the format to be optimized is binarized based on the brightness information of the image in the format to be optimized, including: traversing the pixel points in the image in the format to be optimized, and determining the brightness value of each pixel point based on the three primary color channel values of the pixel point; and determining the color of the pixel point after binarization based on the brightness value of the pixel point and a preset binarization threshold.
[0065] In a specific embodiment, different color weight values can be set for the three primary color channels, and the color weight values can be adaptively set according to those skilled in the art; the brightness value of the pixel point is determined by traversing the three primary color channel values of the pixel point in the image to be optimized and the color weight values corresponding to the three primary color channels; if the brightness value of the pixel point is greater than the binarization threshold, the pixel value of the pixel point is set to white; if the brightness value of the pixel point is less than the binarization threshold, the pixel value of the pixel point is set to black, thereby converting the image to be optimized into a binary image. It should be noted that the binarization threshold value can be adaptively set according to those skilled in the art.
[0066] Optionally, the binarization threshold may be dynamically adjusted according to average brightness information of the image in the format to be optimized.
[0067] Specifically, the image in the format to be optimized may have areas with uneven brightness distribution. If the brightness difference of the image in the format to be optimized is large, that is, there are dark areas and light areas, the image to be optimized can be divided into at least two sub-image areas according to the brightness information. Different sub-image areas have different corresponding brightness ranges. For different sub-image areas, a corresponding binarization threshold can be set for each sub-image area according to the average brightness information corresponding to each sub-image area, instead of using a globally fixed binarization threshold for the image in the format to be optimized.
[0068] By dynamically setting different binarization thresholds for different image areas of the image to be optimized, more image details can be retained and image quality can be improved. At the same time, the adaptability of the dot matrix printer to different print files is improved to adapt to the printing needs of different print files.
[0069] The technical solution of the embodiment of the present invention is to first sharpen the optimized format image and then perform binarization processing. The sharpening processing first enhances the font edge, making the font clearer, thereby improving the processing result of the binarization processing.
[0070] Example 3
[0071] Figure 3 This is a schematic diagram of the structure of a document printing device based on a dot matrix printer provided in the third embodiment of the present invention. Figure 3 As shown, the device includes:
[0072] The file parsing module 310 is used to read the target print file and parse the file information of the target print file; wherein the target print file is a file to be printed by a dot matrix printer, and the file information includes text information, image information, vector graphics information, page layout information, and font information;
[0073] A first conversion module 320 is configured to perform a first format conversion on the target print file, converting the file information of the target print file into a target bitmap image;
[0074] A second conversion module 330 is configured to perform a second format conversion on the target bitmap image based on the bitmap information of the target bitmap image, converting the target bitmap image into an image in a format to be optimized; wherein the image format of the image in the format to be optimized is a pixel color coding format including transparency;
[0075] The image optimization module 340 is configured to perform image optimization processing on the image in the format to be optimized based on the brightness information of the image in the format to be optimized, generate a target printing image, and print the target printing image.
[0076] The technical solution of the embodiment of the present invention greatly improves the printing quality of PDF files printed by a dot matrix printer by performing a first format conversion, a second format conversion and image optimization processing on the target printing file, and performing bitmap conversion, format conversion, sharpening and binarization processing on the target printing file, effectively avoiding the problems of blurred fonts, broken font strokes and unclear character edges in traditional dot matrix printer printing methods, and improving the readability and archiving quality of the printed results.
[0077] Optionally, the image optimization module 340 includes:
[0078] a sharpening processing unit, configured to determine a sharpening radius for sharpening processing based on image information of the image in the format to be optimized, and perform sharpening processing on the image in the format to be optimized based on the sharpening radius; wherein the image information includes resolution information, edge density information, and texture complexity information;
[0079] The binarization processing unit is used to perform binarization processing on the image in the format to be optimized according to the brightness information of the image in the format to be optimized.
[0080] Optionally, the binarization processing unit may be specifically used for:
[0081] Traversing the pixel points in the image to be optimized, and determining the brightness value of each pixel point according to the three primary color channel values of the pixel point;
[0082] The color of the pixel after binarization processing is determined based on the brightness value of the pixel and a preset binarization threshold.
[0083] Optionally, the binarization threshold is dynamically adjusted according to average brightness information of the image in the format to be optimized.
[0084] Optionally, the second conversion module 330 may be specifically configured to:
[0085] Reading the file header information of the target bitmap image; wherein the file header information includes width information, height information and color depth information;
[0086] Traversing the color depth information of each pixel in the target bitmap image according to the width information and height information of the target bitmap image, and converting the data format of the color depth information of the pixel into a pixel color coding format including transparency;
[0087] The target bitmap image after pixel traversal is completed is used as the image in the format to be optimized.
[0088] Optionally, the device further includes:
[0089] The initialization module is used to initialize the printing parameters of the dot matrix printer according to the preset printing configuration information; wherein the printing parameters include printing resolution, zoom mode, page range and paper feed mode.
[0090] The dot matrix printer-based file printing device provided in an embodiment of the present invention can execute the dot matrix printer-based file printing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0091] Example 4
[0092] Figure 4 A schematic diagram of the structure of an electronic device 410 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0093] like Figure 4 As shown, the electronic device 410 includes at least one processor 411, and a memory connected to the at least one processor 411, such as a read-only memory (ROM) 412, a random access memory (RAM) 413, etc., wherein the memory stores a computer program that can be executed by the at least one processor, and the processor 411 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 412 or the computer program loaded from the storage unit 418 to the random access memory (RAM) 413. Various programs and data required for the operation of the electronic device 410 can also be stored in the RAM 413. The processor 411, ROM 412 and RAM 413 are connected to each other via a bus 414. An input / output (I / O) interface 415 is also connected to the bus 414.
[0094] Multiple components in electronic device 410 are connected to I / O interface 415, including an input unit 416, such as a keyboard, mouse, etc.; an output unit 417, such as various types of displays, speakers, etc.; a storage unit 418, such as a magnetic disk, optical disk, etc.; and a communication unit 419, such as a network card, modem, wireless communication transceiver, etc. The communication unit 419 allows electronic device 410 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0095] Processor 411 can be various general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of processor 411 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. Processor 411 executes the various methods and processes described above, such as a dot matrix printer-based file printing method.
[0096] In some embodiments, the dot matrix printer-based file printing method can be implemented as a computer program that is tangibly contained in a computer-readable storage medium, such as storage unit 418. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 410 via ROM 412 and / or communication unit 419. When the computer program is loaded into RAM 413 and executed by processor 411, one or more steps of the dot matrix printer-based file printing method described above can be performed. Alternatively, in other embodiments, processor 411 can be configured to execute the dot matrix printer-based file printing method in any other appropriate manner (e.g., by means of firmware).
[0097] Various embodiments of the systems and techniques described above can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0098] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0099] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0100] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0101] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0102] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.
[0103] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.
[0104] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. A method for printing a document based on a dot matrix printer, characterized in that: include: Reading a target print file and parsing file information of the target print file; wherein the target print file is a file to be printed by a dot matrix printer, and the file information includes text information, image information, vector graphics information, page layout information, and font information; Performing a first format conversion on the target print file to convert file information of the target print file into a target bitmap image; performing a second format conversion on the target bitmap image based on the bitmap information of the target bitmap image, converting the target bitmap image into an image in a format to be optimized; wherein the image format of the image in the format to be optimized is a pixel color coding format including transparency; The image in the format to be optimized is subjected to image optimization processing based on the brightness information of the image in the format to be optimized, and a target printing image is generated and printed.
2. The method according to claim 1, characterized in that The performing image optimization processing on the image in the format to be optimized based on the brightness information of the image in the format to be optimized includes: Determining a sharpening radius for sharpening processing based on image information of the image in the format to be optimized, and performing sharpening processing on the image in the format to be optimized based on the sharpening radius; wherein the image information includes resolution information, edge density information, and texture complexity information; Binarization processing is performed on the image in the format to be optimized according to brightness information of the image in the format to be optimized.
3. The method according to claim 2, characterized in that The binarization processing of the image in the format to be optimized according to the brightness information of the image in the format to be optimized includes: Traversing the pixel points in the image to be optimized, and determining the brightness value of each pixel point according to the three primary color channel values of the pixel point; The color of the pixel after binarization processing is determined based on the brightness value of the pixel and a preset binarization threshold.
4. The method according to claim 3, characterized in that The binarization threshold is dynamically adjusted according to the average brightness information of the image in the format to be optimized.
5. The method according to claim 1, wherein The performing a second format conversion on the target bitmap image based on the bitmap information of the target bitmap image to convert the target bitmap image into an image in a format to be optimized includes: Reading the file header information of the target bitmap image; wherein the file header information includes width information, height information and color depth information; Traversing the color depth information of each pixel in the target bitmap image according to the width information and height information of the target bitmap image, and converting the data format of the color depth information of the pixel into a pixel color coding format including transparency; The target bitmap image after pixel traversal is completed is used as the image in the format to be optimized.
6. The method according to claim 1, characterized in that Before printing the target print image, the method further includes: Initialize and configure the printing parameters of the dot matrix printer according to the preset printing configuration information; wherein the printing parameters include printing resolution, zoom mode, page range and paper feed mode.
7. A document printing device based on a dot matrix printer, characterized in that: include: A file parsing module is used to read a target print file and parse the file information of the target print file; wherein the target print file is a file to be printed by a dot matrix printer, and the file information includes text information, image information, vector graphics information, page layout information, and font information; A first conversion module, configured to perform a first format conversion on the target print file, converting the file information of the target print file into a target bitmap image; a second conversion module, configured to perform a second format conversion on the target bitmap image based on the bitmap information of the target bitmap image, converting the target bitmap image into an image in a format to be optimized; wherein the image format of the image in the format to be optimized is a pixel color coding format including transparency; The image optimization module is used to perform image optimization processing on the image in the format to be optimized based on the brightness information of the image in the format to be optimized, generate a target printing image, and print it.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the document printing method based on a dot matrix printer according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the file printing method based on a dot matrix printer according to any one of claims 1 to 6 when the processor executes the computer instructions.
10. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the document printing method based on a dot matrix printer according to any one of claims 1 to 6.
Citation Information
Patent Citations
Print data processing method and device, computer device, and storage medium
CN109062521A
A Method for Printing Template
CN109343804A
Image printing method and device, printer and medium
CN116071261A
To-be-printed file processing method and device, electronic equipment and storage medium
CN119937945A
Print information management apparatus, print information management method, image forming apparatus, print information management system and program
US20080074691A1