Signing method and device of OFD file, storage medium and computer device
By introducing a semantic mapping mechanism between signature field names and blank placeholder objects in OFD files, the problem of autonomous position acquisition during asynchronous signing of electronic signatures in OFD files is solved, achieving accuracy and consistency of signature position and improving the automated processing capability and integration efficiency of electronic signatures.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA FINANCIAL CERTIFICATION AUTHORITY
- Filing Date
- 2026-03-19
- Publication Date
- 2026-07-03
AI Technical Summary
In existing technologies, electronic signatures for OFD documents cannot autonomously obtain the signature position during the asynchronous signing process, which means that signatories can only sign in specific areas, reducing the convenience of electronic contract signing. Furthermore, users cannot freely choose the signature position, increasing operational complexity.
By introducing a semantic mapping mechanism between signature field names and blank placeholder objects in the indexing file, the signature location information is pre-fixed in the OFD indexing file. The system retrieves and locates blank placeholder objects based on the signature field names, generates signature appearance objects that conform to OFD specifications, and performs digital digest calculation and structured writing, thereby achieving integrated anti-tampering protection for signature appearance and document content.
It enables signing without requiring users to specify specific coordinates, reduces the parsing complexity of the signing process, ensures the accuracy and consistency of the signing position, supports high concurrency and batch asynchronous signing, and improves the integration efficiency and automation capabilities of electronic signatures in complex business systems.
Smart Images

