Method and device for quickly creating PDF form files
By converting Word or Excel files into HTML files, inserting them into form fields, and then converting them into PDF, the problem of inconvenience in using the existing PDF form designer is solved, and the effect of quickly making interactive PDF forms is achieved.
Patent Information
- Application Number
- CN202310142316.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-09
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2043-02-09
AI Technical Summary
The existing PDF form designer is inconvenient and time-consuming, making it difficult to efficiently produce interactive PDF forms, especially when converting from Word or Excel files to PDF, lacking data standards and form domain standardization, making it difficult to reuse information data.
Convert the original format file to HTML file, insert the form field based on the appearance of the table, and convert the HTML file to PDF file through virtual printing, while writing the form field information data.
It realizes the rapid and convenient production of interactive PDF forms, improves production efficiency, improves user experience and reduces design costs.
Smart Images

Figure CN116050360B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to electronic file processing, and in particular to a method and device for quickly creating a PDF form file. Background Art
[0002] The Portable Document Format (PDF) is a commonly used electronic file format. A PDF file encapsulates text, fonts, graphics, images, colors, layouts, and other parameters related to printing equipment within a single file, preserving the page elements during network transmission, printing, and plate-making output. PDF files can contain both static PDF tables (for example, converting Word or Excel files to PDF tables) and interactive PDF forms (hereinafter referred to as forms). Interactive forms contain sets of fields or form fields that collect information from users through interaction, and this information can be updated, processed, and reused.
[0003] The difference between tables in Word or Excel files and PDF forms is that they do not contain structured form field information. All text and images entered or inserted in Word or Excel files exist as part of the Word / Excel body. Since they do not contain form fields and the normalization and standardization of form field fields, the subsequent extraction and reuse of the information data in the table will be troublesome, and data reuse may even be impossible.
[0004] However, creating forms in PDF files requires a tedious process and the use of a form designer. Currently, there are two main types of form designers: professional PDF form designers, such as Acrobat PDF Form Designer and Foxit's Phantom Form Designer. These form designers are inconvenient to use, requiring form field settings to be completed by dragging and dropping form fields on the layout PDF page and configuring their properties. The other type of form designer is an HTML5-based, "question-based" form designer for the internet, such as questionnaires, which are typically designed from scratch. They primarily focus on questions, adding them one by one until a questionnaire or form is created. These form designers have two drawbacks: First, a large number of official documents in offices are in Word or Excel formats, resulting in complex interfaces. Designing web forms from scratch is slow, and HTML mode for table and text editing currently cannot match the diversity and versatility of Word. Second, they often lack data standard specifications, such as metadata and data code tables.
[0005] Therefore, although PDF form files have better form data management and processing functions, the current process of creating forms in PDF files is not only time-consuming, but also inconvenient and error-prone, and needs further improvement. Summary of the Invention
[0006] The purpose of the present invention is to provide a method and device for quickly creating a PDF form file.
[0007] According to an embodiment of the present invention, a method for creating a PDF form file is provided, the method comprising: converting an original format file into a Hypertext Markup Language (HTML) file; wherein the original format file includes a table appearance; inserting form fields having a table appearance into the HTML file based on the table appearance of the original format file; converting the HTML file with the inserted form fields into a PDF file; and writing information data of the form fields into the form fields in the PDF file.
[0008] According to an embodiment of the present invention, there is also provided a device for creating a PDF form file, the device comprising: a first format conversion module configured to convert an original format file into a Hypertext Markup Language (HTML) file; wherein the original format file includes a table appearance; a form design module configured to insert form fields having a table appearance into the HTML file based on the table appearance of the original format file; a second format conversion module configured to convert the HTML file into which the form fields have been inserted into a PDF file; and a form writing module configured to write information data of the form fields into the form fields in the PDF file.
[0009] According to an embodiment of the present invention, a device for generating a PDF form file is provided, the device comprising: a memory configured to store computer-readable instructions; and at least one processor coupled to the memory; wherein, when the computer-readable instructions are executed by the processor, the processor causes the processor to implement the method for generating a PDF form file as described in the above embodiment.
[0010] According to an embodiment of the present invention, a computer storage medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed, the computer implements the method for creating a PDF form file as described in the above embodiment.
[0011] By utilizing the method, device, and computer storage medium of the embodiments of the present invention, an interactive form can be quickly and conveniently created in a PDF file. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 A flow chart of a method for creating a PDF form file according to an embodiment of the present invention is shown.
[0013] Figure 2 Diagram showing an example of what a table might look like in its original format.
[0014] Figure 3 A structural block diagram of a device for creating a PDF form file according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0015] Figure 1 1 shows a flow chart of a method for making a PDF form file according to an embodiment of the present invention. Figure 1 As shown, method 100 includes: converting an original format file into a Hypertext Markup Language (HTML) file (step 110); wherein the original format file includes a table appearance; inserting form fields with a table appearance into the HTML file based on the table appearance of the original format file (step 120); converting the HTML file with the inserted form fields into a PDF file (step 130); and writing information data of the form fields into the form fields in the PDF file (step 140).
[0016] In the embodiment of the present invention, the original format file includes the appearance of a table, that is, the basic structure and fields of the table. The table may or may not include data. Figure 2 A diagram showing an example of the appearance of a table in an original format file (such as a Word file), wherein the "Company Equipment Record Table" shown is an empty table containing no data. Figure 2 The following diagram shows a table's appearance, showing fields such as "Device Name, Device Model, Device Serial Number, Manufacturer, and Device Status," as well as the overall table's appearance. A table's appearance can include its basic structure (e.g., number of rows and columns), shape (e.g., rectangular), dimensions (e.g., field length, line spacing), and font size.
[0017] The original format file can usually be a table file produced by the user using his commonly used application software (such as word processing or spreadsheet software). Many users have a large number of table templates in word processing or spreadsheet format, which all contain table appearances. HTML is a standard language for describing web pages; HTML allows the embedding of objects such as images, sounds, animations, multimedia, etc., and can be used to create interactive forms. It can also be used to structure information (such as titles, paragraphs, and lists, etc.). By executing the file conversion step 110, the user can conveniently use a simple user interaction interface on the HTML file to design a form, without having to perform cumbersome form design on the PDF file. Therefore, in an embodiment of the present invention, the table appearance in the user's commonly used or existing original format file can be conveniently utilized. By converting the original format file into an HTML file, and then using the characteristics of HTML to create form fields of an interactive form with the same table appearance in the HTML file, and further generating a PDF file with the form fields inserted, the technical effect of quickly and conveniently producing a PDF form file can be achieved.
[0018] In some embodiments, the original format file includes a word processing file (such as a Word file) or a spreadsheet file (such as an Excel file); step 110 of converting the original format file to an HTML file includes converting the original format file to an HTML file by calling an Object Linking and Embedding (OLE) interface. The OLE interface, developed by Microsoft, is a comprehensive set of standards for transmitting and sharing information between user applications. It allows the creation of hybrid documents with links to applications, eliminating the need for users to switch between applications when making modifications. In embodiments of the present invention, calling the OLE interface is primarily based on calling a word processor (such as WORD) through OLE Automation. OLE Automation is a mechanism that allows Windows applications to manipulate other programs, and can directly call the native interfaces of word processing software or spreadsheet software. Using the OLE interface to convert Word or Excel files can essentially preserve all information such as the layout, content, and style of the Word / Excel file, so that subsequent HTML file editing only requires fine-tuning of page content and insertion of form fields. However, embodiments of the present invention are not limited to using the OLE interface to convert original format files; other methods can also be used to achieve file conversion, such as using the OpenOffice interface. After executing step 110 , the obtained HTML file can basically maintain the table appearance of the Word / Excel file, except that form fields need to be added.
[0019] Currently, the most popular office documents are still Word / Excel and other Office documents; and many units have a large number of Word / Excel table templates, which contain layout information, text, graphic, and image content information, as well as various table appearance styles, such as leave applications, expense reports, employee evaluation forms, equipment record forms, and other business types of forms. In the office process, Word / Excel tables can be easily edited, filled in, and printed. The difference between this Office form and a PDF form is that it does not contain structured form field information. All input or inserted text and images exist as part of the Word / Excel text. Since it does not contain form fields and the normalization and standardization of form field fields, it causes trouble for later extraction and reuse, and may even be impossible to reuse. The PDF form file produced according to the embodiment of the present invention can overcome these defects, and the information data written in the form field can be reused and processed.
[0020] According to an embodiment of the present invention, the table appearance of an already generated original format file (such as a word processing or spreadsheet file) can be conveniently utilized, or a file in the original format with a table appearance can be conveniently generated using word processing software (such as Word) or spreadsheet processing software (such as Excel); by converting the original format file into an HTML file and inserting form fields with the same table appearance into the HTML file, and then converting the HTML file into a PDF file, a PDF form file can be created; and then the information data of the form fields can be written into the form fields in the PDF form file.
[0021] In some embodiments, the form fields inserted into the HTML file include form fields that only include the form field's appearance, and / or form fields that include the form field's appearance and metadata; wherein the form field's table appearance is generated based on the table appearance of the original format file. In one example, after the original format file is converted to an HTML file, text, graphics, images, and tables corresponding to the table appearance appear on the page of the HTML file. The form field's table appearance generated based on the table appearance of the original format file facilitates the rapid generation of interactive forms based on an existing table appearance.
[0022] In some embodiments, method 100 further includes: adjusting the page content in the HTML file; wherein, adjusting the page content includes editing at least one of the text, graphics, images, and tables in the page of the HTML file. In one example, the user can fine-tune the HTML page content according to the needs of the table and the actual state of the table appearance in the converted HTML file. For example, basic text, graphics, images, and tables in the page can be edited, and table editing can include: inserting, editing, deleting text, graphics, and images; adjusting various style processing such as the font, font size, underlining, and alignment of the text; adding rows to the table; deleting table rows; adjusting the row and column widths of the table; and quick editing operations such as copying, pasting, backing off, and forwarding. Then, the more important operation is to insert form fields at the appropriate position on the page layout of the original table.
[0023] In one embodiment, a form designer inserts form fields with the same table appearance as the original format file into an HTML file. The form designer can design forms based on HTML, leveraging the rich form design mechanisms of HTML (such as HTML5) to provide an editing experience for form fields, such as dragging and clicking. Furthermore, text and images can be edited. Forms designed in HTML files using the form designer are interactive forms.
[0024] Form fields are used to collect user input or selection data. Ordinary form fields only include their appearance, without normalizing the data. The appearance of a form field includes its position, type, and the font and size of the text within it. Form field types include text input boxes, rich text (multi-line text) input boxes, integer input boxes, floating point input boxes, date selection boxes, time selection boxes, date and time selection boxes, radio buttons, check boxes, combo boxes, digital signature fields, and handwritten signature fields.
[0025] Form fields with metadata refer to form fields that contain specific metadata. In addition to the basic properties of ordinary form fields, they also standardize the English name, Chinese name, data standard set, option code table, etc. of the form fields. For example, "Gender (HWB / SEX), Height (HWB / HEIGHT), Weight (HWB / WEIGHT) in the CDISC data standard set"; the "HWB" before the " / " is the domain (DOMAIN); the "SEX, HEIGHT, WEIGHT" after the " / " are the English names of the fields. Generally, form field names use metadata names. For example, the form field name HWB / HEIGHT corresponds to the metadata HWB / HEIGHT. However, form field names sometimes do not correspond exactly to metadata names. For example, in a multi-row table, the first row has the following naming convention: HWB / NAME_1, HWB / SEX_1, HWB / WEIGHT_1, HWB / HEIGHT_1; the second row has HWB / NAME_2, HWB / SEX_2, HWB_WEIGHT_2, HWB_HEIGHT_2; and so on. HWB / NAME_1 and HWB / NAME_2 use the same metadata HWB / NAME; HWB / WEIGHT_1 and HWB / WEIGHT_2 use the same metadata HWB / WEIGHT; and so on.
[0026] In some embodiments, the information data written into the form field includes the form field name, form field type (as described above), metadata (such as a metadata dictionary), page number, position, border style (such as a rectangular border or an underlined border), font size, alignment (such as whether the text in the text box is aligned to the center or left), option value, and at least one of auto-fill. Metadata is data used to describe data, primarily information describing data attributes, such as the name, default value, value range, unit, format, length, and encoding of the data item.
[0027] In some embodiments, step 130 of converting an HTML file with form fields inserted into a PDF file includes: converting the HTML file with form fields inserted into a PDF file via virtual printing; printing the HTML file as a PDF file according to a predetermined page configuration in step 130; and intercepting form field information data during the virtual printing step. The virtual printing function can be a specially designed virtual printer program or a third-party virtual printing engine, with a form field information interception function incorporated into the virtual printer program or the virtual printing engine. This allows the form field information within the HTML file to be output simultaneously during the virtual printing process of converting the HTML file to a PDF file. During virtual printing, the HTML file containing the designed web form is printed as a PDF file according to the input page configuration (horizontal / vertical format, margins, page size, page breaks, etc.); form field information is intercepted or output during the printing process and stored in JSON or XML format. Each form field can include the following information: form field name, form field type, metadata dictionary, page number, position, border style, font size, alignment, option value, auto-fill, etc. In the embodiment of the present invention, converting an HTML file into a PDF file is not limited to the virtual printing method, and other methods (such as a file conversion application) can also be used to perform file conversion.
[0028] In step 140 of writing the form field information data into the form fields in the PDF file, a form writing module can write the form field information intercepted in step 130 of converting the HTML file into a PDF file into the converted PDF file, thereby obtaining a final PDF form file with form fields. In step 140, the intercepted form field information is parsed and, based on the form field information descriptions, the form fields are written one by one into the converted PDF file. The form writing module can be a specially designed software development kit (SDK) or a third-party SDK.
[0029] In an embodiment of the present invention, by combining step 110 of converting an original format file into an HTML file, step 120 of inserting form fields with a table appearance into the HTML file, step 130 of converting the HTML file with the inserted form fields into a PDF file, and step 140 of writing information data of the form fields into the form fields in the PDF file, the efficiency of creating PDF form files can be significantly improved, while improving the user's form design experience and reducing form design costs.
[0030] Figure 3 FIG. 1 shows a structural block diagram of a device for making a PDF form file according to an embodiment of the present invention. Figure 3As shown, the device 300 for making a PDF form file includes: a first format conversion module 310, configured to convert an original format file into a Hypertext Markup Language (HTML) file; the original format file includes a table appearance (e.g., Figure 2 ); a form design module 320, configured to insert form fields with a table appearance into the HTML file based on the table appearance of the original format file; a second format conversion module 330, configured to convert the HTML file with the inserted form fields into a PDF file; and a form writing module 340, configured to write information data of the form fields into the form fields in the PDF file.
[0031] Those skilled in the art will appreciate that the device 300 can be used to implement the above method for creating a PDF form file (e.g., in combination with Figure 1 and Figure 2 The various embodiments of the method 100 described above can achieve the same technical effects as the various embodiments of method 100. For example, the form design module 320 corresponds to a form designer, which can be used to insert form fields and adjust page content in an HTML file; the second format conversion module 330 can be a virtual printing module, which converts the HTML file with the inserted form fields into a PDF file through virtual printing. The parts of the various embodiments of device 300 that are identical to those of method 100 are not further described. The various modules in device 300 can be implemented by computer software, hardware, firmware, or a combination thereof.
[0032] According to an embodiment of the present invention, a device for creating a PDF form file is further provided, comprising: a memory configured to store computer-readable instructions; and at least one processor coupled to the memory; the computer-readable instructions, when executed by the processor, cause the processor to implement the method for creating a PDF form file (e.g., method 100) described in the above embodiment. The device in this embodiment may be any computer, computing device, or information processing device.
[0033] According to an embodiment of the present invention, there is also provided a computer storage medium having computer-readable instructions stored thereon, which, when executed, causes a computer to implement the above-mentioned method for creating a PDF form file, such as in combination with Figure 1 and Figure 2 The various embodiments of the method 100 are described. The storage medium may be any medium that can be used to store program instructions and / or data, including but not limited to any volatile or non-volatile storage medium such as an optical disk, a hard disk, a flash memory, a RAM, a ROM, and an EPROM.
[0034] The above are preferred embodiments of the present invention. Those skilled in the art should understand that the various embodiments described above are merely illustrative and non-restrictive, and that those skilled in the art may make various modifications and variations without departing from the essence of the present invention. Such modifications and variations should fall within the scope of protection of the present invention, which should be defined by the claims.
Claims
1. A method for creating a PDF form file, comprising: Converting the original format file into a Hypertext Markup Language (HTML) file; wherein the original format file includes a table appearance; inserting form fields with a table appearance into the HTML file based on the table appearance of the original format file; Converting the HTML file inserted into the form field into a PDF file, and intercepting the information data written into the form field during the conversion process; and The intercepted information data of the form field is parsed and written into the form field in the PDF file according to the information description of the form field.
2. The method according to claim 1, wherein The original format file includes a word processing file or a spreadsheet file; wherein, converting the original format file into an HTML file includes: converting the original format file into an HTML file by calling an Object Linking and Embedding (OLE) interface.
3. The method according to claim 1, wherein The inserted form fields include form fields that only include the form field appearance, and / or form fields that include the form field appearance and metadata; wherein the table appearance of the form field is generated based on the table appearance of the original format file.
4. The method according to claim 1, wherein The information data of the form field includes at least one of the form field name, form field type, metadata, page number, position, border style, font size, alignment, option value, and auto-fill of the form field.
5. The method according to claim 1 or 4, wherein Converting the HTML file inserted into the form field into a PDF file includes: Converting the HTML file inserted into the form field into a PDF file by virtual printing; wherein the conversion is to print the HTML file into the PDF file according to a predetermined page configuration; and In the virtual printing step, information data of the form fields is intercepted.
6. The method according to claim 1, further comprising: Adjusting the page content in the HTML file; wherein adjusting the page content includes editing at least one of text, graphics, images and tables in the page of the HTML file.
7. A device for producing a PDF form file, comprising: A first format conversion module is configured to convert an original format file into a Hypertext Markup Language (HTML) file; wherein the original format file includes a table appearance; a form design module configured to insert form fields having a table appearance into the HTML file based on the table appearance of the original format file; A second format conversion module is configured to convert the HTML file inserted into the form field into a PDF file, and intercept information data written into the form field during the conversion process; and The form writing module is configured to parse the intercepted information data of the form field and write the information data into the form field in the PDF file according to the information description of the form field.
8. A device for creating a PDF form file, comprising: a memory configured to store computer-readable instructions; as well as at least one processor coupled to the memory; Wherein, when the computer-readable instructions are executed by the processor, the processor is caused to implement the method of any one of claims 1 to 6.
9. A computer storage medium having computer-readable instructions stored thereon, which, when executed, cause a computer to implement the method of any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for generating web page form
CN107544808A