A method for realizing streaming editing of an OFD format document

By calculating the text coordinates in the OFD document and introducing private attribute identifiers, streaming editing of OFD layout documents is solved, and the problem of lack of OFD layout document editing software is reduced, and the cost is improved and editing efficiency is improved.

CN115828860BActive Publication Date: 2025-08-01JIANGXI KINGGRID TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211015748.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-24
Publication Date
2025-08-01
Estimated Expiration
2042-08-24

AI Technical Summary

Technical Problem

The lack of editing software for OFD layout documents leads to users need to edit repeatedly between streaming and layout software, causing high cost and low efficiency problems.

Method used

Provide a method for streaming editing of OFD-type documents. By reading the textobject elements in the document, using the X, Y, DeltaX, and DeltaY properties of TextCode to calculate text coordinates, branches and segments, introduce private attributes to identify the starting position of rows and segments, realize the branch and segments of text, and recalculate the coordinates during editing to achieve flow effect.

Benefits of technology

Users only need to purchase a set of software to realize reading and editing capabilities, reduce costs and improve editing efficiency, solve editing obstacles when there is no corresponding streaming document, and improve editing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115828860B_ABST
    Figure CN115828860B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for realizing flowing editing of OFD format documents, belonging to the field of flowing editing of OFD format documents. A method for realizing flowing editing of OFD format documents includes the following steps: Step S1: Read all textobject elements from the OFD page; Step S2: Since each character in OFD has an absolute position, which is given by the X, Y, DeltaX, and DeltaY attributes of TextCode. According to common knowledge, in an ideal state, the baselines of each character in a line should be equal. Based on floating-point numbers, we artificially set a difference value on the y-axis; The advantages of the present invention compared with the prior art are as follows: The cost is reduced. For OFD, only one set of software needs to be purchased to achieve reading, editing and other capabilities, and the cost of one set of flowing software can be saved when it is not needed; When there is no corresponding flowing document, the document editing requirements can still be realized, improving the editing efficiency and reducing the editing cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of OFD format document flow editing, and particularly relates to a method for realizing flow editing of OFD format documents. Background Art

[0002] The OFD file is a type of format file, which is comparable to PDF. Its greatest feature is that it is a format file format standard independently developed and formulated by our country. Compared with other format files such as PDF, OFD has some technical advantages: First, the OFD document internally uses the extensible markup language XML to describe data and structures, with a compact volume, being secure, open, and easy to expand; Second, OFD supports domestic encryption algorithms and has a comprehensive security guarantee system, which can prevent information from being stolen. Combined with digital signature technology, it can prevent tampering and repudiation, and is more secure; Third, it can be permanently readable and usable, can store files for a long time, and can be accurately presented. The layout content of the file can maintain consistency in different scenarios and devices; Fourth, it supports a series of processing for direct file archiving.

[0003] Since the birth of OFD to today, the promotion of the OFD standard format in our country is also gradually advancing.

[0004] However, there is no corresponding editing software for OFD format documents, which are domestic independent formats. This brings two problems. First, if a user has an original flow document and wants to revise the content of the format document, the user needs to continuously edit on the flow software and then generate the format document to confirm the format effect, repeating on the flow and format software until the final editing to obtain the desired effect; On the other hand, if the user only has a format document without a corresponding flow document, there will be great obstacles to editing. Either the user re-enters and typesets, or re-typesets with the help of optical character recognition technology.

[0005] In short, without an editing software for OFD documents, the software cost and document editing cost will be very high, and at the same time, the editing efficiency is very low. The editing method of the present patent invention enables users to have both reading and editing capabilities on only one set of OFD software, which not only reduces costs but also improves the document processing efficiency. Summary of the Invention

[0006] The purpose of the present invention is to provide a method for realizing flow editing of OFD format documents to solve the problems raised in the above background art.

[0007] To achieve the above purpose, the present invention provides the following technical solution: A method for realizing flow editing of OFD format documents, including the following steps:

