Self-adaptive contract printing method and device, equipment and storage medium
By obtaining and adjusting the configuration information of the set-up field, the adaptive filling of the contract set-up text is achieved, solving the problem of overflow and incomplete content when generating PDF files, and improving the accuracy and adaptability of printing.
Patent Information
- Application Number
- CN202410819196.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2025-01-10
AI Technical Summary
When the prior art generates contract text through PDF files, when there are too many fields, the printed content is prone to problems such as exceeding the reserved location or being incomplete, and there is a lack of effective adaptive strategies.
By obtaining the predefined configuration information of the field of the set, generate a blank file to be set, and fill the text content to be set into the target set area according to the preset contract set adaptive strategy, adjust the font parameters and layout specifications. to ensure that the content is fully adapted when printing.
It effectively solves the problems of content overflow and incomplete printing, improves the accuracy and universality of contract patching, and ensures that the text can be fully presented when printed.
Smart Images

Figure CN119292542A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of contract duplication, and in particular to an adaptive contract duplication method, device, equipment and storage medium. Background Art
[0002] Template printing is a technology that matches contract templates with contract data, automatically fills in contract content and generates contract documents. However, most of the current solutions for generating contract template texts through PDF files can only set the position of the text when it is printed, without considering the problem that if there are too many field contents, the printed content will exceed the reserved position range or the printed content will be incomplete.
[0003] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0004] The main purpose of the present invention is to provide an adaptive contract printing method, device, equipment and storage medium, aiming to solve the problem of content overflow and incomplete printed content when there is too much content in the contract printing text generated by PDF file, so as to improve the accuracy and universality of contract printing.
[0005] To achieve the above object, the present invention provides an adaptive contract printing method, comprising:
[0006] Acquire predefined template printing field configuration information, wherein the template printing field configuration information includes text page number information and text content to be template printed;
[0007] Generate a blank file to be printed based on the text page number information;
[0008] According to a preset contract duplication adaptive strategy, the text content to be duplicated is filled in the target duplication area of the blank document to be duplicated.
[0009] Optionally, the duplication field configuration information further includes target duplication area specification parameters and target duplication area coordinates, and the step of filling the to-be-duplicated text content in the target duplication area of the to-be-duplicated blank file according to a preset contract duplication adaptive strategy includes:
[0010] Converting the text content to be printed into target format text content according to the preset contract printing adaptive strategy and the target printing area specification parameters;
[0011] Determine the target printing area in the to-be-printed file according to the coordinates of the target printing area;
[0012] Fill the target format text content in the target copy printing area.
[0013] Optionally, the template field configuration information further includes a default font parameter, and the step of converting the to-be-printed text content into a target format text content according to a preset contract template adaptive strategy and the target template area specification parameter includes:
[0014] Calculate the target format text font parameters based on the default font parameters, the target printing area specification parameters and the content of the text to be printed;
[0015] Determining the layout specifications of the to-be-printed text content based on the target format text font parameters;
[0016] The text content to be typed is converted into text content in a target format based on the layout specification.
[0017] Optionally, the step of calculating the target format text font parameters based on the default font parameters, the target printing area specification parameters and the content of the text to be printed comprises:
[0018] Calculate the maximum capacity of a single line of text and the maximum number of lines of text in the target printing area based on the default font parameters and the target printing area specification parameters;
[0019] Determine whether the target duplication area can accommodate the text content to be duplication based on the maximum capacity of the single-line text and the maximum number of lines of the regional text;
[0020] If the target copy printing area can accommodate the text content to be copied, the default font parameters are determined as the target format text font parameters.
[0021] Optionally, after the step of judging whether the target duplication area can accommodate the content of the text to be duplication based on the maximum capacity of the single-line text and the maximum number of lines of the regional text, the step further includes:
[0022] If the target printing area cannot accommodate the text content to be printed, determining whether the default font parameter is a preset minimum font parameter;
[0023] If the default font parameter is a preset minimum font parameter, determining the minimum font parameter as the target format text font parameter;
[0024] If the default font parameter is not the preset minimum font parameter, the default font parameter is reduced by the preset value and the steps are executed: based on the default font parameter and the target printing area specification parameters, the maximum capacity of a single line of text and the maximum number of lines of regional text in the target printing area are calculated.
[0025] Optionally, the step of determining the layout specifications of the to-be-printed text content based on the target format text font parameters includes:
[0026] Calculate the single-line target capacity and the number of lines of regional text target capacity of the target printing area based on the target format text font parameters;
[0027] Divide the text content to be printed based on the single-line target capacity to obtain a plurality of divided text contents to be printed;
[0028] The layout specification of the text content to be printed is determined according to the several divided text contents to be printed and the number of lines that can be accommodated by the regional text target.
[0029] The target format text font parameters include a target font line height and a target font size. The step of calculating the single-line target capacity and the number of target regional text capacity lines of the target printing area based on the target format text font parameters includes:
[0030] Calculate the single-line target capacity of the target printing area according to the target font size and the target printing area specification parameters;
[0031] The target capacity of lines of regional text in the target printing area is calculated according to the target font line height and the target printing area specification parameters.
[0032] In addition, to achieve the above-mentioned purpose, the present invention also provides an adaptive contract printing device, the adaptive contract printing device comprising:
[0033] An acquisition module, used for acquiring predefined template field configuration information, wherein the template field configuration information includes text page number information and text content to be templated;
[0034] A generating module, used for generating a blank file to be printed based on the text page number information;
[0035] The duplication printing module is used to fill the text content to be duplicated into the target duplication printing area of the blank document to be duplicated according to a preset contract duplication printing adaptive strategy.
[0036] In addition, to achieve the above-mentioned purpose, the present invention also provides an adaptive contract printing device, which includes: a memory, a processor, and an adaptive contract printing program stored in the memory and executable on the processor, wherein the adaptive contract printing program is configured to implement the steps of the adaptive contract printing method as described above.
[0037] In addition, to achieve the above-mentioned purpose, the present invention also provides a storage medium, on which an adaptive contract printing program is stored, and when the adaptive contract printing program is executed by a processor, the steps of the adaptive contract printing method described above are implemented.
[0038] The adaptive contract duplication method, apparatus, device and storage medium proposed in the present invention obtain predefined duplication field configuration information, wherein the duplication field configuration information includes text page number information and text content to be duplicated; a blank file to be duplicated is generated based on the text page number information; and the text content to be duplicated is filled in a target duplication area of the blank file to be duplicated according to a preset contract duplication adaptive strategy. The above-mentioned method solves the problem of content overflow and incomplete printing content when too much text content is generated for contract duplication through PDF files, thereby improving the accuracy and universality of contract duplication. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is a structural diagram of an adaptive contract printing device in a hardware operating environment involved in an embodiment of the present invention;
[0040] Figure 2 It is a flowchart of the first embodiment of the adaptive contract printing method of the present invention;
[0041] Figure 3 A schematic diagram of a printed contract format involved in the adaptive contract printing method of the present invention;
[0042] Figure 4 It is another schematic diagram of a printed contract style involved in the adaptive contract printing method of the present invention;
[0043] Figure 5 It is a flow chart of the second embodiment of the adaptive contract printing method of the present invention;
[0044] Figure 6 A detailed flow chart of the adaptive contract printing method of the present invention for determining whether the target printing area and the content of the text to be printed are compatible;
[0045] Figure 7 It is another schematic diagram of the detailed process of the adaptive contract printing method of the present invention for determining whether the target printing area and the content of the text to be printed are compatible;
[0046] Figure 8 It is a schematic diagram of the overall process of the adaptive contract printing method of the present invention;
[0047] Fig. 9 The text content after the adaptive contract printing method of the present invention is adjusted by the contract printing adaptive strategy;
[0048] Fig.10 It is a schematic diagram of the printing effect of the text content after the adaptive contract printing method of the present invention is adjusted by the contract printing adaptive strategy;
[0049] Fig.11 It is a schematic diagram of the functional modules of the adaptive contract printing device of the present invention.
[0050] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0051] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0052] The embodiments of the present application take into account that at present, most of the solutions for generating contract printed texts through PDF files can only set the position of the text when it is printed, but do not consider the problem that if there is too much content in the field, the printed content will exceed the reserved position range or the printed content will be incomplete.
[0053] Based on this, an embodiment of the present application proposes a solution, which obtains predefined copy printing field configuration information, wherein the copy printing field configuration information includes text page number information and text content to be copied; generates a blank file to be copied based on the text page number information; and fills the text content to be copied in the target copy printing area of the blank file to be copied according to a preset contract copy printing adaptive strategy. The above method solves the problem of content overflow and incomplete printed content when there is too much text content in the contract copy generated by PDF file, thereby improving the accuracy and universality of contract copy printing.
[0054] Specifically, refer to Figure 1 , Figure 1 This is a functional module diagram of the terminal device to which the adaptive contract printing device of this application belongs. The adaptive contract printing device can be a device that is independent of the terminal device and can perform data processing, and it can be carried on the terminal device in the form of hardware or software. The terminal device can be a smart mobile terminal with a touch screen, such as a mobile phone or a tablet computer, or a fixed terminal with a touch screen.
[0055] In this embodiment, the terminal device to which the adaptive contract printing apparatus belongs at least includes an output module 110 , a processor 120 , a memory 130 and a communication module 140 .
[0056] The memory 130 stores an operating system and an adaptive contract printing program; the output module 110 may be a display screen, a speaker, etc. The communication module 140 may include a WIFI module, a mobile communication module, a Bluetooth module, etc., and communicates with an external device or server through the communication module 140.
[0057] When the adaptive contract printing program in the memory 130 is executed by the processor, the following steps are implemented:
[0058] Acquire predefined template field configuration information, wherein the template field configuration information includes text page number information and text content to be templated;
[0059] Generate a blank file to be printed based on the text page number information;
[0060] According to a preset contract duplication adaptive strategy, the text content to be duplicated is filled in the target duplication area of the blank document to be duplicated.
[0061] Furthermore, when the adaptive contract printing program in the memory 130 is executed by the processor, the following steps are also implemented:
[0062] Converting the text content to be printed into target format text content according to the preset contract printing adaptive strategy and the target printing area specification parameters;
[0063] Determine the target printing area in the to-be-printed file according to the coordinates of the target printing area;
[0064] Fill the target format text content in the target copy printing area.
[0065] Furthermore, when the adaptive contract printing program in the memory 130 is executed by the processor, the following steps are also implemented:
[0066] Calculate the target format text font parameters based on the default font parameters, the target printing area specification parameters and the content of the text to be printed;
[0067] Determining the layout specifications of the to-be-printed text content based on the target format text font parameters;
[0068] The text content to be typed is converted into text content in a target format based on the layout specification.
[0069] Furthermore, when the adaptive contract printing program in the memory 130 is executed by the processor, the following steps are also implemented:
[0070] Calculate the maximum capacity of a single line of text and the maximum number of lines of text in the target printing area based on the default font parameters and the target printing area specification parameters;
[0071] Determine whether the target duplication area can accommodate the text content to be duplication based on the maximum capacity of the single-line text and the maximum number of lines of the regional text;
[0072] If the target copy printing area can accommodate the text content to be copied, the default font parameters are determined as the target format text font parameters.
[0073] Furthermore, when the adaptive contract printing program in the memory 130 is executed by the processor, the following steps are also implemented:
[0074] If the target printing area cannot accommodate the text content to be printed, determining whether the default font parameter is a preset minimum font parameter;
[0075] If the default font parameter is a preset minimum font parameter, determining the minimum font parameter as the target format text font parameter;
[0076] If the default font parameter is not the preset minimum font parameter, the default font parameter is reduced by the preset value and the steps are executed: based on the default font parameter and the target printing area specification parameters, the maximum capacity of a single line of text and the maximum number of lines of regional text in the target printing area are calculated.
[0077] Furthermore, when the adaptive contract printing program in the memory 130 is executed by the processor, the following steps are also implemented:
[0078] Calculate the single-line target capacity and the number of lines of regional text target capacity of the target printing area based on the target format text font parameters;
[0079] Divide the text content to be printed based on the single-line target capacity to obtain a plurality of divided text contents to be printed;
[0080] The layout specification of the text content to be printed is determined according to the several divided text contents to be printed and the number of lines that can be accommodated by the regional text target.
[0081] Furthermore, when the adaptive contract printing program in the memory 130 is executed by the processor, the following steps are also implemented:
[0082] Calculate the single-line target capacity of the target printing area according to the target font size and the target printing area specification parameters;
[0083] The target capacity of lines of regional text in the target printing area is calculated according to the target font line height and the target printing area specification parameters.
[0084] This embodiment adopts the above scheme, specifically by obtaining predefined duplication field configuration information, wherein the duplication field configuration information includes text page number information and text content to be duplicated; generating a blank file to be duplicated based on the text page number information; and filling the text content to be duplicated in the target duplication area of the blank file to be duplicated according to a preset contract duplication adaptive strategy. The above method solves the problem of content overflow and incomplete printing content when too much text content is generated for contract duplication through PDF files, thereby improving the accuracy and universality of contract duplication.
[0085] Based on the above terminal device architecture but not limited to the above architecture, an embodiment of the method of the present application is proposed.
[0086] Reference Figure 2 , Figure 2 This is a flow chart of the first embodiment of the adaptive contract printing method of the present invention. In this embodiment, the adaptive contract printing method includes:
[0087] Step S1000: obtaining predefined template field configuration information, wherein the template field configuration information includes text page number information and text content to be templated;
[0088] Specifically, in each embodiment of the adaptive contract printing method of the present invention, in order to solve the problem of content overflow and incomplete printed content when there is too much content in the contract printing text generated by PDF file, the content, position and size information of the text to be printed are defined mainly through JSON configuration, so that the corresponding text can only be generated in the corresponding area. When the text is too long, the text is automatically wrapped and reduced, thereby ensuring that the text can be accurately printed in the corresponding area.
[0089] Specifically, in this embodiment, a PDF file for printing is generated based on the printing text information configured in a JSON array. The JSON definition may have the following configuration information: - text mark position, - text content, - text area horizontal coordinate, - text area vertical coordinate, - text area width, - text area height, - text page number, - default font size, wherein the page number where the text is located is also the text page number information. Based on this information, the contract printing system on which the embodiment is implemented can generate a blank PDF file of the corresponding number of pages for contract printing when implementing the method. The text content in the configuration information is also the text content to be printed.
[0090] Step S2000: Generate a blank file to be printed based on the text page number information;
[0091] Specifically, in this embodiment, as described above, the contract printing system on which the embodiment is implemented can generate a blank PDF file of the corresponding number of pages based on the text page number information (the page number where the text is located) for contract printing when implementing the method. That is, the addition of printed text content first requires generating a blank PDF file of the corresponding number of pages (the blank file to be printed) according to the "page number where the text is located" in the configuration information, and then adding the printed text to the corresponding coordinates of the PDF file.
[0092] Step S3000: Fill the text content to be printed into the target printing area of the blank document to be printed according to the preset contract printing adaptive strategy.
[0093] Specifically, in this embodiment, when adding the printed text at the corresponding position (target printed area) in the blank file to be printed generated in the above steps, it is necessary to determine whether all the text content under the current font size can be added in a line-wrapped manner according to the current "text area width" and "text area height" restrictions. The specific method for obtaining whether the complete text can be added is as follows:
[0094] First, get the total width of the text at the current font size, and then calculate the average width of a single character. Then, the number of characters in a single line of text can be estimated based on the text area width and the average character width. The number of characters is then added and subtracted until the number of characters in a single line is accurately calculated and intercepted. The remaining text continues to be accurately calculated and intercepted from the previously estimated number of characters in a single line of text until the interception is complete. During the calculation process, if the total number of intercepted lines exceeds the height of the text area, the text cannot fit in the text area and the font needs to be reduced. The text width is obtained through the PDType0Font.getStringWidth API of pdfBox.
[0095] Furthermore, step S3000 in this embodiment: filling the to-be-printed text content into the target printing area of the to-be-printed blank document according to the preset contract printing adaptive strategy may include:
[0096] Step S3100: converting the text content to be printed into text content in a target format according to a preset contract printing adaptive strategy and the target printing area specification parameters;
[0097] Step S3200: determining a target printing area in the to-be-printed file according to the coordinates of the target printing area;
[0098] Step S3300: Fill the target format text content in the target printing area.
[0099] Specifically, refer to Figure 3 and Figure 4 , Figure 3 Display some contract templates to be printed, and generate printed contracts based on them. Figure 4 It is shown that when the text is too long, traditional duplicate printing has no restrictions on the printing area, resulting in the problem that after printing, the text exceeds the preset range in the paper contract and the printed content is incomplete. In this embodiment, since the text content to be duplicated (the text content to be duplicated) is not necessarily fully compatible with the target duplication area in terms of format, there may be a situation where there is too much text content to be duplicated, but the target duplication area cannot fully accommodate so much text content to be duplicated. If duplication is still performed according to the default format, it may cause omissions or misprints in the printed file, or the printed content may cover the original content.
[0100] In order to solve the above problems, the present invention adopts a preset contract printing adaptive strategy to process the text content to be printed so that it can be adapted to the target printing area as much as possible. Specifically, through pre-configured configuration information (including text mark position, text content, text area horizontal coordinate, text area vertical coordinate, text area width, text area height, text page number, default font size, etc.), the text content to be printed is converted into target format text content that can be adapted to the target printing area.
[0101] Among them, the target area to be printed in the blank file to be printed can be determined according to the coordinates of the target printing area (that is, the horizontal coordinate and vertical coordinate of the text area in the configuration information). After determination, the target printing area can be filled according to the target format text content converted previously.
[0102] In this embodiment, by obtaining predefined template field configuration information, the template field configuration information includes text page number information and text content to be templated; a blank file to be templated is generated based on the text page number information; and the text content to be templated is filled in the target template area of the blank file to be templated according to a preset contract template adaptive strategy. The above method solves the problem of content overflow and incomplete printed content when there is too much text content in the contract template generated by PDF file, thereby improving the accuracy and universality of contract template.
[0103] Further, refer to Figure 5 , Figure 5 This is a flow chart of the second embodiment of the adaptive contract printing method of the present invention. Figure 2 In the embodiment shown, the step S3100: converting the to-be-printed text content into target format text content according to the preset contract printing adaptive strategy and the target printing area specification parameters may include:
[0104] Step S3110: Calculating the target format text font parameters based on the default font parameters, the target printing area specification parameters and the content of the text to be printed;
[0105] Step S3120: determining the layout specification of the text content to be printed based on the target format text font parameters;
[0106] Step S3130: Convert the text content to be typed into text content in a target format based on the layout specification.
[0107] Specifically, refer to Figure 6 and Figure 7 , Figure 6 and Figure 7The following is a detailed flow chart of the adaptive contract printing method of the present invention for determining whether the target printing area and the content of the text to be printed are compatible. Figure 2 In the embodiment shown, after obtaining pre-configured configuration information (including text mark position, text content, text area horizontal coordinate, text area vertical coordinate, text area width, text area height, text page number, default font size, etc.) and generating a blank file to be printed according to the text page number information in the configuration information, the text content to be printed is converted into target format text content according to the pre-configured contract printing adaptive strategy and target printing area specification parameters (i.e., text area width, text area height and other parameters in the configuration information).
[0108] Specifically, the target format text font parameters are first calculated based on the default font parameters (default font size) and the target printing area specification parameters and the text content to be printed, and then the layout specifications of the text content to be printed are determined based on the calculated target format text font parameters. The layout specifications include information such as the font size, the number of words per line, and the final number of lines.
[0109] Finally, based on the layout specifications, the text content to be printed is converted into the required target format text content, and the target printing area in the blank file to be printed can be filled with the content according to the target format text content.
[0110] Furthermore, in this embodiment, step S3110: calculating the target format text font parameters based on the default font parameters, the target printing area specification parameters and the content of the text to be printed may include:
[0111] Step S3111: Calculating the maximum capacity of a single line of text and the maximum number of lines of text in the target printing area based on the default font parameters and the target printing area specification parameters;
[0112] Step S3112: judging whether the target duplication area can accommodate the text content to be duplication based on the maximum capacity of the single-line text and the maximum number of lines of the regional text;
[0113] Step S3113: If the target printing area can accommodate the text content to be printed, the default font parameters are determined as the target format text font parameters.
[0114] Specifically, refer to Figure 6 and Figure 7 , based on the default font size in the above configuration information and the target printing area specification parameters (text area width, text area height and other information), calculate the maximum capacity of a single line of text and the maximum number of lines of regional text in the target printing area.
[0115] Specifically, the default font size and the height of the text area are used to calculate how many lines of text can be accommodated in the target printing area (text area), and then the total width of the text content to be printed under the current font size is obtained. The average width of each word in the text content to be printed is calculated based on the total width and the total number of words in the text content to be printed. Finally, the maximum number of words that can be accommodated in each line of the target printing area (i.e. the maximum capacity of a single line of text in the target printing area) is calculated based on the average width and the width of the target printing area.
[0116] Finally, the maximum capacity of a single line of text and the maximum number of lines of area text are used to calculate whether the number of lines required for all the text content to be printed exceeds the maximum number of lines. If it exceeds, it means that the font size at this time is not enough to completely fill all the text content to be printed into the target printing area.
[0117] Furthermore, in this embodiment, step S3112: after judging whether the target printing area can accommodate the text content to be printed based on the maximum capacity of the single-line text and the maximum number of lines of the regional text, may further include:
[0118] Step S3114: if the target printing area cannot accommodate the text content to be printed, determining whether the default font parameter is a preset minimum font parameter;
[0119] Step S3115: if the default font parameter is a preset minimum font parameter, determining the minimum font parameter as the target format text font parameter;
[0120] Step S3116: If the default font parameter is not the preset minimum font parameter, the default font parameter is reduced according to the preset value and the step is executed: based on the default font parameter and the target printing area specification parameters, the maximum capacity of a single line of text and the maximum number of lines of regional text in the target printing area are calculated.
[0121] That is, when the number of lines required for the text content to be printed exceeds the maximum number of lines, first check whether the current font size can no longer be reduced (is equal to the preset font minimum value). If it is already the font minimum value, then directly determine the current font minimum value as the target format text font parameter for subsequent steps.
[0122] If the number of lines required for the text to be printed exceeds the maximum number of lines and the current font size has not reached the preset minimum font value, the default font parameters will be reduced by the preset value (such as 0.1) to obtain the reduced font parameters, and the reduced font parameters will be used as the new default font parameters and the steps will be executed: based on the default font parameters and the target printing area specification parameters, the maximum capacity of a single line of text and the maximum number of lines of regional text in the target printing area are calculated, that is, the current font is reduced and then it is re-determined whether the number of lines required for the text to be printed exceeds the maximum number of lines, until at a certain font size the number of lines required for the text to be printed does not exceed the maximum number of lines or the preset minimum value of the font size reduction.
[0123] Furthermore, in this embodiment, step S3120: determining the layout specification of the to-be-printed text content based on the target format text font parameter may include:
[0124] Step S3121: Calculating the single-line target capacity and the number of regional text target capacity lines of the target printing area based on the target format text font parameters;
[0125] Step S3122: dividing the text content to be printed based on the single-line target capacity to obtain a plurality of divided text contents to be printed;
[0126] Step S3123: Determine the layout specifications of the text content to be printed based on the plurality of divided text contents to be printed and the number of lines that the regional text target can accommodate.
[0127] Specifically, in this embodiment, after the above steps determine the font size that can enable the target printing area to accommodate all the text contents to be printed, that is, the target format text font parameter (or preset minimum font), the single-line target capacity of the target printing area and the target number of rows of regional text are confirmed based on the target format text font parameter. These two parameters are actually obtained before the target format text font parameter is determined, that is, the single-line target capacity of the target printing area and the target number of rows of regional text are accommodated under the target format text font parameter.
[0128] Reference Figure 6 and Figure 7 After determining the single-line target capacity, the text content to be printed is segmented line by line according to the value until the segmentation is completed, and a number of lines of text with the same number of lines as the regional text target capacity are obtained.
[0129] Furthermore, in this embodiment, step S3121: calculating the single-line target capacity and the number of regional text target capacity lines of the target printing area based on the target format text font parameters may include:
[0130] Step S31211: Calculate the single-line target capacity of the target printing area according to the target font size and the specification parameters of the target printing area;
[0131] Step S31212: Calculate the number of lines that the target text area can accommodate in the target printing area according to the target font line height and the target printing area specification parameters.
[0132] Specifically, in this embodiment, as described in the above steps, the target format text font parameters and the text area height are used to calculate how many lines of text can be accommodated in the target printing area (text area), and then the total width of the text content to be printed under the current target format text font parameters is obtained, and the average width of each word in the text content to be printed is calculated based on the total width and the total number of words in the text content to be printed, and finally the maximum number of words that can be accommodated in each line in the target printing area (i.e., the single-line target capacity of the target printing area) is calculated based on the average width and the width of the target printing area.
[0133] Based on the above steps, refer to Figure 8 The complete text synthesis logic is to obtain whether all text content can be placed in the overlapping area under the current font ( Figure 3 ). If not, then reduce the font size by 0.1 and continue to judge until the font size is less than the predefined minimum value or can be completely put down, then start adding and synthesizing the text content. If the font size is reduced to the predefined minimum font and still cannot be put down, each line of text can only be added with the smallest font. In this way, although the text will overflow the rendering range, it can ensure that all text is added to the file and all text is rendered within the preset range to the greatest extent. The results obtained based on the embodiment of the adaptive contract printing of the present invention can be referred to. Fig. 9 and Fig.10 shown.
[0134] In this embodiment, the target format text font parameters are calculated based on the default font parameters, the target printing area specification parameters and the text content to be printed; the layout specifications of the text content to be printed are determined based on the target format text font parameters; and the text content to be printed is converted into the target format text content based on the layout specifications. This solves the problem of content overflow and incomplete printing content when too much text content is generated for contract printing through PDF files, thereby improving the accuracy and universality of contract printing.
[0135] In addition, refer to Fig.11 The embodiment of the present invention further provides an adaptive contract printing device 100, the device comprising:
[0136] The acquisition module 110 is used to acquire predefined template field configuration information, wherein the template field configuration information includes text page number information and text content to be templated;
[0137] A generating module 120, for generating a blank file to be printed based on the text page number information;
[0138] The duplication module 130 is used to fill the text content to be duplicated into the target duplication area of the blank document to be duplicated according to a preset contract duplication adaptive strategy.
[0139] In addition, an embodiment of the present invention also provides an adaptive contract printing device, which includes: a memory, a processor, and an adaptive contract printing program stored in the memory and executable on the processor, wherein the adaptive contract printing program is configured to implement the steps of each embodiment of the adaptive contract printing method as described above.
[0140] In addition, the present invention also provides a computer-readable storage medium, on which an adaptive contract printing program is stored. When the adaptive contract printing program is executed by a processor, the steps of each embodiment of the adaptive contract printing method described above are implemented.
[0141] In the embodiments of the apparatus, terminal device and computer-readable storage medium of the present invention, all technical features of the above-mentioned embodiments of the adaptive contract printing method are included, and the expansion and explanation content of the specification are basically the same as those of the above-mentioned embodiments of the adaptive contract printing method, and will not be repeated here.
[0142] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0143] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0144] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, including a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0145] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. An adaptive contract printing method, characterized in that: The method comprises the following steps: Acquire predefined template printing field configuration information, wherein the template printing field configuration information includes text page number information and text content to be template printed; Generate a blank file to be printed based on the text page number information; According to a preset contract duplication adaptive strategy, the text content to be duplicated is filled in the target duplication area of the blank document to be duplicated.
2. The adaptive contract printing method according to claim 1, characterized in that: The duplication field configuration information also includes target duplication area specification parameters and target duplication area coordinates. The step of filling the to-be-duplicated text content in the target duplication area of the to-be-duplicated blank file according to the preset contract duplication adaptive strategy includes: Converting the text content to be printed into target format text content according to the preset contract printing adaptive strategy and the target printing area specification parameters; Determine the target printing area in the to-be-printed file according to the coordinates of the target printing area; Fill the target format text content in the target copy printing area.
3. The adaptive contract printing method according to claim 2, characterized in that: The template field configuration information also includes a default font parameter. The step of converting the to-be-printed text content into a target format text content according to the preset contract template adaptive strategy and the target template area specification parameter includes: Calculate the target format text font parameters based on the default font parameters, the target printing area specification parameters and the content of the text to be printed; Determining the layout specifications of the to-be-printed text content based on the target format text font parameters; The text content to be typed is converted into text content in a target format based on the layout specification.
4. The adaptive contract printing method according to claim 3, characterized in that: The step of calculating the target format text font parameters based on the default font parameters, the target printing area specification parameters and the content of the text to be printed comprises: Calculate the maximum capacity of a single line of text and the maximum number of lines of text in the target printing area based on the default font parameters and the target printing area specification parameters; Determine whether the target duplication area can accommodate the text content to be duplication based on the maximum capacity of the single-line text and the maximum number of lines of the regional text; If the target copy printing area can accommodate the text content to be copied, the default font parameters are determined as the target format text font parameters.
5. The adaptive contract printing method according to claim 4, characterized in that: After the step of judging whether the target printing area can accommodate the content of the text to be printed based on the maximum capacity of the single-line text and the maximum number of lines of the regional text, the following steps are further included: If the target printing area cannot accommodate the text content to be printed, determining whether the default font parameter is a preset minimum font parameter; If the default font parameter is a preset minimum font parameter, determining the minimum font parameter as the target format text font parameter; If the default font parameter is not the preset minimum font parameter, the default font parameter is reduced by the preset value and the steps are executed: based on the default font parameter and the target printing area specification parameters, the maximum capacity of a single line of text and the maximum number of lines of regional text in the target printing area are calculated.
6. The adaptive contract printing method according to claim 3, characterized in that: The step of determining the layout specification of the to-be-printed text content based on the target format text font parameters comprises: Calculate the single-line target capacity and the number of lines of regional text target capacity of the target printing area based on the target format text font parameters; Divide the text content to be printed based on the single-line target capacity to obtain a plurality of divided text contents to be printed; The layout specification of the text content to be printed is determined according to the several divided text contents to be printed and the number of lines that can be accommodated by the regional text target.
7. The adaptive contract printing method according to claim 3, characterized in that: The target format text font parameters include a target font line height and a target font size. The step of calculating the single-line target capacity and the number of target regional text capacity lines of the target printing area based on the target format text font parameters includes: Calculate the single-line target capacity of the target printing area according to the target font size and the target printing area specification parameters; The target capacity of lines of regional text in the target printing area is calculated according to the target font line height and the target printing area specification parameters.
8. An adaptive contract printing device, characterized in that: The device comprises: An acquisition module, used for acquiring predefined template field configuration information, wherein the template field configuration information includes text page number information and text content to be templated; A generating module, used for generating a blank file to be printed based on the text page number information; The duplication printing module is used to fill the text content to be duplicated into the target duplication printing area of the blank document to be duplicated according to a preset contract duplication printing adaptive strategy.
9. An adaptive contract printing device, characterized in that: The device comprises: a memory, a processor, and an adaptive contract printing program stored in the memory and executable on the processor, wherein the adaptive contract printing program is configured to implement the steps of the adaptive contract printing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores an adaptive contract printing program, and when the adaptive contract printing program is executed by a processor, the steps of the adaptive contract printing method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
File header-containing file sleeve printing method and device, computer equipment and storage medium
CN121680762A