A method and device for adding external OFD page content in OFD file
Adding external page content to OFD files through intelligent data migration and area correction engines solves the problem of content being pictured, achieves retention and searchability of semantic attributes, and improves user experience.
Patent Information
- Application Number
- CN202310008909.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-04
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2043-01-04
AI Technical Summary
When adding external OFD page content in the prior art, the content is pictured, loses its semantic attributes, and cannot be retrieved and selected.
Through the intelligent data migration engine and intelligent area correction engine, the page content and resource data corresponding to the external OFD page content are created in the OFD file, and mapping is established to retain its semantic attributes and vector characteristics, achieving perfect addition to the OFD page.
It is possible to fully retain the semantic attributes of external page content in OFD files, making them searchable and selectable, improving user experience.
Smart Images

Figure CN115934653B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology, and specifically relates to a method and device for adding external OFD page content in an OFD file. Background Art
[0002] OFD (Open Fixed-layout Documents) is an electronic file format independently developed by my country in accordance with national standards. It can meet the needs of manageable and controllable layout files and long-term preservation, and supports security mechanisms such as electronic seals and digital signatures.
[0003] In the process of OFD document application, when reading OFD document, there is often a need to add external OFD document page content. For example, the user needs to reference a page content of an external OFD document at a certain position in the OFD document for notes or instructions. In the prior art, a target area to be added is usually firstly clicked and dragged on the OFD page by the mouse; secondly, the external OFD document is selected and the page number of the page content to be added is specified, and then the page content is rendered as a whole to obtain the overall rendered image of the page content; finally, the rendered image is inserted into the target area on the OFD page.
[0004] However, the external OFD document page content added in the above process is converted into images, loses the semantic attributes of the original content, and cannot be retrieved and selected.
[0005] Application Contents
[0006] The purpose of the embodiments of the present application is to provide a method and device for adding external OFD page content in an OFD file, so as to solve the defect that the external OFD page content added in the prior art cannot be retrieved and selected.
[0007] In order to solve the above technical problems, this application is implemented as follows:
[0008] In a first aspect, a method for adding external OFD page content in an OFD file is provided, comprising the following steps:
[0009] According to the page content of the specified page of the external OFD file, create OFD page content corresponding to the page content in the current OFD file;
[0010] According to the resource data used by the page content of the designated page of the external OFD file, corresponding OFD resource data is created in the current OFD file;
[0011] A mapping is established between the OFD resource data and the OFD page content.
[0012] In a second aspect, a device for adding external OFD page content to an OFD file is provided, comprising:
[0013] A first creation module, configured to create, in the current OFD file, OFD page content corresponding to the page content of a specified page of an external OFD file;
[0014] A second creation module is used to create corresponding OFD resource data in the current OFD file according to the resource data used by the page content of the designated page of the external OFD file;
[0015] The establishing module is used to establish a mapping between the OFD resource data and the OFD page content.
[0016] The embodiment of the present application creates corresponding OFD page content and OFD resource data in the current OFD file based on the page content of the specified page of the external OFD file and the resource data used by it, and can completely retain the semantic attributes of the page content of the specified page of the external OFD file in the current OFD file, so that the page content can be searched and selected. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a flow chart of a method for adding external OFD page content in an OFD file provided by an embodiment of the present application;
[0018] Figure 2 It is a specific implementation diagram of the method for adding external OFD page content to an OFD file provided in an embodiment of the present application;
[0019] Figure 3 It is a structural diagram of a device for adding external OFD page content to an OFD file provided in an embodiment of the present application. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0021] When the user drags a target area on the OFD document with the mouse and adds external OFD document content to the area, the image of the page content loses the semantic attributes and vectorization characteristics of the original document data, and will be distorted when the page is scaled. The overall effect is poor and the user experience is not good.
[0022] In view of the above shortcomings, the embodiment of the present application provides a method for adding external OFD document page content to an OFD document page, through a built-in integrated intelligent data migration engine and an intelligent area correction engine, to achieve perfect addition of external OFD document page content data to the content area to be added in the document. Among them, the intelligent data migration engine is responsible for establishing the migration data model of the basic data of the external OFD document page content to be added and the resource data used, as well as creating new page content and resources in the document; the intelligent area correction engine is responsible for scaling and position correction of the newly created page content.
[0023] By using the integrated intelligent data migration engine and intelligent area correction engine, when adding external OFD document page content to the OFD document page, all properties of the referenced original content will be retained, including its semantic properties and vector characteristics. At the same time, correction parameters such as scaling of the added content will be dynamically calculated based on the page size to be added and the target area size of the content to be added. The processed referenced data will retain its display characteristics in the original document, while maintaining an adaptive aspect ratio and being displayed in the center of the target area of the content to be added, providing a good user experience.
[0024] The method for adding external OFD page content to an OFD file provided in an embodiment of the present application is described in detail below with reference to the accompanying drawings through specific embodiments and application scenarios.
[0025] like Figure 1 As shown, it is a flow chart of a method for adding external OFD page content to an OFD file provided by an embodiment of the present application, the method comprising the following steps:
[0026] Step 101 : creating OFD page content corresponding to the page content of a designated page of an external OFD file in a current OFD file.
[0027] Specifically, all page contents of a specified page of an external OFD file can be traversed to classify the page contents; a data model of the page contents can be established according to the attributes of each type of page contents, and OFD page contents corresponding to the page contents can be created in the current OFD file according to the data model.
[0028] Step 102 : creating corresponding OFD resource data in the current OFD file according to the resource data used by the page content of the designated page of the external OFD file.
[0029] Specifically, the original resource ID used by all page contents of a specified page of an external OFD file can be traversed, and the resource data of the external OFD file can be parsed based on the original resource ID; a data model of the resource data can be established, and corresponding resource data can be created in the current document based on the data model to obtain the ID of each newly created resource data, and a mapping relationship between the original resource ID and the ID of the newly created resource data can be established.
[0030] Step 103: Mapping the OFD resource data with the OFD page content.
[0031] Specifically, the OFD page content created in the current document may be traversed, and the ID of the resource data used by the OFD page content may be replaced with the ID of the newly created resource data corresponding to the original resource ID.
[0032] In this embodiment, after creating OFD page content corresponding to the page content of a designated page of an external OFD file in the current OFD file, coordinate transformation can be performed on a target area selected by a user on the page of the current document to obtain corresponding document coordinates; scaling parameters are calculated based on the size of the target area and the size of the page content of the designated page, and an application matrix of the page content is calculated based on the scaling parameters; the application matrix is applied to the OFD page content, and new coordinates of the OFD page content are calculated while keeping the page content of the designated page centered in the target area, and the OFD page content is corrected based on the new coordinates.
[0033] The embodiment of the present application creates corresponding OFD page content and OFD resource data in the current OFD file based on the page content of the specified page of the external OFD file and the resource data used by it, and can completely retain the semantic attributes of the page content of the specified page of the external OFD file in the current OFD file, so that the page content can be searched and selected.
[0034] In an embodiment of the present application, through a device with an intelligent data migration engine and an intelligent area correction engine, when the page content of an external OFD document is added to the OFD page, the page content data of the external OFD document is perfectly migrated to this document, and is adaptively centered in the area according to the size of the target area to be added.
[0035] Specifically, the intelligent data migration engine is responsible for analyzing the original added content and creating the same page content in this document. The properties of the newly created page content are consistent with those of the original page content. The intelligent area correction engine is responsible for dynamically calculating the scaling parameters and position parameters of the added content based on the page size of the added external OFD document and the target area size of the content to be added, and then applying the scaling and position parameters to the page content created by the intelligent data migration engine to ensure that the newly created page content is correctly centered in the target area of the content to be added.
[0036] Among them, the intelligent data migration engine includes two parts: the page content data migration engine and the document resource migration engine. The page content data migration engine will first traverse all the content on the page of the external OFD document to be added, including but not limited to all visible page content such as page objects, annotation objects and signatures, and classify them according to their types, and then hand them over to the corresponding sub-type data migration engine for processing. Each sub-type data migration engine will specifically analyze the data of this type, establish a pre-migration page content data model according to its various attributes, and then create the corresponding OFD document page content in this document according to the data model. After this processing process, the basic data migration of the page content of the referenced external OFD document in this document is completed. The document resource migration engine will traverse all the resource IDs used by the page content of the external OFD document to be added, parse the resource data of the external OFD document, establish a pre-migration resource data model, and then create the corresponding resource data in this document according to the data model, obtain the ID of each newly created resource data, and establish a mapping relationship between the resource ID used for adding content and the newly created resource ID of this document. Finally, the basic data created by the page content data migration engine in this article is traversed, and the resource ID is replaced according to the aforementioned resource ID mapping relationship.
[0037] The intelligent area correction engine is responsible for correcting the page content newly created by the intelligent data migration engine in this document. First, the coordinates of the target area dragged by the user with the mouse on the page of this document are converted to obtain the corresponding document coordinates. Then, based on its size and the size of the page to add content in the external OFD document, the scaling parameters of the page content to be added are calculated while maintaining the aspect ratio. Then, the application matrix of the page content is calculated and finally applied to the newly created page content. At the same time, while keeping the added page content centered in the target area, the new coordinates of the newly created page content are calculated and corrected.
[0038] After being processed by the above-mentioned intelligent data migration engine and intelligent area correction engine, the added external OFD document page content is perfectly added to the target area of the content to be added in this document, while retaining all its original properties, including its semantic properties and vector characteristics. It can be searched and selected, and can also be scaled proportionally with the zoom of this page. The related operation effects are equivalent to the operations on the original content of this page, and the user experience is good.
[0039] like Figure 2 As shown, it is a specific implementation diagram of the method for adding external OFD page content in the OFD file provided by the embodiment of the present application. The requester of the operation is the client user, the object of the operation is the OFD document, and the response of the operation is real-time. The main actions of the operation are: click and drag with the mouse, select the external OFD document and specify the page number of the added content, intelligent data migration processing and intelligent area correction. The process of the operation is: click and drag with the mouse; select the external OFD document and specify the page number of the added content; intelligent data migration processing; intelligent area correction.
[0040] Specifically, open the OFD document and select the add tool; click the page with the mouse and drag out the target area; select the external OFD document and specify the page number to which the content is to be added; call the intelligent data migration engine, traverse the page data of the specified page of the external OFD document and the resource data used by the page data, call the internal sub-processing engine to complete the migration of page data and resource data, and create new page content data and resource data; call the intelligent area correction engine to calculate the scaling parameters of the added page content according to the target area size position and the page size of the specified page of the external OFD document; the intelligent area correction engine performs scaling correction on the newly created page content according to the scaling parameters calculated in the above steps, and calculates the new coordinates of the newly created page content while keeping the added page content centered in the target area, and performs correction. Write the corrected page data to this OFD document according to the OFD standard data format. Re-render this page, and the target area correctly displays the added external OFD document page data.
[0041] In the process of adding external OFD document page content to the OFD document, the embodiment of the present application establishes a pre-migration data model for the basic data of the page content to be added and the resource data used through the built-in intelligent data migration engine, and creates new page content and resource data in the OFD document, which can perfectly complete the data migration and new creation processing of the external OFD document page content to be added; according to the page size of the added external OFD document and the target area size, the scaling parameters and position parameters of the added content are calculated through the intelligent area correction engine, and the page content created by the intelligent data migration engine is corrected by applying the scaling and position parameters to ensure that the newly created page content is correctly centered in the target area of the content to be added, and the scaling and position parameters of the newly created page content in the OFD document can be correctly corrected. Through the above process of adding the page content of the external OFD document, the semantics and vector characteristics of the original page content can be completely retained, the added external OFD page content can be searched and selected, and can also be scaled with the scaling of the page, and the related operation effect is equivalent to the operation of the original content of the page, and the whole process is simple and efficient, and the user experience is good.
[0042] like Figure 3 FIG. 1 is a schematic diagram of a structure of a device for adding external OFD page content to an OFD file provided in an embodiment of the present application, including:
[0043] The first creation module 310 is configured to create, in the current OFD file, OFD page content corresponding to the page content of a designated page of the external OFD file.
[0044] Specifically, the first creation module 310 is specifically used to traverse all page contents of a specified page of an external OFD file and classify the page contents; establish a data model of the page contents according to the attributes of each type of page contents, and create OFD page contents corresponding to the page contents in the current OFD file according to the data model.
[0045] The second creation module 320 is configured to create corresponding OFD resource data in the current OFD file according to the resource data used by the page content of the designated page of the external OFD file.
[0046] Specifically, the second creation module 320 is specifically used to traverse the original resource ID used by all page contents of a specified page of an external OFD file, and parse the resource data of the external OFD file according to the original resource ID; establish a data model for the resource data, create corresponding resource data in the current document according to the data model, obtain the ID of each newly created resource data, and establish a mapping relationship between the original resource ID and the ID of the newly created resource data.
[0047] The establishing module 330 is used to establish a mapping between the OFD resource data and the OFD page content.
[0048] Specifically, the establishment module 330 is specifically used to traverse the OFD page content created in the current document, and replace the ID of the resource data used by the OFD page content with the ID of the newly created resource data corresponding to the original resource ID.
[0049] In this embodiment, the above device further includes:
[0050] A correction module is used to perform coordinate conversion on a target area selected by a user on a page of the current document to obtain corresponding document coordinates; calculate a scaling parameter according to the size of the target area and the size of the page content of the specified page, and calculate an application matrix of the page content according to the scaling parameter; apply the application matrix to the OFD page content, calculate new coordinates of the OFD page content while keeping the page content of the specified page centered in the target area, and correct the OFD page content based on the new coordinates.
[0051] The embodiment of the present application creates corresponding OFD page content and OFD resource data in the current OFD file based on the page content of the specified page of the external OFD file and the resource data used by it, and can completely retain the semantic attributes of the page content of the specified page of the external OFD file in the current OFD file, so that the page content can be searched and selected.
[0052] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned method embodiment of adding external OFD page content to an OFD file is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0053] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0054] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0055] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A method for adding external OFD page content to an open fixed layout document OFD file, characterized in that: The following steps are involved: Creating, in the current OFD file, OFD page content corresponding to the page content of the specified page of the external OFD file; Creating corresponding OFD resource data in the current OFD file according to the resource data used by the page content of the specified page of the external OFD file; Mapping the OFD resource data to the OFD page content; The step of creating, in the current OFD file, OFD page content corresponding to the page content of the designated page of the external OFD file specifically includes: Traversing all page contents of a specified page of an external OFD file and classifying the page contents; Establishing a data model of the page content according to the attributes of each type of page content, and creating OFD page content corresponding to the page content in the current OFD file according to the data model; The creating corresponding OFD resource data in the current OFD file according to the resource data used by the page content of the specified page of the external OFD file specifically includes: Traversing the original resource IDs used by all page contents of a specified page of an external OFD file, and parsing resource data of the external OFD file according to the original resource IDs; Establishing a data model for the resource data, creating corresponding resource data in the current document according to the data model, obtaining an ID for each newly created resource data, and establishing a mapping relationship between the original resource ID and the ID of the newly created resource data; The mapping of the OFD resource data to the OFD page content specifically includes: The OFD page content created in the current document is traversed, and the ID of the resource data used by the OFD page content is replaced with the ID of the newly created resource data corresponding to the original resource ID.
2. The method according to claim 1, characterized in that After creating OFD page content corresponding to the page content of the designated page of the external OFD file in the current OFD file according to the page content of the designated page of the external OFD file, the method further includes: Performing coordinate conversion on a target area selected by the user on the page of the current document to obtain corresponding document coordinates; Calculating a scaling parameter according to the size of the target area and the size of the page content of the designated page, and calculating an application matrix of the page content according to the scaling parameter; The application matrix is applied to the OFD page content, new coordinates of the OFD page content are calculated while the page content of the designated page is displayed centered in the target area, and the OFD page content is corrected based on the new coordinates.
3. A device for adding external OFD page content to an OFD file, characterized in that: include: A first creation module is configured to create, in the current OFD file, OFD page content corresponding to the page content of a specified page of the external OFD file; A second creation module is configured to create corresponding OFD resource data in the current OFD file according to resource data used by page content of a specified page of the external OFD file; An establishing module, configured to establish a mapping between the OFD resource data and the OFD page content; The first creation module is specifically configured to traverse all page contents of a specified page of an external OFD file and classify the page contents; establish a data model of the page contents according to the attributes of each type of page contents, and create OFD page contents corresponding to the page contents in the current OFD file according to the data model; The second creation module is specifically configured to traverse the original resource IDs used by all page contents of a specified page of the external OFD file, and parse the resource data of the external OFD file according to the original resource IDs; establish a data model for the resource data, create corresponding resource data in the current document according to the data model, obtain the IDs of each newly created resource data, and establish a mapping relationship between the original resource IDs and the IDs of the newly created resource data; The establishment module is specifically used to traverse the OFD page content created in the current document, and replace the ID of the resource data used by the OFD page content with the ID of the newly created resource data corresponding to the original resource ID.
4. The device according to claim 3, characterized in that Also includes: a correction module, configured to perform coordinate conversion on a target area selected by a user on a page of the current document to obtain corresponding document coordinates; Calculating a scaling parameter according to the size of the target area and the size of the page content of the designated page, and calculating an application matrix of the page content according to the scaling parameter; The application matrix is applied to the OFD page content, new coordinates of the OFD page content are calculated while the page content of the designated page is displayed centered in the target area, and the OFD page content is corrected based on the new coordinates.