[0008] Step S1: Read all textobject elements from the OFD page;

[0009] Step S2: Since each character in OFD has an absolute position, which is given by the X, Y, DeltaX, and DeltaY attributes of TextCode; a difference value is artificially set on the y-axis of TextCode based on floating-point numbers, and the absolute coordinates X and Y of each character are calculated. If the difference between the Y coordinate of a character and the Y coordinate of the previous character is within the set difference value, it indicates that this character and the previous character are on the same line.

[0010] Step S3: According to the difference value on the y-axis, characters within this difference value range can be determined to be on the same line, thus achieving line break of characters; the textobject objects of the characters on the same line are enclosed by standard pageblock elements, and private line attribute identifiers are introduced to identify the start position, end position, and the id value of the textobject element within the line, which will be referred to as line pageblock hereafter.

[0011] Step S4: According to the start position and end position of the line pageblock, two difference values are set on the x-axis: the left difference value and the right difference value respectively; when the start position of a line is less than the left difference value from the start position of the previous line on the x-axis, it can be determined that this line and the previous line are within the same paragraph, and when the end position of a line is greater than the right difference value from the end position of the previous line, it can be determined that this line is the last line of this paragraph; thus achieving paragraph break of characters; the textobject objects of the characters in the same paragraph are enclosed by standard pageblock elements, and private paragraph attribute identifiers are introduced to identify the start position, end position, and the line pageblock within the paragraph, which will be referred to as paragraph pageblock hereafter.

[0012] Step S5: When the user edits a certain character or certain characters, if the line height changes, calculate the increment of the line height change, and substitute all the subsequent line pageblocks and paragraph pageblocks into this increment to recalculate the start positions of the lines and paragraphs; the absolute coordinates of the characters can be recalculated according to the start position of the line pageblock; to achieve the effect that the subsequent lines can flow downward when the line height changes.

[0013] Step S6: When the user edits a certain character or certain characters, if the line length changes, recalculate the line break of the pageblocks within the paragraph, and recalculate the start positions of each paragraph after the paragraph; the absolute coordinates of the characters can be recalculated according to the start position of the line pageblock, to achieve the editing effect that the subsequent characters flow downward.

[0014] Technical effects and advantages of the present invention:

[0015] 1. The cost is reduced. For OFD, only one set of software needs to be purchased to achieve functions such as reading and editing. When not needed, the cost of one set of streaming software can be saved.

[0016] 2. When there is no corresponding streaming document, the document editing requirements can still be met, improving the editing efficiency and reducing the editing cost. Brief Description of the Drawings

[0017] Figure 1 It is a schematic diagram of document editing according to the present invention. Detailed Embodiment

[0018] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0019] The present invention provides a method for realizing streaming editing of OFD format documents.

[0020] Among them, the text of the OFD document is mainly controlled by the attributes and content of two elements, namely TextObject and TextCode, such as the size, color, and positioning of the text.

[0021] TextObject refers to the text object in the <<GB∕T 33190-2016 OFD Electronic Document Storage and Exchange Format>> standard. This xml element describes various attributes related to text presentation, such as font type, font size, color, scaling ratio, and text direction.

[0022] TextCode is a sub-table of TextObject and is used to describe the text content, that is, a character encoding. The X, Y, DeltaX, and DeltaY of this element determine the position of each character.

[0023] Example:

[0024] <ofd:textobject id="5" ctm="0.45 0 0 0.999999 0 0" boundary="25.999811 37.683556 157.354691 22.471947" font="6" size="19.773207" weight="700">

[0025] <ofd:textcode x="3.370794" y="18.026957" deltax="26.904835 26.90483326.999157 26.904831 26.904839 26.90483126.999161 g 2 26.904831 26.90484626.999146 26.904846">Software Department Document< / ofd:textcode>

[0026] < / ofd:textobject>

