PDF Template Data Filling Method, Device, Equipment, Medium and Product
By overwriting the layer on the PDF form field and filling it with data, the problem that readers who do not support the form field cannot display data is solved, and the data display capability across readers is realized, which improves the user experience.
Patent Information
- Application Number
- CN202211157963.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-22
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2042-09-22
AI Technical Summary
The existing PDF production method can only be viewed on readers that support form domain functions, resulting in readers that do not support form domains cannot display the form domain data.
By overwriting the layer on the form field and filling the layer with data according to the text properties and data to be filled, the same effect as the form field assignment is achieved.
After data filling is completed, readers that do not support form fields can also display the data of the layer, improving the user experience.
Smart Images

Figure CN115409001B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data processing, and particularly to a method, device, equipment, medium and product for filling PDF template data. Background Art
[0002] PDF (Portable Document Format in English, Portable Document Format in Chinese) is a commonly used file format at present. In the financial field, since contract documents are usually standard texts, real data will be filled in during actual business. Therefore, the process of generating a PDF file includes the PDF template production process and the data filling process for the PDF template.
[0003] Currently, the PDF production method is to use form fields to reserve space in advance on the PDF text, and then use the assignment function of the form fields to achieve automatic data filling. However, since this method can only be viewed on readers that support the form field function, readers that do not support form fields cannot display the data in the form fields. Summary of the Invention
[0004] This application provides a method, device, equipment, medium and product for filling PDF template data to solve the problem that the current method can only be viewed on readers that support the form field function, resulting in readers that do not support form fields being unable to display the data in the form fields.
[0005] In the first aspect of this application, a method for filling PDF template data is provided, including:
[0006] Obtain the data to be filled, the first position attribute of the form fields in the PDF template to be filled, and the text attribute of the form fields;
[0007] Cover a layer on the form field; the second position attribute of the layer is the same as the first position attribute;
[0008] Fill the layer with data according to the text attribute and the data to be filled.
[0009] Further, in the method as described above, the obtaining the data to be filled, the first position attribute of the form fields in the PDF template to be filled, and the text attribute of the form fields includes:
[0010] Obtain the data to be filled and the PDF template from a preset database;
[0011] Determine the first position attribute and text attribute of the form fields from the PDF template.
[0012] Further, in the method as described above, the first position attribute includes the position and size of the form field;
[0013] Covering a layer on the form field includes:
[0014] Cover a layer of the same size as the form field on the form field according to the position of the form field.
[0015] Further, in the method as described above, there are multiple form fields; the data to be filled includes: key-value pairs composed of form field identifiers and corresponding target filling data;
[0016] Filling data into the layer according to the text attribute and the data to be filled includes:
[0017] Determine the matching form field according to the form field identifier in the key-value pair;
[0018] Determine the layer covering the matching form field;
[0019] Fill the target filling data into the corresponding layer according to the text attribute corresponding to the matching form field; the corresponding layer is the layer covering the matching form field; the text attribute includes font size, font color, and font alignment.
[0020] Further, in the method as described above, after filling data into the layer according to the text attribute and the data to be filled, it further includes:
[0021] Delete the form field under the layer.
[0022] Further, in the method as described above, before obtaining the data to be filled, the first position attribute of the form field in the PDF template to be filled, and the text attribute of the form field, it further includes:
[0023] Obtain the PDF text to be constructed;
[0024] Set at least one form field in the PDF text;
[0025] Set the first position attribute and text attribute corresponding to the at least one form field to generate the PDF template.
[0026] A second aspect of the present application provides a PDF template data filling device, including:
[0027] An obtaining module, configured to obtain the data to be filled, the first position attribute of the form field in the PDF template to be filled, and the text attribute of the form field;
[0028] A covering module, configured to cover a layer on the form field; the second position attribute of the layer is the same as the first position attribute;
[0029] A filling module for filling data into the layer according to the text attributes and the data to be filled.
[0030] Further, for the device as described above, the obtaining module is specifically configured to:
[0031] Obtain the data to be filled and the PDF template from a preset database; determine the first position attributes and text attributes of the form fields from the PDF template.
[0032] Further, for the device as described above, the first position attributes include the position of the form field and the size of the form field;
[0033] The covering module is specifically configured to:
[0034] Cover a layer of the same size as the form field on the form field according to the position of the form field.
[0035] Further, for the device as described above, there are multiple form fields; the data to be filled includes: key-value pairs composed of form field identifiers and corresponding target filling data;
[0036] The filling module is specifically configured to:
[0037] Determine a matching form field according to the form field identifier in the key-value pair; determine the layer covering the matching form field; fill the target filling data into the corresponding layer according to the text attributes corresponding to the matching form field; the corresponding layer is the layer covering the matching form field; the text attributes include font size, font color, and font alignment.
[0038] Further, for the device as described above, the device further includes:
[0039] A deletion module for deleting the form fields under the layer.
[0040] Further, for the device as described above, the device further includes:
[0041] A generation module for obtaining the PDF text to be constructed; setting at least one form field in the PDF text; setting the first position attributes and text attributes corresponding to the at least one form field to generate the PDF template.
[0042] A third aspect of the present application provides an electronic device, including: a memory and a processor;
[0043] The memory stores computer execution instructions;
[0044] The processor executes the computer-executable instructions stored in the memory to implement the PDF template data filling method according to any one of the first aspect.
[0045] A fourth aspect of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the PDF template data filling method according to any one of the first aspect.
[0046] A fifth aspect of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the PDF template data filling method according to any one of the first aspect.
[0047] A PDF template data filling method, device, equipment, medium and product provided by the present application. The method includes: obtaining data to be filled, the first position attribute of form fields in the PDF template to be filled, and the text attribute of the form fields; covering a layer on the form fields; the second position attribute of the layer is the same as the first position attribute; and filling data into the layer according to the text attribute and the data to be filled. The PDF template data filling method of the present application can achieve the same effect as form field assignment by covering a layer on the form fields and filling data into the layer according to the text attribute and the data to be filled. And since data is filled into the layer, readers that do not support form fields can also display the data of the layer after data filling is completed. Description of the Drawings
[0048] The drawings here are incorporated into the specification and form a part of this specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application.
[0049] Figure 1 It is a scenario diagram for implementing the PDF template data filling method of the embodiments of the present application;
[0050] Figure 2 It is a flowchart of the PDF template data filling method provided by the present application Figure 1 ;
[0051] Figure 3 It is a flowchart of the PDF template data filling method provided by the present application Figure 2 ;
[0052] Figure 4 It is an overall flowchart of the PDF template data filling method provided by the present application;
[0053] Figure 5 It is a structural diagram of the PDF template data filling device provided by the present application Figure 1 ;
[0054] Figure 6 Structural schematic of the PDF template data filling device provided for this application Figure 2 ;
[0055] Figure 7 Structural schematic of the electronic device provided for this application.
[0056] Through the above-mentioned drawings, specific embodiments of this application have been shown, and there will be more detailed descriptions hereinafter. These drawings and textual descriptions are not intended to limit the scope of the concept of this application in any way, but to illustrate the concept of this application to those skilled in the art by referring to specific embodiments. Detailed implementation manners
[0057] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numerals in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all the implementation manners consistent with this application. On the contrary, they are merely examples of the devices and methods consistent with some aspects of this application as detailed in the appended claims.
[0058] In the technical solution of the embodiments of this application, the collection, storage, use, processing, transmission, provision, and disclosure, etc., of the user's personal information involved all comply with the provisions of relevant laws and regulations and do not violate public order and good customs.
[0059] It should be noted that the PDF template data filling method, device, equipment, medium, and product of this disclosure can be used in the field of data processing technology. It can also be used in any field other than data processing, such as the financial field. The application fields of the PDF template data filling method, device, equipment, medium, and product of this disclosure are not limited.
[0060] The technical solution of this application will be described in detail below with specific embodiments. These several specific embodiments below can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of this application will be described below with reference to the drawings.
[0061] To clearly understand the technical solution of this application, the solutions of the prior art will be introduced in detail first. In the financial field, since contract documents are usually standard texts and real data is filled in during actual operations, the documents need to have good stability and be not easily modified randomly. The PDF file has the above advantages and generally does not have typesetting problems such as paragraph disorder and text garbled characters, so it is widely used in the financial field.
[0062] Currently, PDF production includes a PDF template production process and a data filling process for the PDF template. In the PDF template production process, space is generally reserved in the PDF text to set corresponding form fields. Then, the position attributes and text attributes of the form fields are adjusted to generate a PDF template. In the data filling process of the PDF template, the real data is filled into the corresponding form fields to complete the data filling process and generate a PDF file. However, since the form field technology can only be viewed on a reader that supports the form field function, readers that do not support the form field function cannot display the data of the form field, reducing the user experience.
[0063] Therefore, aiming at the problem in the prior art that it can only be viewed on a reader that supports the form field function, resulting in readers that do not support the form field function being unable to display the data of the form field, the inventor found in the research that to solve this problem, when performing automatic data filling, instead of directly assigning values to the form fields, the idea of positioning based on the form fields and then covering layers can be adopted. Thus, while achieving the same effect as form field assignment, readers that do not support the form field function can also display the data of the layers.
[0064] Specifically, obtain the data to be filled, the first position attributes of the form fields in the PDF template to be filled, and the text attributes of the form fields. Cover a layer on the form fields. The second position attributes of the layer are the same as the first position attributes. Fill the layer with data according to the text attributes and the data to be filled. By covering a layer on the form fields and filling the layer with data according to the text attributes and the data to be filled, the same effect as form field assignment can be achieved. And since the data filling is performed on the layer, after the data filling is completed, readers that do not support the form field function can also display the data of the layer.
[0065] Based on the above creative discovery, the inventor proposed the technical solution of this application.
[0066] Next, the application scenario of the PDF template data filling method provided by the embodiments of this application will be introduced. As Figure 1 shown, where 1 is the first electronic device and 2 is the second electronic device. The network architecture of the application scenario corresponding to the PDF template data filling method provided by the embodiments of this application includes: the first electronic device 1 and the second electronic device 2. The second electronic device 2 can be a database server, and the second electronic device 2 stores the data to be filled and the PDF template to be filled. The data to be filled includes the real data that needs to be filled.
[0067] Exemplarily, when data filling of a PDF template is required, the first electronic device 1 obtains the data to be filled and the PDF template to be filled from the second electronic device 2. The first electronic device 1 identifies the form fields in the PDF template to be filled, and determines the first position attribute and text attribute corresponding to the form fields. The first position attribute includes the position of the form field and the size of the form field. The text attribute includes font size, font color, etc. The first electronic device 1 covers a layer on the form field according to the first position attribute. The second position attribute of this layer is the same as the first position attribute, so that the form field can be covered coincidentally. At the same time, the first electronic device 1 fills the layer with data according to the text attribute and the data to be filled, so as to complete the data filling of the PDF template. If there are multiple form fields, the above process is executed for each form field. After the data filling is completed, the form fields can be deleted to avoid interference between the form fields and the layer when displaying data, which affects the viewing experience of users. After the PDF file is generated, it can be sent to other electronic devices for subsequent analysis, viewing, inspection and other processes.
[0068] The embodiments of the present application will be introduced below with reference to the accompanying drawings of the specification.
[0069] Figure 2 Flow schematic of the PDF template data filling method provided by the present application Figure 1 , such as Figure 2 shown, in this embodiment, the execution subject of the embodiments of the present application is a PDF template data filling device, and this PDF template data filling device can be integrated in an electronic device. Then the PDF template data filling method provided in this embodiment includes the following steps:
[0070] Step S101, obtain the first position attribute of the form field and the text attribute of the form field in the data to be filled and the PDF template to be filled.
[0071] In this embodiment, the data to be filled includes the real data to be filled and the form field identifier, so that the corresponding form field can be determined through the data to be filled.
[0072] The PDF template to be filled can be set in advance. For example, the PDF text to be processed can be obtained, and space can be reserved in the PDF text to set the corresponding form field. Then, the position attribute and text attribute of the form field are adjusted to generate a PDF template. In actual application scenarios, multiple PDF templates can be set in advance according to different application scenarios, such as setting the PDF template corresponding to a business contract, the PDF template corresponding to data display, etc.
[0073] The first position attribute includes the position and size of the form field. The position of the form field can be represented by coordinates by constructing a coordinate system in the PDF file. The size of the form field generally includes the length and width of the form field. The text attributes of the form field include text-related attributes such as font size, font type, font alignment, etc., and also include the identifier of the form field, etc.
[0074] Step S102, cover a layer on the form field. The second position attribute of the layer is the same as the first position attribute.
[0075] In this embodiment, the layer technology of PDF is adopted to cover a layer at the position of the form field. The second position attribute of this layer is the same as the first position attribute, so that the layer can coincide with the form field and cover the complete form field.
[0076] Step S103, perform data filling on the layer according to the text attributes and the data to be filled.
[0077] Different from the common form field assignment method, in this embodiment, data filling is performed on the layer, and the layer is used to replace the original form field to display data. When performing data filling, it is necessary to set the format and attributes of the filled data according to the text attributes.
[0078] A PDF template data filling method provided by an embodiment of the present application includes: obtaining the data to be filled, the first position attribute of the form field in the PDF template to be filled, and the text attribute of the form field. Cover a layer on the form field. The second position attribute of the layer is the same as the first position attribute. Perform data filling on the layer according to the text attributes and the data to be filled.
[0079] The PDF template data filling method of the present application can achieve the same effect as form field assignment by covering a layer on the form field and performing data filling on the layer according to the text attributes and the data to be filled. And because data filling is performed on the layer, after the data filling is completed, readers that do not support form fields can also display the data of the layer.
[0080] Figure 3 It is a flowchart of the PDF template data filling method provided by the present application Figure 2 , as Figure 3 shown, the PDF template data filling method provided in this embodiment is a further refinement based on the PDF template data filling method provided in the previous embodiment of the present application. Then the PDF template data filling method provided in this embodiment includes the following steps.
[0081] Step S201, obtain the data to be filled and the PDF template from a preset database.
[0082] In this embodiment, the data to be filled and the PDF template can be obtained in advance and stored in a preset database. Thus, when data filling for the PDF template is required, it can be quickly obtained from the preset database, improving the overall efficiency of data filling for the PDF template. The preset database can use a relational database or other databases, and this embodiment does not limit this.
[0083] The data to be filled can be obtained from the user terminal or manually input by the staff and stored in the preset database.
[0084] Optionally, in this embodiment, before step S201, a PDF template can also be generated, specifically as follows:
[0085] Obtain the PDF text to be constructed.
[0086] Set at least one form field in the PDF text.
[0087] Set the first position attribute and text attribute corresponding to at least one form field to generate a PDF template.
[0088] There are various types of form fields, and the commonly used one is mainly the text field. In a PDF template, there may be one or more form fields, and for each form field, its corresponding first position attribute and text attribute need to be set. When setting the text attribute of the form field, the identifier of the form field can be set, providing a basis for the subsequent data filling process. After the setting is completed, a PDF template is generated.
[0089] If the form field is set through a reader, after opening the PDF text, at the position where the form field needs to be added, add the form field in sequence and set attributes such as the font color, font size, alignment method, and form field name of the form field. Among them, the form field name is required during data field filling to distinguish each different form field.
[0090] Step S202, determine the first position attribute and text attribute of the form field from the PDF template.
[0091] In this embodiment, the form fields in the PDF template have their corresponding first position attributes and text attributes set in advance. According to the PDF template, the first position attribute and text attribute of the form field can be directly determined.
[0092] Step S203, according to the position of the form field, cover the form field with a layer of the same size. Among them, the first position attribute includes the position of the form field and the size of the form field.
[0093] In this embodiment, according to the form field positioning, and then using the layer to cover the corresponding form field. Therefore, after determining the position of the form field, a layer of the same size can be covered on the form field.
[0094] Step S204: Fill data into the layer according to the text attributes and the data to be filled.
[0095] The implementation manner of step 204 is similar to that of step 103 in the previous embodiment, and will not be elaborated here one by one.
[0096] Optionally, in this embodiment, the data to be filled includes: key-value pairs composed of form field identifiers and corresponding target filling data. When there are multiple form fields, step S204 can be specifically:
[0097] Filling data into the layer according to the text attributes and the data to be filled includes:
[0098] Determine the matching form field according to the form field identifier in the key-value pair.
[0099] Determine the layer covering the matching form field.
[0100] Fill the target filling data into the corresponding layer according to the text attributes corresponding to the matching form field. The corresponding layer is the layer covering the matching form field. The text attributes include font size, font color, and font alignment.
[0101] In the key-value pair key-value, the key keyword is the identifier of the form field, which is generally represented by the common form field name, and the value value is the corresponding target filling data. Since the PDF template also sets the identifier of the form field when setting the text attributes of the form field, the matching form field can be directly determined through the form field identifier in the key-value pair.
[0102] After determining the matching form field, the layer covering it can be determined, and the corresponding layer can be filled according to the text attributes corresponding to the form field and the target filling data.
[0103] Exemplarily, if the PDF template includes form field A, form field B, and form field C, and layer A is covered on form field A, layer B is covered on form field B, and layer C is covered on form field C, then the target filling data corresponding to form field A can be filled into layer A through the text attributes corresponding to form field A. The same applies to layer B and layer C, and will not be elaborated here one by one.
[0104] Step S205: Delete the form field under the layer.
[0105] In this embodiment, deleting the form field under the layer can avoid interference generated when the form field and the layer display data, thereby improving the user's viewing experience. Especially for readers that support form fields, it is very likely to display form fields and layers at the same time, causing data interference.
[0106] To further elaborate on the PDF template data filling method of this embodiment, the following will be further described in conjunction with the accompanying drawings. Figure 4 It is a schematic diagram of the overall process of the PDF template data filling method provided by this application. As Figure 4 shown, in this embodiment, there are multiple form fields. The inputs of the data automatic filling process are the data to be filled and the completed PDF template. Among them, after the data to be filled is obtained from the data source, it needs to be assembled into the key-value pair form of key-value. The key is the name of the form field, and the value corresponds to the data value to be filled.
[0107] First, obtain all the form fields in the PDF template and process each form field in a loop.
[0108] The specific processing is as follows:
[0109] Obtain the position and size of the form field. This step is crucial and the core idea of this embodiment. The form field is not used for assignment, but for determining the position where the data needs to be filled. At the same time, obtain the text attributes such as the font size, font color, and alignment of the form field respectively.
[0110] Run the PDF layer technology, cover a layer with the same size at the same position of the form field, and fill the text data on the layer according to the text attributes such as the set font size, color, and alignment.
[0111] Finally, delete the original form field to generate the filled PDF file.
[0112] By using the PDF template data filling method of this embodiment, no assignment operation is performed on the form field, which can avoid the defects of the form field and at the same time meet the characteristics of flexible text setting.
[0113] This embodiment first sets the form field in the PDF text in advance based on the form field function, and sets the attributes such as the font size, font color, and text alignment of the form field. When automatically filling the data, instead of using the built-in assignment function of the form field, it first identifies the size and position of the rectangular box of the form field, and the attributes of the form field, such as the font size, font color, and text alignment. Then, by covering a layer at the same position of the form field and adding text on the layer, the automatic filling of the data is realized. Finally, the form field is deleted. The method proposed in this embodiment can achieve the same effect as the form field assignment, and at the same time eliminate the deficiency of the limited use range of the form field.
[0114] Figure 5 It is the structural schematic Figure 1 of the PDF template data filling device provided by this application. As Figure 5As shown in the figure, in this embodiment, the PDF template data filling device 300 may be disposed in an electronic device. The PDF template data filling device 300 includes:
[0115] An obtaining module 301, configured to obtain data to be filled, a first position attribute of a form field in a PDF template to be filled, and a text attribute of the form field.
[0116] An overlay module 302, configured to overlay a layer on the form field. A second position attribute of the layer is the same as the first position attribute.
[0117] A filling module 303, configured to fill data into the layer according to the text attribute and the data to be filled.
[0118] The PDF template data filling device provided in this embodiment may execute Figure 2 the technical solutions of the method embodiment shown in the figure. The implementation principle and technical effects are similar to those of Figure 2 the method embodiment shown in the figure, and will not be elaborated herein one by one.
[0119] Figure 6 This is a schematic structure of the PDF template data filling device provided by this application Figure 2 , as Figure 6 shown in the figure. The PDF template data filling device provided by this application further refines the PDF template data filling device on the basis of the PDF template data filling device provided in the previous embodiment. For better illustration, the PDF template data filling device in this embodiment is exemplarily described by using the PDF template data filling device 400. Then, the PDF template data filling device 400 includes:
[0120] Optionally, in this embodiment, the obtaining module 301 is specifically configured to:
[0121] Obtain the data to be filled and the PDF template from a preset database. Determine the first position attribute and the text attribute of the form field from the PDF template.
[0122] Optionally, in this embodiment, the first position attribute includes the position of the form field and the size of the form field.
[0123] The overlay module 302 is specifically configured to:
[0124] Overlay a layer with the same size as the form field on the form field according to the position of the form field.
[0125] Optionally, in this embodiment, there are multiple form fields. The data to be filled includes: key-value pairs composed of form field identifiers and corresponding target filling data.
[0126] The filling module 303 is specifically configured to:
[0127] Determine the matching form field according to the form field identifier in the key-value pair. Determine the layer covering the matching form field. Fill the target filling data in the corresponding layer according to the text attributes corresponding to the matching form field. The corresponding layer is the layer covering the matching form field. The text attributes include font size, font color, and font alignment.
[0128] Optionally, in this embodiment, the PDF template data filling device 400 further includes:
[0129] A deletion module 402, configured to delete the form field under the layer.
[0130] Optionally, in this embodiment, the PDF template data filling device 400 further includes:
[0131] A generation module 401, configured to obtain the PDF text to be constructed. Set at least one form field in the PDF text. Set the first position attribute and text attribute corresponding to at least one form field to generate a PDF template.
[0132] The PDF template data filling device provided in this embodiment can execute Figures 2 - 4 the technical solution of the method embodiment shown, and its implementation principle and technical effect are similar to those of Figures 2 - 4 the method embodiment shown, and will not be elaborated herein one by one.
[0133] According to the embodiments of the present application, the present application also provides an electronic device, a computer-readable storage medium, and a computer program product.
[0134] As Figure 7 shown, Figure 7 is a schematic structural diagram of the electronic device provided by the present application. The electronic device is intended to be various forms of digital computers, such as, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a blade server, a mainframe computer, and other suitable computers. The components shown herein, their connections and relationships, and their functions are only examples and are not intended to limit the implementation of the present application described herein and / or claimed.
[0135] As Figure 7 shown, the electronic device includes: a processor 501 and a memory 502. Each component is interconnected using different buses and can be installed on a common motherboard or installed in other ways as needed. The processor can process instructions executed within the electronic device.
[0136] The memory 502 is a non-transitory computer-readable storage medium provided by the present application. The memory stores instructions executable by at least one processor to enable at least one processor to perform the PDF template data filling method provided by the present application. The non-transitory computer-readable storage medium of the present application stores computer instructions, which are used to enable a computer to perform the PDF template data filling method provided by the present application.
[0137] The memory 502 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as the program instructions / modules corresponding to the PDF template data filling method in the embodiment of the present application (for example, the attached Figure 5 The processor 501 executes various functional applications and data processing of the electronic device by running the non-transient software programs, instructions and modules stored in the memory 502, that is, the PDF template data filling method in the above method embodiment is implemented.
[0138] At the same time, this embodiment also provides a computer product. When the instructions in the computer product are executed by a processor of an electronic device, the electronic device can execute the PDF template data filling method of the above embodiment.
[0139] Those skilled in the art will readily come up with other implementations of the embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modifications, uses or adaptations of the embodiments of the present application, which follow the general principles of the embodiments of the present application and include common knowledge or customary technical means in the art that are not disclosed in the embodiments of the present application.
[0140] It should be understood that the embodiments of the present application are not limited to the precise structures described above and shown in the drawings, and various modifications and changes can be made without departing from the scope thereof. The scope of the embodiments of the present application is limited only by the appended claims.
Claims
1. A method for filling PDF template data, characterized in that, it includes: Obtain the data to be filled, the first position attribute of the form field in the PDF template to be filled, and the text attribute of the form field; Cover a layer on the form field; the second position attribute of the layer is the same as the first position attribute; Fill the layer with data according to the text attribute and the data to be filled.
2. The method according to claim 1, characterized in that, the obtaining the data to be filled, the first position attribute of the form field in the PDF template to be filled, and the text attribute of the form field includes: Obtain the data to be filled and the PDF template from a preset database; Determine the first position attribute and text attribute of the form field from the PDF template.
3. The method according to claim 1, characterized in that, the first position attribute includes the position of the form field and the size of the form field; the covering a layer on the form field includes: Cover a layer with the same size as the form field on the form field according to the position of the form field.
4. The method according to claim 1, characterized in that, there are multiple form fields; the data to be filled includes: key-value pairs composed of form field identifiers and corresponding target filling data; the filling the layer with data according to the text attribute and the data to be filled includes: Determine the matching form field according to the form field identifier in the key-value pair; Determine the layer covering the matching form field; Fill the target filling data into the corresponding layer according to the text attribute corresponding to the matching form field; the corresponding layer is the layer covering the matching form field; the text attribute includes font size, font color, and font alignment.
5. The method according to any one of claims 1 to 4, characterized in that, after the filling the layer with data according to the text attribute and the data to be filled, it further includes: Delete the form field under the layer.
6. The method according to any one of claims 1 to 4, characterized in that, before the obtaining the data to be filled, the first position attribute of the form field in the PDF template to be filled, and the text attribute of the form field, it further includes: Obtain the PDF text to be constructed; Set at least one form field in the PDF text; Set the first position attribute and text attribute corresponding to the at least one form field to generate the PDF template.
7. A PDF template data filling device, characterized in that, it includes: An obtaining module, configured to obtain the data to be filled, the first position attribute of the form field in the PDF template to be filled, and the text attribute of the form field; A covering module, configured to cover a layer on the form field; the second position attribute of the layer is the same as the first position attribute; A filling module, configured to fill the layer with data according to the text attribute and the data to be filled.
8. An electronic device, characterized in that, it includes: A memory and a processor; The memory stores computer execution instructions; The processor executes the computer-executable instructions stored in the memory to implement the PDF template data filling method 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-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the PDF template data filling method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, when the computer program is executed by a processor, it implements the PDF template data filling method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for extracting form from portable electronic document
CN101833546A
PDF form information extraction method and device, equipment and storage medium
CN113297837A