Figure CN122332352A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic document signing technology, and in particular to a method, apparatus, storage medium and computer device for signing OFD documents. Background Technology
[0002] Open Fixed Layout OFD (Official Document Layout) documents have been increasingly promoted and applied in fields such as electronic invoices, electronic certificates, electronic contracts, and electronic bidding. In business applications, it is often necessary to electronically sign OFD documents.
[0003] In existing technologies, users need to drag and drop the electronic seal to multiple locations on the front-end page. The front-end then transmits the location information to the back-end program for signing. The back-end program generates multiple location information according to the structure defined in the OFD standard, allowing the reader to correctly render the signature images from multiple locations. However, for asynchronous signing processes that do not involve front-end operations, the back-end cannot independently obtain the specific location of the seal, thus failing to achieve online synchronous signing. Moreover, in actual business scenarios, signatories can only sign in specific areas. When users sign documents, the electronic seal display position is restricted by templates, and users cannot arbitrarily choose the signing position. If the dragged position does not meet the requirements, the operation needs to be repeated, reducing the convenience of electronic contract signing. Summary of the Invention
[0004] In view of this, this application provides a method, apparatus, storage medium, and computer device for signing OFD documents, solving the problems of creating OFD predefined signature fields and signing predefined signature fields.
[0005] According to a first aspect of this application, a method for signing OFD documents is provided, the method comprising: In response to a signature request initiated by a business party, obtain the signature field name and electronic seal data; Based on the signature field name, retrieve the location information of the blank placeholder object bound to the signature field name from the index file of the OFD file; Based on the location information, locate the blank placeholder object in the OFD file; The seal image extracted from the electronic seal data is mapped to the spatial area corresponding to the blank placeholder object to generate a signature appearance object that conforms to the OFD specification. The digital digest is calculated for the signature appearance object and the resources to be protected in the OFD file, and the generated digest value is encapsulated with the certificate data to generate electronic signature data. The electronic signature data is written into the signature directory structure of the OFD file, and the signature list index of the OFD file is updated synchronously.
[0006] Optionally, the OFD document signing method further includes: In response to a configuration operation, the configuration information of the blank placeholder object is obtained, wherein the configuration information includes the page number of the specified page and the geometric parameters of the blank placeholder object; Based on the geometric parameters, a blank placeholder object is created in the specified page of the OFD file, and the blank placeholder object is associated with an object identifier; The object identifier and the page number of the specified page are used as the positioning information of the blank placeholder object; A mapping relationship between the signature field name and the location information is established in the index file of the OFD file, and a unique constraint is performed on the signature field name for storage.
[0007] Optionally, creating a blank placeholder object in the specified page of the OFD file based on the geometric parameters includes: Register an image object resource with a unique object identifier in the document resource description file of the OFD file, and set the image data stream corresponding to the image object resource to empty data; Create an image object node in the content tree node of the page description file of the specified page; In the image object node, a transformation matrix attribute and a resource identifier attribute are set. The transformation matrix attribute is used to define the geometric parameters of the image object element in the page coordinate system, and the resource identifier attribute points to the object identifier. The document resource description file and page description file are saved to form the visually invisible blank placeholder object when parsing and rendering the OFD file.
[0008] Optionally, the step of mapping the seal image extracted from the electronic seal data to the spatial region corresponding to the blank placeholder object to generate a signature appearance object conforming to the OFD specification includes: Extract the transformation matrix from the blank placeholder object; Based on the transformation matrix, the geometric parameters of the blank placeholder object on the specified page are parsed out, and the geometric parameters include coordinate position and display size; Based on the coordinate position and the display size, calculate the boundary attributes of the signature appearance object as defined in the OFD specification. The boundary attributes consist of four values, which represent the left, bottom, right and top boundaries of the signature appearance on the page. A signature appearance object referencing the electronic seal data is created based on the boundary attributes.
[0009] Optionally, creating a signature appearance object referencing the electronic seal data based on the boundary attributes includes: Register the stamp image resource in the resource description file of the OFD document and assign a unique resource identifier to the stamp image resource; Write the binary stream of the seal image in the electronic seal data into the storage path corresponding to the resource identifier; Create a primitive description instruction stream conforming to the OFD specification, and construct an image distribution object in the primitive description instruction stream; Configure the boundary attributes of the image distribution object based on the coordinate position and the display size, and point the reference attribute of the image distribution object to the resource identifier to form the signature appearance object; Create an appearance definition node in the content tree node of the page description file of the specified page; The primitive description instruction stream is written into the appearance definition node to complete the logical association between the signature appearance object and the electronic signature data.
[0010] Optionally, the OFD document signing method further includes: Extract the signature field occupancy identifier of the blank placeholder object recorded in the index file; If the signature field occupancy flag indicates that a filled signature appearance exists, the signing process is terminated and an error message is returned.
[0011] Optionally, after generating the signature facade object conforming to the OFD specification, the method further includes: In the index file, the signature field occupancy identifier of the blank placeholder object is updated to the appearance of a filled signature.
[0012] Optionally, the index file is an XML file that is independent of the page content tree of the OFD file or a specific metadata file embedded in the OFD package.
[0013] According to a second aspect of this application, an OFD document signing device is provided, the device comprising: The acquisition module is used to respond to the signature request initiated by the business party and obtain the signature field name and electronic seal data; The signature field location module is used to retrieve the location information of the blank placeholder object bound to the signature field name from the index file of the OFD file based on the signature field name; and to locate the blank placeholder object in the OFD file based on the location information. The signature generation module is used to map the seal image extracted from the electronic seal data to the spatial area corresponding to the blank placeholder object, and generate a signature appearance object that conforms to the OFD specification. The signature module is used to perform digital digest calculation on the signature appearance object and the resources to be protected in the OFD file, and encapsulate the generated digest value with certificate data to generate electronic signature data; and to write the electronic signature data into the signature directory structure of the OFD file and update the signature list index of the OFD file synchronously.
[0014] Optionally, the acquisition module is further configured to acquire configuration information of the blank placeholder object in response to the configuration operation, wherein the configuration information includes the page number of the specified page and the geometric parameters of the blank placeholder object; The OFD document signing device also includes: A signature field creation module is used to create a blank placeholder object in the specified page of the OFD file based on the geometric parameters, the blank placeholder object being associated with an object identifier; and to use the object identifier and the page number of the specified page as the positioning information of the blank placeholder object; and to establish a mapping relationship between the signature field name and the positioning information in the index file of the OFD file, and to perform unique constraint storage based on the signature field name.
[0015] Optionally, the signature field creation module is specifically used to register an image object resource with a unique object identifier in the document resource description file of the OFD file, and set the image data stream corresponding to the image object resource to empty data; create an image object node in the content tree node of the page description file of the specified page; set a transformation matrix attribute and a resource identifier attribute in the image object node, wherein the transformation matrix attribute is used to define the geometric parameters of the image object element in the page coordinate system, and the resource identifier attribute points to the object identifier; and save the document resource description file and the page description file to form the visually invisible blank placeholder object when parsing and rendering the OFD file.
[0016] Optionally, the signature generation module is specifically used to extract the transformation matrix from the blank placeholder object; based on the transformation matrix, parse the geometric parameters of the blank placeholder object on the specified page, the geometric parameters including coordinate position and display size; based on the coordinate position and the display size, calculate the boundary attributes of the signature appearance object as defined in the OFD specification, the boundary attributes consisting of four values representing the left, bottom, right, and top boundaries of the signature appearance on the page; and create a signature appearance object referencing the electronic seal data based on the boundary attributes.
[0017] Optionally, the signature generation module is specifically used to register a seal image resource in the resource description file of the OFD document and assign a unique resource identifier to the seal image resource; write the binary stream of the seal image in the electronic seal data into the storage path corresponding to the resource identifier; create a primitive description instruction stream conforming to the OFD specification and construct an image distribution object in the primitive description instruction stream; configure the boundary attributes of the image distribution object based on the coordinate position and the display size, and point the reference attribute of the image distribution object to the resource identifier to form the signature appearance object; create an appearance definition node in the content tree node of the page description file of the specified page; and write the primitive description instruction stream into the appearance definition node to complete the logical association between the signature appearance object and the electronic signature data.
[0018] Optionally, the OFD document signing device further includes: The verification module is used to extract the signature field occupancy identifier recorded in the indexing file by the blank placeholder object; if the signature field occupancy identifier indicates that there is a filled signature appearance, the signing process is terminated and an error message is returned.
[0019] Optionally, the OFD document signing device further includes: An update module is used to update the signature field occupancy identifier of the blank placeholder object in the index file to the appearance of a filled signature.
[0020] Optionally, the index file is an XML file that is independent of the page content tree of the OFD file or a specific metadata file embedded in the OFD package.
[0021] According to a third aspect of this application, a readable storage medium is provided on which a program or instructions are stored, which, when executed by a processor, implement the steps of the above-described OFD document signing method.
[0022] According to a fourth aspect of this application, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the above-described OFD document signing method.
[0023] By employing the aforementioned technical solution, a semantic mapping mechanism is introduced between signature field names and blank placeholder objects in the indexing file. This pre-defines the location information of permitted blank placeholder objects in the OFD indexing file. The system can then use the signature field name in the business request as an index key to retrieve and locate the specific spatial coordinates of the blank placeholder object. Based on this location, the extracted seal image is mapped to generate a signature appearance conforming to OFD specifications. Finally, the signature appearance and the protected resource are jointly digested and structured, achieving integrated anti-tampering protection for both the signature appearance and document content. This ensures both the compliant visualization of the electronic signature in the OFD file and the integrity and non-repudiation of the signature data. This eliminates the need for the signer to specify specific coordinates; only the signature field name is required to complete the signing process. This reduces the complexity of parsing the OFD document structure during the signing process and effectively solves the problems of traditional solutions that rely on real-time user interaction, manual transmission of coordinate sequences, or the inability to eliminate human intervention. It enables business systems to initiate high-concurrency, batch-based asynchronous signing requests in a purely data-driven manner, improving the integration efficiency and automation capabilities of electronic signatures in complex business systems. Meanwhile, since the signing position is precisely locked by blank placeholders during the template design stage, the risk of overlapping or positional deviation of seals due to human error can be prevented, ensuring a high degree of consistency and compliance of the signing effect of multiple documents.
[0024] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0025] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This illustration shows one of the flowcharts of the OFD document signing method provided in this application embodiment; Figure 2 This is a second schematic flowchart illustrating the OFD document signing method provided in an embodiment of this application; Figure 3 A structural block diagram of the OFD document signing device provided in an embodiment of this application is shown; Figure 4 A schematic diagram of the electronic structure of a computer device provided in an embodiment of this application is shown. Detailed Implementation
[0026] The present application will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of the present application can be combined with each other.
[0027] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0028] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this application means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “attached” to another element, it can be directly connected or attached to the other element, or there may be intermediate elements present. Furthermore, the term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.
[0029] Exemplary embodiments according to this application will now be described in more detail with reference to the accompanying drawings. However, these exemplary embodiments may be implemented in many different forms and should not be construed as being limited to the embodiments set forth herein. It should be understood that these embodiments are provided so that the disclosure of this application is thorough and complete, and that the concept of these exemplary embodiments is fully conveyed to those skilled in the art.
[0030] This embodiment provides a method for signing OFD documents, such as... Figure 1 As shown, the method includes: Step 101: In response to the signature request initiated by the business party, obtain the signature field name and electronic seal data of the OFD file.
[0031] Understandably, electronic seal data typically conforms to national standards and includes a binary stream of the seal image, signature certificate, and private key information.
[0032] In this embodiment, a specific graphic object (blank placeholder object) that is visually blank is predefined in the OFD file, and a unique signature field name and attributes are set for it in the indexing file. When initiating a signing process, it is no longer necessary to accurately calculate and pass in the page number and coordinate values; only the predefined signature field name (PartyASignature) and electronic seal data containing the seal image and certificate information are required to start the signing process.
[0033] like Figure 2 As shown, in one embodiment, before step 101, the OFD document signing method further includes: Step 201: In response to the configuration operation, obtain the configuration information of the blank placeholder object.
[0034] The configuration information includes the page number of the specified page and the geometric parameters of the blank placeholder object, which include the coordinate position and display size of the blank placeholder object on the specified page.
[0035] For example, during the electronic contract creation stage, users open an OFD file using a signature configuration tool and select the area where signature is required. The system automatically captures the geometric parameters of the selected area, including the coordinates of the top-left corner (X,Y), width W, and height H, while also recording the current page number. These parameters constitute the geometric parameters of the blank placeholder object in physical space.
[0036] Step 202: Create a blank placeholder object in the specified page of the OFD file based on the geometric parameters.
[0037] The blank placeholder objects are associated with object identifiers.
[0038] Step 203: Use the object identifier and the page number of the specified page as the positioning information for the blank placeholder object.
[0039] Step 204: Establish a mapping relationship between signature field names and location information in the index file of the OFD file, and perform uniqueness constraint storage based on the signature field names.
[0040] The index file is index data independent of the OFD page content description. It records the mapping relationship between signature field names and their actual physical locations (i.e., blank placeholder objects). It can be an XML file that is independent of the page content tree of the OFD file or a specific metadata file embedded in the OFD package. If it is in XML file format, it can be placed in a custom path within the OFD package (such as Doc_0 / Tags / CustomTag.xml); if it is in metadata file format, it can be embedded in an extended metadata container defined by the OFD standard.
[0041] In this embodiment, configuration information for a blank placeholder object, including the specified page number and geometric parameters, is obtained through a configuration operation. Based on the geometric parameters, a blank placeholder object with an associated object identifier is created on the corresponding page in the OFD file, and the object identifier and page number are used as positioning information. A one-to-one relationship is established between this positioning information and the signature field name, and this positioning information is stored in the OFD index file in association with the signature field name. This achieves standardized definition and structured storage of the signing position, allowing subsequent signing processes to quickly and accurately locate the preset signing position directly based on the signature field name without parsing complex page content trees. This effectively avoids problems such as incorrect signing positions, duplicate definitions, and out-of-bounds display, improving the positioning accuracy and processing efficiency of OFD electronic signatures. At the same time, it ensures the standardization and compatibility of the signing configuration with the OFD document structure, and provides high reusability and reliability for subsequent automated calls and template-based batch signing in the system.
[0042] Furthermore, step 202 specifically includes the following steps: Step 202-1: Register an image object resource with a unique object identifier in the document resource description file of the OFD file, and set the image data stream corresponding to the image object resource to empty data.
[0043] The resource description file is responsible for managing all external resources required by the page, such as Doc_0 / Pages / Page_N / Res.xml.
[0044] Step 202-2: Create an image object node in the content tree node of the page description file of the specified page.
[0045] Step 202-3: Set the transformation matrix attribute and resource identifier attribute in the image object node.
[0046] The transformation matrix attribute defines the geometric parameters of the image object elements in the page coordinate system. The resource identifier attribute points to the object identifier.
[0047] It should be understood that since the OFD coordinate system usually takes the bottom left corner of the page as its origin, if the transformation matrix is defined based on the top left corner, then the corresponding coordinate system transformation calculation is required.
[0048] Step 202-4: Save the document resource description file and page description file to form visually invisible blank placeholder objects when parsing and rendering the OFD file.
[0049] In this embodiment, by utilizing the image object structure in the OFD standard specification and setting the image data stream to empty data, placeholder objects are created, providing precise semantic anchors for automated backend signing without disrupting the original document's visual presentation logic. Furthermore, by pre-setting transformation matrices and resource identifiers in the page description file, the physical location and size of the configurable stamp are locked, establishing a one-to-one semantic mapping between image object nodes and image object resources. This allows for quick and accurate location of empty nodes to be filled within the page description file based on the identifiers. This ensures that even in complex document reconstruction or parsing environments, the signing position and geometric parameters maintain a strong structural correlation, contributing to improved positioning reliability and standard compliance of electronic signatures in high-performance, non-interactive batch processing scenarios.
[0050] For example, a new Image resource is registered in the OFD document and assigned a globally unique ID. Crucially, the data stream pointed to by this Image resource is set to empty or points to a zero-byte file. Since there is no actual image binary data, the rendering engine cannot draw visible pixels when parsing the resource, thus achieving a visually invisible blank effect. Next, a new ImageObject node is added under the Content node in the page description file of the specified page to hold the previously registered Image resource. The Current Transformation Matrix (CTM) value is set in the ImageObject node, mapping the coordinates and dimensions obtained during the configuration phase to the page coordinate system. Simultaneously, the ResourceID attribute is set to point to the previously registered empty data image resource ID. Finally, the document resource description file and page description file are saved. When the OFD reader loads the page, it parses the image object node according to the content tree and attempts to reference the empty data resource for drawing, forming a visually invisible blank placeholder object. For example, <imageobject ID="1610" Boundary="100.0 100.0 130.0 65.0" CTM="130.0 0 0 65.0 00" / > In the text, "1610" is the object identifier, "100.0 100.0 130.0 65.0" are the coordinates of the top left corner, width, and height of the signature box, respectively, and "130.0 0 0 65.0 0 0" is the coordinate transformation matrix.
[0051] Step 102: Based on the signature field name, retrieve the location information of the blank placeholder object bound to the signature field name from the index file of the OFD file.
[0052] In this embodiment, the system parses the OFD file to read the indexing file and retrieves it using the signature domain name as the key. If the retrieval is successful, the system returns the location information of the associated blank placeholder object. This binds the custom name signature to its physical location, so that the seal no longer depends on unstable physical coordinates, but is associated with a predefined placeholder in the document structure, improving the robustness of signature location. Moreover, the signature position can be adjusted by modifying the mapping relationship of the indexing file without regenerating the entire layout file. Even the same OFD file can be reused in different business scenarios, which helps to improve the integration efficiency of electronic signatures in complex business systems.
[0053] Step 103: Locate the blank placeholder object in the OFD file based on the location information.
[0054] The blank placeholder is a pre-embedded location carrier in the OFD file. This blank placeholder is visually invisible, but logically occupies a specific space area. The location of the signature can be determined by locating the blank placeholder.
[0055] Step 104 involves mapping the seal image extracted from the electronic seal data to the spatial area corresponding to the blank placeholder object, thereby generating a signature appearance object that conforms to the OFD specification.
[0056] In this embodiment, the electronic seal data is parsed to extract the binary stream of the seal image. At the document data structure level, the seal image is scaled or tiled within the space area occupied by the read blank placeholder object. This allows the signature appearance object to inherit the positional attributes of the blank placeholder object, avoiding signature offset, misalignment, and text overlay, ensuring standardized and consistent signature position, and improving the positional accuracy of automated OFD document signing.
[0057] In practical applications, step 104 specifically includes the following steps: Step 104-1: Extract the transformation matrix from the blank placeholder object.
[0058] Step 104-2: Based on the transformation matrix, parse out the geometric parameters of the blank placeholder object on the specified page.
[0059] The geometric parameters include coordinate position and display size.
[0060] Step 104-3: Calculate the boundary properties of the signature appearance object as defined in the OFD specification based on the coordinate position and display size.
[0061] The boundary attribute consists of four values, representing the left, bottom, right, and top boundaries of the signature appearance on the page.
[0062] Step 104-4: Create a signature appearance object that references the electronic seal data based on the boundary attributes.
[0063] In this embodiment, the transformation matrix is extracted from the blank placeholder object and its coordinate position and display size on the specified page are obtained through parsing. Based on this, the boundary attributes of the signature appearance object conforming to the OFD specification are calculated and generated, and finally, a signature appearance object associated with the electronic seal data is created. This achieves precise matching between the signature appearance and the placeholder area, avoiding dynamic calculation deviations in the signature position and size, and ensuring that the display position and proportion of the signature appearance on the OFD page are completely consistent with the preset placeholder area. This effectively eliminates the risk of seal offset caused by cross-platform environment differences, hard-coded coordinate deviations, or manual calibration errors. Moreover, no additional definition or modification of the page layout is required; the standardized creation of the signature appearance can be completed based on the placeholder object, significantly simplifying the signature appearance generation logic and reducing the complexity of layout parsing and rendering.
[0064] Further, step 104-4 specifically includes: registering the seal image resource in the resource description file of the OFD document and assigning a unique resource identifier to the seal image resource; writing the binary stream of the seal image in the electronic seal data to the storage path corresponding to the resource identifier; creating a primitive description instruction stream conforming to the OFD specification and constructing an image distribution object in the primitive description instruction stream; configuring the boundary attributes of the image distribution object based on the coordinate position and display size, and pointing the reference attribute of the image distribution object to the resource identifier to form a signature appearance object; creating an appearance definition node in the content tree node of the page description file of the specified page; and writing the primitive description instruction stream to the appearance definition node to complete the logical association between the signature appearance object and the electronic seal data.
[0065] In this embodiment, structured storage and secure reuse of seal images are achieved through unique resource identifiers. Standardized construction of primitive description instruction streams and image distribution objects ensures precise control over the position, size, and rendering effect of the signature appearance, while maintaining full compatibility with the OFD layout system. Simultaneously, the signature appearance object is embedded into the page content tree as an independent appearance definition node. This ensures layout isolation between the seal appearance and document content, and decouples the seal data from its presentation, significantly improving the resource security, format standardization, and rendering consistency of OFD electronic seals, providing stable and reliable technical support for seal generation.
[0066] Step 105: Calculate the digital digest of the signature appearance object and the resources to be protected in the OFD file, and encapsulate the generated digest value with the certificate data to generate electronic signature data.
[0067] It should be noted that the resources to be protected can be the main text of the OFD file, key charts, etc., and can be set reasonably according to business needs.
[0068] In this embodiment, the system takes the newly generated signature appearance object and the content to be protected in the OFD file as input, and uses a hash algorithm to calculate a digital digest. The digest value is encrypted using a private key provided by the business party, and combined with information such as the digital certificate and signature timestamp, to encapsulate and generate an electronic signature data packet conforming to the OFD standard. This ensures the integrity and security of the signature data, effectively preventing tampering with the document content or signature appearance.
[0069] Step 106: Write the electronic signature data into the signature directory structure of the OFD file and update the signature list index of the OFD file synchronously.
[0070] The OFD document signing method provided in this application introduces a semantic mapping mechanism between signature field names and blank placeholder objects in the indexing file. The location information of the blank placeholder objects that allow signing is pre-embedded in the OFD indexing file. The system can use the signature field name in the business request as an index key to retrieve and locate the specific spatial coordinates of the blank placeholder object. Based on this location, the extracted seal image is mapped to generate a signature appearance conforming to OFD specifications. Finally, the signature appearance and the resource to be protected are jointly digested and structured, achieving integrated anti-tampering protection of the signature appearance and document content. This ensures both the compliant visualization of the electronic signature in the OFD file and the integrity and non-repudiation of the signature data and the original text. This eliminates the need for signatories to specify exact coordinates; they only need to provide the signature field name to complete the signing process. This reduces the complexity of parsing the OFD document structure during the signing process and effectively solves the problems of traditional solutions that require real-time user interaction, manual transmission of coordinate sequences, or inability to eliminate human intervention. It enables business systems to initiate high-concurrency, batch-based asynchronous signing requests in a purely data-driven manner, improving the integration efficiency and automation capabilities of electronic signatures in complex business systems. Furthermore, since the signing position is precisely locked by blank placeholders during the template design phase, it prevents the risk of overlapping or misaligned seals due to human error, ensuring a high degree of consistency and compliance in the signing of multiple documents.
[0071] In one embodiment, the OFD document signing method further includes: extracting the signature field occupancy identifier recorded in the index file for the blank placeholder object; if the signature field occupancy identifier indicates that there is a filled signature appearance, then terminating the signing process and returning an error message.
[0072] In this embodiment, after locating the blank placeholder object, the signature field occupancy identifier of the blank placeholder object in the indexing file is extracted. If a filled signature appearance is detected, the process terminates directly and an error message is returned. Conversely, if an unfilled signature appearance is detected, the seal image extracted from the electronic seal data can continue to be mapped to the spatial area corresponding to the blank placeholder object to generate a signature appearance object conforming to the OFD specification. This avoids duplicate signatures of the same signature field, effectively ensuring the uniqueness and non-repudiation of OFD electronic signatures, while preventing formatting errors, data overwriting, or signature verification failures caused by duplicate signatures.
[0073] Similarly, after step 104, the signature field occupancy flag of the blank placeholder object can be updated to a filled signature appearance in the indexing file. The signature status of this signature field can be recorded and fixed in real time to prevent signature overwriting caused by subsequent OFD electronic signature processes reusing the signature position.
[0074] For example, taking a multi-party signed OFD format sales contract as an example, two blank placeholders are pre-set on the signature page of the sales contract: one is located in the lower left corner of the page, with the associated signature domain name called "SellerSign"; the other is located in the lower right corner of the page, with the associated signature domain name called "BuyerSign". The location information of these two signature domains is recorded in the index file of the OFD file, and the initial signature domain occupancy indicator is "unoccupied".
[0075] At the start of the signing process, the buyer's business system initiates a signature request. The system responds to the signature request by retrieving the signature field name (BuyerSign) and electronic seal data. It reads the index file, using "BuyerSign" as the key, and retrieves the object ID (img_002) and page number (Page3) of the blank placeholder object bound to the signature field name from the OFD file's index file. Based on the object ID and page number, the system navigates to the page description file on page 3 and finds the image object node with ID "img_002". Since this is the first signing, this identifier is "unoccupied," and the verification passes. After successful verification, the system extracts the transformation matrix from the blank placeholder object with ID "img_002," parses the geometric parameters of the buyer's signature field, and calculates the boundary attributes accordingly. Subsequently, the buyer's seal image resource is registered in the document, and a signature appearance object referencing this resource is created, ensuring the seal accurately falls in the preset lower right corner position. Then, a digital digest is calculated for the signature appearance object and the resources to be protected in the OFD file. The generated digest value is then encapsulated with the certificate data to generate electronic signature data. The electronic signature data is written into the signature directory structure of the OFD file, and the signature list index of the OFD file is updated synchronously. Through the above process, the buyer completes the signature at the specified location using only a name string. If the buyer attempts to initiate a signature request for "BuyerSign" again, the system will recognize that the occupancy identifier has been updated during the verification phase, thereby intercepting the erroneous operation.
[0076] The OFD document signing method provided in this application can be applied to a terminal, a server, or software running on either a terminal or a server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, etc.; the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0077] It should be noted that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0078] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0079] Furthermore, such as Figure 3 As shown, as a specific implementation of the above-mentioned OFD document signing method, this application embodiment provides an OFD document signing device 300, which includes: an acquisition module 301, a signature field positioning module 302, a signature generation module 303, and a signing module 304.
[0080] The acquisition module 301 is used to respond to the signature request initiated by the business party and acquire the signature field name and electronic seal data. The signature field location module 302 is used to retrieve the location information of the blank placeholder object bound to the signature field name from the index file of the OFD file based on the signature field name; and to locate the blank placeholder object in the OFD file based on the location information. The signature generation module 303 is used to map the seal image extracted from the electronic seal data to the spatial area corresponding to the blank placeholder object, and generate a signature appearance object that conforms to the OFD specification. The signature module 304 is used to calculate the digital digest of the signature appearance object and the resources to be protected in the OFD file, and encapsulate the generated digest value with the certificate data to generate electronic signature data; and to write the electronic signature data into the signature directory structure of the OFD file and update the signature list index of the OFD file synchronously.
[0081] Furthermore, the acquisition module 301 is also used to acquire configuration information of the blank placeholder object in response to the configuration operation, wherein the configuration information includes the page number of the specified page and the geometric parameters of the blank placeholder object; The OFD document signing device 300 also includes: The signature field creation module (not shown in the figure) is used to create blank placeholder objects in a specified page of the OFD file based on geometric parameters. The blank placeholder objects are associated with object identifiers. The object identifiers and the page numbers of the specified pages are used as the positioning information of the blank placeholder objects. The module also establishes a mapping relationship between signature field names and positioning information in the index file of the OFD file and performs uniqueness constraints on the storage based on the signature field names.
[0082] Furthermore, the signature field creation module is specifically used to register image object resources with unique object identifiers in the document resource description file of the OFD file, and set the image data stream corresponding to the image object resource to empty data; create image object nodes in the content tree node of the page description file of the specified page; set transformation matrix attributes and resource identifier attributes in the image object nodes, the transformation matrix attribute is used to define the geometric parameters of the image object element in the page coordinate system, and the resource identifier attribute points to the object identifier; save the document resource description file and the page description file to form visually invisible blank placeholder objects when parsing and rendering the OFD file.
[0083] Furthermore, the signature generation module 303 is specifically used to extract the transformation matrix from the blank placeholder object; based on the transformation matrix, it parses the geometric parameters of the blank placeholder object on the specified page, including the coordinate position and display size; based on the coordinate position and display size, it calculates the boundary attributes of the signature appearance object as defined in the OFD specification, the boundary attributes consisting of four values, representing the left boundary, bottom boundary, right boundary and top boundary of the signature appearance on the page; and based on the boundary attributes, it creates a signature appearance object that references the electronic seal data.
[0084] Furthermore, the signature generation module 303 is specifically used to register the seal image resource in the resource description file of the OFD document and assign a unique resource identifier to the seal image resource; write the binary stream of the seal image in the electronic seal data to the storage path corresponding to the resource identifier; create a primitive description instruction stream conforming to the OFD specification and construct an image distribution object in the primitive description instruction stream; configure the boundary attributes of the image distribution object based on the coordinate position and display size, and point the reference attribute of the image distribution object to the resource identifier to form a signature appearance object; create an appearance definition node in the content tree node of the page description file of the specified page; and write the primitive description instruction stream to the appearance definition node to complete the logical association between the signature appearance object and the electronic seal data.
[0085] Furthermore, the OFD document signing device 300 also includes: The verification module (not shown in the figure) is used to extract the signature field occupancy identifier recorded in the indexing file for blank placeholder objects; if the signature field occupancy identifier indicates that there is a filled signature appearance, the signing process is terminated and an error message is returned.
[0086] Furthermore, the OFD document signing device 300 also includes: The update module (not shown in the figure) is used to update the signature field occupancy identifier of blank placeholder objects in the indexing file to the appearance of a filled signature.
[0087] Furthermore, the index file is an XML file that is independent of the page content tree of the OFD file or a specific metadata file embedded in the OFD package.
[0088] Specific limitations regarding the signing device for OFD documents can be found in the limitations on OFD document signing methods described above, and will not be repeated here. Each module in the aforementioned OFD document signing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in a computer device, or stored in software in the memory of a computer device, so that the processor can call and execute the operations corresponding to each module.
[0089] Based on the above, Figure 1 Accordingly, embodiments of this application also provide a readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method. Figure 1 The method for signing OFD documents is shown.
[0090] Based on this understanding, the technical solution of this application can be embodied in the form of a software product. The software product can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, or portable hard drive), and includes several instructions to cause a computer device (such as a personal computer, server, or network device) to execute the methods described in the various implementation scenarios of this application.
[0091] Based on the above, Figure 1 The method shown, and Figure 3 The virtual device embodiment shown is designed to achieve the above objectives, such as... Figure 4 As shown in the figure, this application embodiment also provides a computer device 400, which includes a processor 401 and a memory 402. The memory 402 stores a program or instructions that can run on the processor 401. When the program or instructions are executed by the processor 401, they implement the above-mentioned... Figure 1 The method for signing OFD documents is shown.
[0092] The memory 402 can be used to store software programs and various data. The memory 402 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 402 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 402 in this embodiment includes, but is not limited to, these and any other suitable types of memory.
[0093] Processor 401 may include one or more processing units; optionally, processor 401 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 401.
[0094] Computer equipment can specifically include personal computers, servers, network devices, etc.
[0095] Optionally, the computer device may also include a user interface, a network interface, a camera, radio frequency (RF) circuitry, sensors, audio circuitry, a Wi-Fi module, etc. The user interface may include a display screen, input units such as a keyboard, etc., and optional user interfaces may also include USB ports, card reader ports, etc. The network interface may optionally include standard wired interfaces, wireless interfaces (such as Bluetooth interfaces, Wi-Fi interfaces), etc.
[0096] Those skilled in the art will understand that the computer device structure provided in this embodiment does not constitute a limitation on the computer device, and may include more or fewer components, or combine certain components, or have different component arrangements.
[0097] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platform, or it can be implemented by hardware.
[0098] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing this application. Those skilled in the art will understand that the modules in the apparatus of the embodiment can be distributed within the apparatus of the embodiment as described, or can be modified to be located in one or more apparatuses different from this embodiment. The modules of the above-described embodiment can be combined into one module, or further divided into multiple sub-modules.
[0099] The serial numbers in this application are for descriptive purposes only and do not represent the superiority or inferiority of any particular implementation scenario. The above disclosures are merely a few specific implementation scenarios of this application; however, this application is not limited thereto, and any variations conceived by those skilled in the art should fall within the protection scope of this application.
Claims
1. A method for signing OFD documents, characterized in that, The method includes: In response to a signature request initiated by a business party, obtain the signature field name and electronic seal data; Based on the signature field name, retrieve the location information of the blank placeholder object bound to the signature field name from the index file of the OFD file; Based on the location information, locate the blank placeholder object in the OFD file; The seal image extracted from the electronic seal data is mapped to the spatial area corresponding to the blank placeholder object to generate a signature appearance object that conforms to the OFD specification. The digital digest is calculated for the signature appearance object and the resources to be protected in the OFD file, and the generated digest value is encapsulated with the certificate data to generate electronic signature data. The electronic signature data is written into the signature directory structure of the OFD file, and the signature list index of the OFD file is updated synchronously.
2. The OFD document signing method according to claim 1, characterized in that, The method further includes: In response to a configuration operation, the configuration information of the blank placeholder object is obtained, wherein the configuration information includes the page number of the specified page and the geometric parameters of the blank placeholder object; Based on the geometric parameters, a blank placeholder object is created in the specified page of the OFD file, and the blank placeholder object is associated with an object identifier; The object identifier and the page number of the specified page are used as the positioning information of the blank placeholder object; A mapping relationship between the signature field name and the location information is established in the index file of the OFD file, and a unique constraint is performed on the signature field name for storage.
3. The OFD document signing method according to claim 2, characterized in that, Creating a blank placeholder object in the specified page of the OFD file based on the geometric parameters includes: Register an image object resource with a unique object identifier in the document resource description file of the OFD file, and set the image data stream corresponding to the image object resource to empty data; Create an image object node in the content tree node of the page description file of the specified page; In the image object node, a transformation matrix attribute and a resource identifier attribute are set. The transformation matrix attribute is used to define the geometric parameters of the image object element in the page coordinate system, and the resource identifier attribute points to the object identifier. The document resource description file and page description file are saved to form the visually invisible blank placeholder object when parsing and rendering the OFD file.
4. The OFD document signing method according to claim 1, characterized in that, The step of mapping the seal image extracted from the electronic seal data to the spatial region corresponding to the blank placeholder object to generate a signature appearance object conforming to the OFD specification includes: Extract the transformation matrix from the blank placeholder object; Based on the transformation matrix, the geometric parameters of the blank placeholder object on the specified page are parsed out, and the geometric parameters include coordinate position and display size; Based on the coordinate position and the display size, calculate the boundary attributes of the signature appearance object as defined in the OFD specification; A signature appearance object referencing the electronic seal data is created based on the boundary attributes.
5. The OFD document signing method according to claim 4, characterized in that, The process of creating a signature appearance object that references the electronic seal data based on the boundary attributes includes: Register the stamp image resource in the resource description file of the OFD document and assign a unique resource identifier to the stamp image resource; Write the binary stream of the seal image in the electronic seal data into the storage path corresponding to the resource identifier; Create a primitive description instruction stream conforming to the OFD specification, and construct an image distribution object in the primitive description instruction stream; Configure the boundary attributes of the image distribution object based on the coordinate position and the display size, and point the reference attribute of the image distribution object to the resource identifier to form the signature appearance object; Create an appearance definition node in the content tree node of the page description file of the specified page; The primitive description instruction stream is written into the appearance definition node to complete the logical association between the signature appearance object and the electronic signature data.
6. The method for signing OFD documents according to claim 1, characterized in that, The method further includes: Extract the signature field occupancy identifier of the blank placeholder object recorded in the index file; If the signature field occupancy flag indicates that a filled signature appearance exists, the signing process is terminated and an error message is returned. After generating the signature facade object conforming to the OFD specification, the method further includes: In the index file, the signature field occupancy identifier of the blank placeholder object is updated to the appearance of a filled signature.
7. The OFD document signing method according to claim 1, characterized in that, The index file is an XML file that is independent of the page content tree of the OFD file or a specific metadata file embedded in the OFD package.
8. A signing device for OFD documents, characterized in that, The device includes: The acquisition module is used to respond to the signature request initiated by the business party and obtain the signature field name and electronic seal data; The signature field location module is used to retrieve the location information of a blank placeholder object bound to the signature field name from the index file of the OFD file based on the signature field name; and, Based on the location information, locate the blank placeholder object in the OFD file; The signature generation module is used to map the seal image extracted from the electronic seal data to the spatial area corresponding to the blank placeholder object, and generate a signature appearance object that conforms to the OFD specification. The signature module is used to calculate the digital digest of the signature appearance object and the resources to be protected in the OFD file, and encapsulate the generated digest value with certificate data to generate electronic signature data; and, The electronic signature data is written into the signature directory structure of the OFD file, and the signature list index of the OFD file is updated synchronously.
9. A readable storage medium having a program or instructions stored thereon, characterized in that, When the program or instructions are executed by the processor, they implement the OFD document signing method as described in any one of claims 1 to 7.
10. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the OFD document signing method as described in any one of claims 1 to 7.