[0027] For attributes that do not involve changes in text layout, directly implement an API to modify the corresponding xml attributes. Such attributes include the FillColor, StrokeColor, Fill, and Stroken attributes of the TextObject element. For these attributes, implement an API to directly reflect the modifications of the upper-layer user to the corresponding xml file of the OFD document. For example, when the user modifies the font color to red, the editing software directly modifies the corresponding xml as follows:

[0028] <ofd:textobject id="5" ctm="0.45 0 0 0.999999 0 0" boundary="25.999811 37.683556 157.354691 22.471947" font="6" size="19.773207" weight="700">

[0029] <ofd:fillcolor Value="255 0 0" ColorSpace="4" / >

[0030] <ofd:strokecolor Value="0 0 0" Alpha="0" / >

[0031] <ofd:textcode x="3.370794" y="18.026957" deltax="26.904835 26.90483326.999157 26.904831 26.904839 26.90483126.999161 g 2 26.904831 26.90484626.999146 26.904846">Software Department Document< / ofd:textcode>

[0032] < / ofd:textobject>

[0033] The method specifically includes the following steps:

[0034] Step S1: Read all textobject elements from the OFD page;

[0035] Step S2: Since each character in OFD has an absolute position, which is given by the X, Y, DeltaX, and DeltaY attributes of TextCode; artificially set a difference value on the y-axis of TextCode based on floating-point numbers, calculate the absolute coordinates X and Y of each character, and compare the Y coordinate of a character with the Y coordinate of the previous character. If the difference is within the set difference value, it indicates that this character and the previous character are on the same line;

[0036] Step S3: According to the difference value on the y-axis, those within this difference value range can be determined to be on the same line, thus achieving line break of the text; enclose the textobject objects of the characters on the same line with the standard pageblock element, and introduce private line attribute identifiers to identify the starting position, ending position, and the id value of the textobject element within the line. Hereinafter, it is called line pageblock;

[0037] Example of line pageblock:

[0038] <pageblock type="line" x="29.370605" y="55.710513">

[0039] <ofd:textobject id="5" ctm="0.45 0 0 0.999999 0 0" boundary="25.999811 37.683556 157.354691 22.471947" font="6" size="19.773207" weight="700">

[0040] <ofd:fillcolor Value="255 0 0" ColorSpace="4" / >

[0041] <ofd:strokecolor Value="0 0 0" Alpha="0" / >

[0042] <ofd:textcode x="3.370794" y="18.026957" deltax="26.904835 26.90483326.999157 26.904831 26.904839 26.90483126.999161 g 2 26.904831 26.90484626.999146 26.904846">Software Department Document< / ofd:textcode>

[0043] < / ofd:textobject>

[0044] < / pageblock>

[0045] Step S4: According to the starting position and ending position of the line pageblock, set two difference values on the x-axis: namely, the left difference value and the right difference value; when the starting position of a line is less than the left difference value from the starting position of the previous line on the x-axis, it can be determined that this line and the previous line are within the same paragraph. When the ending position of a line is greater than the right difference value from the ending position of the previous line, it can be determined that this line is the last line of this paragraph; thus achieving text paragraphing; enclose the textobject objects of the characters in the same paragraph with the standard pageblock element, and introduce private paragraph attribute identifiers to identify the starting position, ending position, and the line pageblocks within the paragraph. Hereinafter, it is called paragraph pageblock;

[0046] Example of paragraph pageboxk:

[0047] <pageblock type="segment" x="29.370605" y="55.710513">

[0048] <pageblock type="line" x="29.370605" y="55.710513">

[0049] <ofd:textobject id="5" ctm="0.45 0 0 0.999999 0 0" boundary="25.999811 37.683556 157.354691 22.471947" font="6" size="19.773207" weight="700">

[0050] <ofd:fillcolor Value="255 0 0" ColorSpace="4" / >

[0051] <ofd:strokecolor Value="0 0 0" Alpha="0" / >

[0052] <ofd:textcode x="3.370794" y="18.026957" deltax="26.904835 26.90483326.999157 26.904831 26.904839 26.904831 26.999161g 2 26.904831 26.90484626.999146 26.904846">Software Department Document< / ofd:textcode>

