Method and system for creating and applying PDF (Portable Document Format) template and computer program
Through the PDF template creation method based on Word and iReport tools, the problems of low efficiency and high maintenance cost in the existing technology are solved, and efficient and low-cost PDF file generation and management are realized.
Patent Information
- Application Number
- CN202411564545.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-02-11
AI Technical Summary
The prior art requires professionals to produce PDF files of different styles, resulting in high learning costs, low efficiency, and lack of complete PDF template maintenance solutions.
Create PDF templates based on Word and iReport tools, parse templates, and create PDF files based on actual business needs, including determining technical selection, creating template files, uploading and enabling templates, associating business interfaces, parsing and filling template files to create PDF files.
It improves the efficiency of PDF file creation, reduces learning and operation and maintenance costs, facilitates management, and realizes automatic creation of PDF files and signatures, improving the efficiency of PDF creation and signatures.
Smart Images

Figure CN119416764A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data technology, and in particular to a method, system and computer program for creating and applying a PDF template. Background Art
[0002] At present, in many computer application systems, a large number of PDF files of different styles need to be generated. PDF templates need to be made by professionals, with high learning costs and low efficiency. In addition, in the long-term operation of the system, there is no complete solution for the maintenance of PDF templates in the database system. For example:
[0003] Scenario 1: The company needs a new transportation contract. Due to various factors, different developers or business personnel need to develop the transportation contract. This method has the following defects: Each engineer needs to master the professional knowledge of how to use Word, iReport, XML, etc., so there is a certain learning cost.
[0004] Scenario 2: When there are common problems such as PDF template modification, electronic signature designated position change, electronic signature position not meeting the desired result, the electronic signature position is offset due to PDF template and designated position change. Professionals are required to re-adjust the electronic signature position, which requires engineers to have certain professional knowledge of PDF production. Summary of the invention
[0005] In view of the above-mentioned deficiencies in the current technology, the present invention provides a method for creating and applying PDF templates. By making PDF templates based on Word and iReport tools, parsing the templates, and creating PDF files according to actual business needs, the efficiency of PDF file production can be improved and the learning and maintenance costs can be reduced.
[0006] To achieve the above object, the embodiments of the present invention adopt the following technical solutions:
[0007] A method for creating and applying a PDF template comprises the following steps:
[0008] Determine technology selection based on business needs;
[0009] Determine the mapping business fields and text formats and create template files based on business requirements and technical selection;
[0010] Upload the template file to the server and enable the template;
[0011] Associate the template with the corresponding business interface for business calls;
[0012] The business calls the template and obtains the corresponding template file;
[0013] Parse the template file, fill in the corresponding business fields and styles, and create a PDF file.
[0014] According to one aspect of the present invention, the business requirements include: electronic signature, electronic contract, and electronic receipt.
[0015] According to one aspect of the present invention, the technology selection includes Word and iReport.
[0016] According to one aspect of the present invention, the template files corresponding to the Word technical selection are DOC and XML format files, and the template files corresponding to the iReport technical selection are jasper and jrxml files.
[0017] According to one aspect of the present invention, the parsing of the template file, filling in the corresponding business fields and styles, and creating the PDF file includes: parsing jasper and jrxml files using the jasperreports toolkit according to the template made by iReport, filling in the corresponding business fields and corresponding styles, and creating the PDF file.
[0018] According to one aspect of the present invention, parsing the template file, filling in the corresponding business fields and styles, and creating a PDF file includes: parsing the XML file using an XML parser according to the template made by Word, assigning values to the XML business fields, parsing the Doc and XML files using the itextpdf toolkit, and creating a PDF file.
[0019] According to one aspect of the present invention, the method for creating and applying a PDF template further includes:
[0020] Parse the PDF file and specify the signature location;
[0021] Set the signature style.
[0022] According to one aspect of the present invention, parsing the PDF file and specifying the signature position includes: parsing the PDF file, matching keywords, obtaining the page position where the keywords are located, and specifying the signature position according to the keyword position.
[0023] A system for creating and applying a PDF template, based on the method for creating and applying a PDF template as described above, comprises:
[0024] The selection module is used to determine the technology selection according to business needs;
[0025] The template making module is used to determine the mapping business fields and text formats and make template files according to business requirements and technical selection;
[0026] Upload module, used to upload template files to the server and enable the template;
[0027] The association module is used to associate the template with the corresponding business interface for business calls;
[0028] The business call module is used to call the business template and obtain the corresponding template file;
[0029] The parsing module is used to parse the template file, fill in the corresponding business fields and styles, and create a PDF file.
[0030] A computer program, when executed, implements the steps of the method for creating and applying a PDF template as described above.
[0031] Advantages of the present invention:
[0032] The present invention provides a method for creating and applying PDF templates. By making PDF templates based on Word and iReport tools, parsing the templates, and creating PDF files according to actual business needs, the efficiency of PDF file production can be improved, the learning and operation and maintenance costs can be reduced, and management is convenient; PDF files and signatures can be automatically created, thereby improving the efficiency of PDF creation and signatures. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0034] Figure 1 A flowchart of a method for creating and applying a PDF template according to Embodiment 1 of the present invention;
[0035] Figure 2 This is a flowchart of a method for creating and applying a PDF template according to Embodiment 2 of the present invention;
[0036] Figure 3 Creating a template file for the iReport tool of the present invention;
[0037] Figure 4 A schematic diagram of the dynamically defined fields described in the present invention. DETAILED DESCRIPTION
[0038] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0039] Embodiment 1
[0040] like Figure 1 As shown, a method for creating and applying a PDF template includes the following steps:
[0041] S1: Determine technology selection based on business needs.
[0042] The business requirements include: electronic signature, electronic contract, electronic receipt, other special requirements PDF, etc.
[0043] The technology selection includes Word and iReport, etc. This method uses Word or iReport to create a PDF template.
[0044] S2: Determine the mapping business fields and text formats based on business requirements and technology selection, and create template files.
[0045] The template files corresponding to Word technology selection are DOC and XML format files, and the template files corresponding to iReport technology selection are jasper and jrxml files.
[0046] The method of making template files corresponding to Word technology selection is: make Doc and XML files according to business requirements, and dynamically map business fields and text formats according to XML files.
[0047] The method of making template files corresponding to iReport technology selection is: make jasper and jrxml files according to business requirements, use iReport tool to create mapping business fields, and text format, such as Figure 3 shown.
[0048] By making a template file, you can dynamically define fields, such as Figure 4 As shown, the purpose of creating a PDF file based on actual business needs is achieved.
[0049] S3: Upload the template file to the server and enable the template.
[0050] S4: Associate the template with the corresponding business interface for business calls.
[0051] S5: The business calls the template and obtains the corresponding template file.
[0052] S6: Parse the template file, fill in the corresponding business fields and styles, and create a PDF file.
[0053] The parsing of the template file, filling in the corresponding business fields and styles, and creating the PDF file includes: parsing jasper and jrxml files using the jasperreports toolkit according to the template made by iReport, filling in the corresponding business fields and corresponding styles, and creating the PDF file.
[0054] The parsing of the template file, filling in the corresponding business fields and styles, and creating the PDF file include: parsing the XML file using an XML parser according to the template made by Word, assigning values to the XML business fields, parsing the Doc and XML files using the itextpdf toolkit, and creating the PDF file.
[0055] After the PDF file is created, it can be uploaded to the OSS file server.
[0056] The beneficial effect of this embodiment is that this method can improve the efficiency of PDF file production, reduce learning and operation and maintenance costs, and facilitate management by making PDF templates based on Word and iReport tools, parsing the templates, and creating PDF files according to actual business needs.
[0057] Embodiment 2
[0058] like Figure 2 As shown, a method for creating and applying a PDF template includes the following steps:
[0059] S1: Determine technology selection based on business needs.
[0060] The business requirements include: electronic signature, electronic contract, electronic receipt, other special requirements PDF, etc.
[0061] The technology selection includes Word and iReport, etc. This method uses Word or iReport to create a PDF template.
[0062] S2: Determine the mapping business fields and text formats based on business requirements and technology selection, and create template files.
[0063] The template files corresponding to Word technology selection are DOC and XML format files, and the template files corresponding to iReport technology selection are jasper and jrxml files.
[0064] The method of making template files corresponding to Word technology selection is: make Doc and XML files according to business requirements, and dynamically map business fields and text formats according to XML files.
[0065] The method of making template files corresponding to iReport technology selection is: make jasper and jrxml files according to business requirements, use iReport tool to create mapping business fields, and text format, such as Figure 3 shown.
[0066] By making a template file, you can dynamically define fields, such as Figure 4 As shown, the purpose of creating a PDF file based on actual business needs is achieved.
[0067] S3: Upload the template file to the server and enable the template.
[0068] S4: Associate the template with the corresponding business interface for business calls.
[0069] S5: The business calls the template and obtains the corresponding template file.
[0070] S6: Parse the template file, fill in the corresponding business fields and styles, and create a PDF file.
[0071] The parsing of the template file, filling in the corresponding business fields and styles, and creating the PDF file includes: parsing jasper and jrxml files using the jasperreports toolkit according to the template made by iReport, filling in the corresponding business fields and corresponding styles, and creating the PDF file.
[0072] The parsing of the template file, filling in the corresponding business fields and styles, and creating the PDF file include: parsing the XML file using an XML parser according to the template made by Word, assigning values to the XML business fields, parsing the Doc and XML files using the itextpdf toolkit, and creating the PDF file.
[0073] S7: Parse the PDF file and specify the signature location.
[0074] The method of parsing the PDF file and specifying the signature position includes: parsing the PDF file, matching keywords, obtaining the page position where the keywords are located, and specifying the signature position according to the keyword position. Keywords can be divided into single keywords and multiple keywords. A single keyword matches one position, and multiple keywords match multiple positions in the PDF.
[0075] There is another way to parse PDF files and specify the signature position: parse the PDF file, get the corresponding page number of the PDF, match the specified corresponding page number and position for signature.
[0076] S8: Set the signature style.
[0077] Set the signature style, including the size, pattern, color, etc. of the signature.
[0078] After the PDF file is created, it can be uploaded to the OSS file server.
[0079] The beneficial effect of this embodiment is that the method can automatically create PDF files and signatures, thereby improving the efficiency of PDF creation and signatures.
[0080] Embodiment 3
[0081] A system for creating and applying a PDF template, based on the method for creating and applying a PDF template as described in Embodiment 1 or 2, comprises:
[0082] The selection module is used to determine the technology selection according to business needs;
[0083] The template making module is used to determine the mapping business fields and text formats and make template files according to business requirements and technical selection;
[0084] Upload module, used to upload template files to the server and enable the template;
[0085] The association module is used to associate the template with the corresponding business interface for business calls;
[0086] The business call module is used to call the business template and obtain the corresponding template file;
[0087] The parsing module is used to parse the template file, fill in the corresponding business fields and styles, and create a PDF file.
[0088] Preferably, the system further comprises:
[0089] The signature positioning module is used to parse PDF files and specify the signature location.
[0090] The signature setting module is used to set the signature style.
[0091] Embodiment 4
[0092] A computer program, when executed, implements the steps of the method for creating and applying a PDF template as described in the first or second embodiment.
[0093] Embodiment 5
[0094] A readable storage medium stores a computer program as described in Example 4, and when the computer program is executed, the steps of the method for creating and applying a PDF template as described in Example 1 or 2 are implemented.
[0095] The present invention may be a method, system and / or computer program product. The computer program product may include a computer-readable storage medium (or medium) having computer-readable program instructions thereon, the computer-readable program instructions being used to cause a processor to perform aspects of the present invention.
[0096] The readable storage medium is a computer-readable storage medium, which can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer-readable storage medium can be, for example, but not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of computer-readable storage media includes the following: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device (such as a punch card or a raised structure in a groove with instructions recorded thereon), and any suitable combination of the above.
[0097] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to a corresponding computing / processing device or downloaded to an external computer or external storage device via a network (e.g., the Internet, a local area network, a wide area network, and / or a wireless network). The network can include copper transmission cables, optical transmission fibers, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in a computer-readable storage medium in the corresponding computing / processing device.
[0098] The computer programs described herein are computer-readable program instructions that can be downloaded from a computer-readable storage medium to a corresponding computing / processing device or downloaded to an external computer or external storage device via a network (e.g., the Internet, a local area network, a wide area network, and / or a wireless network). The network may include copper transmission cables, optical transmission fibers, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in a computer-readable storage medium in the corresponding computing / processing device.
[0099] The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, an electronic circuit (including, for example, a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA)) may execute the computer-readable program instructions to personalize the electronic circuit by utilizing the state information of the computer-readable program instructions so as to perform aspects of the present invention.
[0100] Aspects of the present invention are described herein with reference to flowcharts of methods, systems, devices, and computer program products according to embodiments of the present invention and / or block diagrams. It should be understood that each box in the flowchart and / or block diagram and the combination of boxes in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0101] These computer-readable program instructions may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine that, when executed by a processor of the computer or other programmable data processing apparatus, creates a device for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions may also be stored in a computer-readable storage medium that can instruct a computer, a programmable data processing apparatus, and / or other device to function in a particular manner, such that a computer-readable storage medium having instructions stored therein includes an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0102] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by any technician familiar with the art within the technical scope disclosed in the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for creating and applying a PDF template, characterized in that: The following steps are involved: Determine technology selection based on business needs; Determine the mapping business fields and text formats and create template files based on business requirements and technical selection; Upload the template file to the server and enable the template; Associate the template with the corresponding business interface for business calls; The business calls the template and obtains the corresponding template file; Parse the template file, fill in the corresponding business fields and styles, and create a PDF file.
2. The method for creating and applying a PDF template according to claim 1, characterized in that: The business requirements include: electronic signature, electronic contract, and electronic receipt.
3. The method for creating and applying a PDF template according to claim 1, characterized in that: The technology selection includes Word and iReport.
4. The method for creating and applying a PDF template according to claim 2, characterized in that: The template files corresponding to Word technology selection are DOC and XML format files, and the template files corresponding to iReport technology selection are jasper and jrxml files.
5. The method for creating and applying a PDF template according to claim 4, characterized in that: The parsing of the template file, filling in the corresponding business fields and styles, and creating the PDF file includes: parsing jasper and jrxml files using the jasperreports toolkit according to the template made by iReport, filling in the corresponding business fields and corresponding styles, and creating the PDF file.
6. The method for creating and applying a PDF template according to claim 4, characterized in that: The parsing of the template file, filling in the corresponding business fields and styles, and creating the PDF file include: parsing the XML file using an XML parser according to the template made by Word, assigning values to the XML business fields, parsing the Doc and XML files using the itextpdf toolkit, and creating the PDF file.
7. The method for creating and applying a PDF template according to claim 1, characterized in that: The method for creating and applying the PDF template also includes: Parse the PDF file and specify the signature location; Set the signature style.
8. The method for creating and applying a PDF template according to claim 7, characterized in that: The parsing of the PDF file and specifying the signature position includes: parsing the PDF file, matching keywords, obtaining the page position where the keywords are located, and specifying the signature position according to the keyword position.
9. A system for creating and applying PDF templates, characterized in that: The method for creating and applying a PDF template according to any one of claims 1 to 8 comprises: The selection module is used to determine the technology selection according to business needs; The template making module is used to determine the mapping business fields and text formats and make template files according to business requirements and technical selection; Upload module, used to upload template files to the server and enable the template; The association module is used to associate the template with the corresponding business interface for business calls; The business call module is used to call the business template and obtain the corresponding template file; The parsing module is used to parse the template file, fill in the corresponding business fields and styles, and create a PDF file.
10. A computer program, characterized in that When the computer program is executed, the steps of the method for creating and applying a PDF template according to any one of claims 1 to 8 are implemented.