[0053] < / ofd:textobject>

[0054] < / pageblock>

[0055] <pageblock type="line" x="29.370605" y="65.513">

[0056] <ofd:textobject id="5" ctm="0.45 0 0 0.999999 0 0" boundary="25.999811 65.513 157.354691 22.471947" font="6" size="19.773207" weight="700">

[0057] <ofd:textcode x="3.370794" y="18.026957" deltax="26.904835 26.90483326.999157 26.904831 26.904839 26.90483126.999161 g 2 26.904831 26.90484626.999146 26.904846">Software Department Document< / ofd:textcode>

[0058] < / ofd:textobject>

[0059] < / pageblock>

[0060] < / pageblock>

[0061] Step S5: When the user edits some text or certain text, if the line height changes, calculate the increment of the line height change, and substitute all the subsequent line pageblocks and section pageblocks into this increment to recalculate the starting positions of the lines and sections; the absolute coordinates of the text can then be recalculated based on the starting position of the line pageblock; to achieve the effect that subsequent lines can flow down when the line height changes.

[0062] Step S6: When the user edits some text or certain text, if the line length changes, recalculate the line breaks for the pageblocks within the section and recalculate the starting positions of each section after the current section; the absolute coordinates of the text can then be recalculated based on the starting position of the line pageblock to achieve the editing effect that subsequent text flows down.

[0063] Finally, it should be noted that the above are only the preferred embodiments of the present invention and are not used to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.

Claims

1. A method for realizing streaming editing of an OFD format document, characterized in that: Specifically, it includes the following steps: Step S1: Read all textobject elements from the OFD page; Step S2: Since each character in OFD has an absolute position, which is given by the X, Y, DeltaX, and DeltaY attributes of TextCode; based on a floating-point number, a difference value is artificially set on the y-axis of TextCode, and the absolute coordinates X and Y of each character are calculated. If the difference between the Y coordinate of a character and the Y coordinate of the previous character is within the set difference value, it indicates that this character and the previous character are on the same line; Step S3: According to the difference value on the y-axis, those within this difference value range are determined to be on the same line, thus achieving line break of the text; for the textobject objects on the same line, they are enclosed by the standard pageblock element, and private line attribute identifiers are introduced to identify the starting position, ending position, and the id value of the textobject element within the line. Hereinafter, it is referred to as the line pageblock; Step S4: According to the starting position and ending position of the line pageblock, two difference values are set on the x-axis: namely, the left difference value and the right difference value; when the starting position of a line is less than the left difference value from the starting position of the previous line on the x-axis, it is determined that this line and the previous line are within the same paragraph. When the ending position of a line is greater than the right difference value from the ending position of the previous line, it is determined that this line is the last line of this paragraph; thus achieving paragraph break of the text; for the textobject objects in the same paragraph, they are enclosed by the standard pageblock element, and private paragraph attribute identifiers are introduced to identify the starting position, ending position, and the line pageblock within the paragraph. Hereinafter, it is referred to as the paragraph pageblock; Step S5: When the user edits a certain character or some characters, if the line height changes, calculate the increment of the line height change, and substitute all the subsequent line pageblocks and paragraph pageblocks into this increment to recalculate the starting positions of the lines and paragraphs; the absolute coordinates of the characters are recalculated according to the starting position of the line pageblock; to achieve the effect that the subsequent lines can flow down when the line height changes; Step S6: When the user edits a certain character or some characters, if the line length changes, recalculate the line break of the pageblocks within the paragraph, and recalculate the starting positions of each subsequent paragraph; the absolute coordinates of the characters are recalculated according to the starting position of the line pageblock, to achieve the editing effect that the subsequent characters flow down.

Citation Information

Patent Citations

  • method and device for converting a streaming file in a DOC / DOCX format into a format file in an OFD format

    CN109829139A

  • Method for converting UOT streaming document into OFD format document

    CN111881651A