Document processing method, electronic device and storage medium

By parsing, area dividing, element merging and format conversion of layout documents, the problem of poor display effects of layout documents in readers is solved, and the conversion of streaming documents is realized, which meets the user's adjustment needs and improves processing efficiency.

CN114118011BActive Publication Date: 2025-01-24ZHANGYUE TECH CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111394749.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-23
Publication Date
2025-01-24
Estimated Expiration
2041-11-23

AI Technical Summary

Technical Problem

In the prior art, when the layout document is displayed in the reader, the layout is fixed and unadjustable, resulting in poor display effect and low processing efficiency, which cannot meet the user's adjustment needs.

Method used

By analyzing the layout document, determine the unit element information of the target page, regional division and element merger of the target page according to the unit element information, obtain the text paragraph and/or pictures, and then use the information of these elements to change the format to obtain the current formula to obtain the flow type. document.

Benefits of technology

Convert the layout document from a fixed layout file to a flow file that supports adjustment, meeting the user's various adjustment needs, improving the efficiency of document processing, and providing the possibility for the conversion of annotation notes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114118011B_ABST
    Figure CN114118011B_ABST
Patent Text Reader

Abstract

The present invention relates to a document processing method, an electronic device and a storage medium. The document processing method includes: obtaining a layout document, the layout document includes at least one target page; parsing the layout document to determine the unit element information of the target page, the unit element information includes the element information of the unit element on the target page, and the unit element includes a text element and / or a picture; dividing the target page into regions according to the unit element information to obtain a plurality of unit regions, wherein the unit region includes a unit element; merging elements of each unit region in the target page to obtain text paragraphs and / or pictures; formatting the layout document according to the element information of the text paragraphs and / or pictures on the target page to obtain a streaming document. The present invention can convert a layout document from a layout file with a fixed layout to a streaming file that supports adjustment, which provides the possibility for the conversion of annotation notes and improves the efficiency of document processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of electronic books, and in particular to a document processing method, an electronic device and a storage medium. Background Art

[0002] With the rapid development of Internet technology, electronic documents are increasingly used and paid more attention to.

[0003] Layout documents, such as PDF documents, are commonly used in electronic documents because they do not rely on the language, font, display device, etc. of the operating system. At present, when displaying layout documents in readers, there is a defect that the display effect is poor because the layout is fixed and cannot be adjusted. In the related technology, it can be simply rearranged according to the screen type of the electronic device, but this method has low processing efficiency and cannot meet the user's adjustment needs. Summary of the invention

[0004] In order to solve the technical problem of low document processing efficiency in the related art, the present disclosure provides a document processing method, an electronic device and a storage medium to improve the efficiency of document processing.

[0005] In a first aspect, an embodiment of the present disclosure provides a document processing method, including:

[0006] Acquire a layout document, wherein the layout document includes at least one target page;

[0007] Parsing the layout document to determine unit element information of the target page, wherein the unit element information includes element information of the unit element on the target page, and the unit element includes a text element and / or a picture;

[0008] Divide the target page into regions according to the unit element information to obtain a plurality of unit regions, wherein the unit regions include a unit element;

[0009] Merging elements of each unit area in the target page to obtain text paragraphs and / or pictures;

[0010] According to the element information of the text paragraph and / or the picture on the target page, the format of the layout document is converted to obtain a streaming document.

[0011] In a second aspect, an embodiment of the present disclosure provides an electronic device, including:

[0012] processor;

[0013] A memory for storing executable instructions;

[0014] The processor is used to read the executable instructions from the memory and execute the executable instructions to perform the following operations:

[0015] Acquire a layout document, wherein the layout document includes at least one target page;

[0016] Parsing the layout document to determine unit element information of the target page, wherein the unit element information includes element information of the unit element on the target page, and the unit element includes a text element and / or a picture;

[0017] Divide the target page into regions according to the unit element information to obtain a plurality of unit regions, wherein the unit regions include a unit element;

[0018] Merging elements of each unit area in the target page to obtain text paragraphs and / or pictures;

[0019] According to the element information of the text paragraph and / or the picture on the target page, the format of the layout document is converted to obtain a streaming document.

[0020] In a third aspect, an embodiment of the present disclosure provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor implements the document processing method of the first aspect.

[0021] One of the above technical solutions has the following advantages or beneficial effects:

[0022] According to the document processing method, electronic device and storage medium of the embodiment of the present disclosure, it is possible to obtain a layout document, the layout document includes at least one target page, parse the layout document, determine the unit element information of the target page, the unit element information includes the element information of the unit element on the target page, and the unit element includes a text element and / or a picture; divide the target page into regions according to the unit element information to obtain multiple unit regions, wherein the unit region includes a unit element, then merge the elements of each unit region in the target page to obtain a text paragraph and / or a picture, and then convert the format of the layout document according to the element information of the text paragraph and / or the picture on the target page to obtain a streaming document. The embodiment of the present disclosure can convert the layout document from a layout file with a fixed layout to a streaming file that supports adjustment by parsing, dividing the regions, merging the elements and converting the formats of the layout document, thereby meeting the various adjustment requirements of users during subsequent display, and also providing the possibility for the conversion of annotation notes, and because the conversion process does not depend on the reader, the efficiency of document processing is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0024] Figure 1 A flowchart of a document processing method provided by an embodiment of the present disclosure;

[0025] Figure 2 A schematic diagram of a layout document provided by an embodiment of the present disclosure;

[0026] Figure 3 A schematic diagram of document parsing provided by an embodiment of the present disclosure;

[0027] Figure 4 A schematic diagram of element merging provided in an embodiment of the present disclosure;

[0028] Figure 5 A schematic diagram of a streaming document provided in an embodiment of the present disclosure;

[0029] Figure 6 A flowchart of another document processing method provided by an embodiment of the present disclosure;

[0030] Figure 7 A schematic diagram of a reader displaying a streaming document provided by an embodiment of the present disclosure;

[0031] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0032] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0033] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0034] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0035] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0036] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0037] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0038] In order to solve the technical problem of low efficiency in format document processing in the related art, an embodiment of the present disclosure provides a document processing method, which is introduced below in conjunction with a specific embodiment.

[0039] Figure 1 The present invention provides a flowchart of a document processing method provided by an embodiment of the present invention. The method can be executed by an online learning device, wherein the device can be implemented by software and / or hardware and can generally be integrated in an electronic device. Figure 1 As shown, the method includes:

[0040] Step 101: Obtain a layout document, where the layout document includes at least one target page.

[0041] The document processing method of the embodiment of the present disclosure can be applied to a reader, which can be any electronic device that can display an electronic document to a user so that the user can read the document, including an ink screen reader, etc.

[0042] Among them, the layout document can be a document with a fixed layout, that is, an electronic document with a fixed layout presentation effect. The presentation effect of the layout document is independent of the device. When reading, printing or printing on various devices, the presentation results of the layout are consistent. In the disclosed embodiment, the layout document may include at least one of a PDF document, an OFD document, an XPS document, a CEB document, etc., that is, the format of the above-mentioned layout document is only an example, and there may be other formats. The target page may be a page included in the layout document, and a layout document may include one or more target pages.

[0043] In the embodiment of the present disclosure, the layout document can be displayed in the reader, and then the user's trigger operation is detected. After receiving the user's rearrangement trigger operation on the layout document, the layout document can be obtained for subsequent operations. The rearrangement trigger operation may include a user's gesture control operation (such as click, long press, double click, etc.), voice control operation or expression control operation, etc., which is not limited in the embodiment of the present disclosure.

[0044] For example, Figure 2 A schematic diagram of a layout document provided by an embodiment of the present disclosure, such as Figure 2 As shown, the figure shows a page 200 in a layout document, and the page 200 is being displayed in the reader. The page 200 exemplarily shows the homepage of a paper, including the title, abstract, keywords, Chinese classification number, document identification code, header, footer, column text content and pictures, etc., and the page also shows an area 201 including several function buttons, such as the return button and three reorder buttons in the figure. The reorder button is used to trigger the reordering of the layout document, and the three reorder buttons are used to achieve the reordering of this page, this chapter and this book respectively. The user can achieve the reordering of the layout document by triggering any reorder button. It can be understood that the three reorder buttons in the figure are only examples, and only one reorder button can be shown, which can be set according to actual conditions.

[0045] Step 102: parse the layout document to determine unit element information of the target page, where the unit element information includes element information of the unit element on the target page, and the unit element includes text elements and / or images.

[0046] Among them, the unit element information can be understood as the element information of each unit element in the layout document on the target page where it is located. The unit element can be a general term for the smallest unit in the document, and can include at least one of a text element, a picture, a figure mark, etc. The element information can be the specific attribute information of the unit element, and can include size information and position information, etc. For example, the element information of the text element can include color in addition to font style, font size, and position. In the embodiment of the present disclosure, the text element can be a text line, that is, a text line is a unit element.

[0047] In the embodiment of the present disclosure, after the document processing device acquires the layout document, it can use a preset parsing program or algorithm to parse and detect and identify the layout document, and can determine the size information and position information of the unit elements included in each target page.

[0048] For example, Figure 3 A schematic diagram of document parsing provided by an embodiment of the present disclosure, such as Figure 3 As shown in the figure, a page 300 in the process of parsing a layout document is shown. Figure 2 Compared with page 200 in the figure, after parsing page 200, page 300 can be presented, in which each unit element is selected by a dotted frame, that is, each text line and picture is selected by a frame, indicating that its size information and position information are detected.

[0049] Step 103: divide the target page into regions according to the unit element information to obtain a plurality of unit regions, wherein each unit region includes a unit element.

[0050] The unit area may be a general term for each small area after the target page is divided, and each unit area includes only one unit element, that is, the unit area includes only text elements or pictures.

[0051] In an embodiment of the present disclosure, the position information of a text element may include the line spacing and / or column spacing of a text line; dividing a target page into regions according to the unit element information to obtain a plurality of unit regions may include: determining the target page as a to-be-processed region, and determining the maximum line spacing and / or maximum column spacing in the to-be-processed region according to the line spacing and / or column spacing of the text lines; dividing the to-be-processed region according to the maximum line spacing and / or maximum column spacing to obtain at least two sub-regions; re-determining each sub-region as a to-be-processed region, and performing secondary region division until each sub-region obtained by the division meets a preset condition, and determining each sub-region as a unit region.

[0052] The line spacing of the above text lines can be the vertical distance between adjacent text lines, that is, the vertical distance between the bottom boundary of the upper text line and the top boundary of the lower text line, and the column spacing of the text lines can be the left-right distance between two adjacent text lines, that is, the right boundary of the left text line and the left boundary of the right text line. The area to be processed can be the area to be divided.

[0053] Specifically, when the document processing device divides the target page into regions, it can first use the entire region of the target page as the region to be processed, and then compare the line spacing and / or column spacing of the text lines to determine the maximum line spacing and / or the maximum column spacing; then the region to be processed can be divided into two upper and lower sub-regions according to the maximum line spacing, and / or the region to be processed can be divided into two left and right sub-regions according to the maximum line spacing, and then at least two sub-regions are obtained; then each sub-region is re-determined as the region to be processed, and the region division is continued until each sub-region meets the preset conditions, and the sub-region finally obtained is determined as the unit region.

[0054] Exemplarily, the maximum row spacing can be determined on the target page and the page is divided into two sub-areas, upper and lower. Because the lower column part overlaps with the upper part, there is no maximum column spacing at the beginning. Then, the maximum row spacing and / or the maximum column spacing are continued to be found in the upper and lower sub-areas for area division, and the sub-area with the maximum column spacing is gradually found. At this time, the sub-area can be divided into two left and right sub-areas according to the maximum column spacing, and then the area division is continued based on the maximum row spacing and / or the maximum column spacing in the left and right sub-areas until each sub-area meets the preset conditions, and the final sub-area is determined as the unit area.

[0055] Optionally, the sub-area satisfies the preset conditions, which may include: when the sub-area includes only a single text line, a single picture, or multiple continuous text lines with the same preset element information and a first line indent, it is determined that the sub-area satisfies the preset conditions, and the preset element information includes at least one of font style, font size, text line height, text line width, and text line spacing.

[0056] The preset condition may be that the sub-area cannot be further divided according to the maximum row spacing or the maximum column spacing. The preset element information may include but is not limited to font style, font size, text line height, text line width, and text line spacing, which may be set according to actual conditions.

[0057] Specifically, when it is determined that a sub-region includes only a single text line, or a single image or multiple continuous text lines with a first line indent and the same preset element information, it can be determined that the sub-region meets the preset condition, and then it can be determined whether each sub-region meets the preset condition. For example, when the preset element information is font style and font size, if a sub-region includes multiple continuous text lines, and the continuous text lines are set with a first line indent, and the font style of each character in the sub-region is Songti and the font size is size 4, then the sub-region meets the preset condition.

[0058] Step 104: merge elements of each unit area in the target page to obtain text paragraphs and / or pictures.

[0059] The text paragraph may include one text element, or may be a combination of multiple text elements.

[0060] In the disclosed embodiment, after the document processing device divides the target page into regions according to the unit element information and obtains a plurality of unit regions, it can merge the elements of each unit region, that is, the unit elements in each unit region are framed together as a whole to obtain a text paragraph and / or a picture. Since the first line indent, font style, and font size of the paragraph are fully considered when the unit region is obtained by region division, the merged unit region elements are more in line with the user's document display habits, thereby improving the subsequent display effect.

[0061] In one embodiment, after merging elements of each unit area in the target page to obtain text paragraphs and / or pictures, the document processing method may also include: returning the text paragraphs and / or pictures and performing parsing, area division and element merging again.

[0062] Specifically, since the upper and lower spacing and left and right spacing of the paragraph may change after the elements are merged, the document processing device of the embodiment of the present disclosure returns to execute steps 102-103 for the text paragraph and / or picture after obtaining the text paragraph and / or picture, and performs parsing, area division and element merging again to obtain the final text paragraph and / or picture. Since the processing accuracy is improved, the accuracy of typesetting is ensured.

[0063] For example, Figure 4 A schematic diagram of an element merging provided in an embodiment of the present disclosure, such as Figure 4 As shown in the figure, a page 400 after the layout document area division and element merging is shown. Figure 3Compared with page 300 in the figure, page 400 can be presented after page 300 is divided into areas and elements are merged. The unit elements in each unit area of ​​page 400 have been merged together. For example, the two text lines of the abstract in the figure are merged together as a unit area. The merger is represented by an overall dotted box in the figure, and multiple consecutive text lines with first line indentation are also merged together.

[0064] Step 105: According to the element information of the text paragraphs and / or pictures on the target page, the format of the layout document is converted to obtain a streaming document.

[0065] Among them, the streaming document can be a document with a non-fixed structure, that is, the streaming document supports free adjustment, and its content is calculated and drawn in a streaming manner, and the content is described in a certain hierarchical structure, forming the format of the streaming document; and the display effect of the streaming document will change in different software and hardware environments. In the embodiment of the present disclosure, the streaming document can include an HTML document, which is of course only an example, and can also be a document of other formats.

[0066] Specifically, after the document processing device merges the elements of each unit area in the target page to obtain text paragraphs and / or pictures, the element information of the text paragraphs and / or pictures on the target page can be obtained. The element information may include size information and position information. According to the element information of the text paragraphs and / or pictures on the target page, a format conversion program or algorithm is used to convert the format of the layout document, and the typeset text paragraphs and / or pictures are generated into a streaming document.

[0067] Optionally, for text paragraphs and / or pictures that are typeset in rows in a layout document, the corresponding format in the flow document is a row format or a paragraph format; for text paragraphs and / or pictures that are typeset in columns in a layout document, the corresponding format in the flow document is a table format.

[0068] When all or some of the text paragraphs and / or images in a layout document are arranged in rows, the corresponding format in the flow document is the row format or paragraph format; when all or some of the text paragraphs and / or images in a layout document are arranged in columns, the corresponding format in the flow document is the table format.

[0069] When the flow document is an HTML document, a single line format can be represented as div. Div can be a standard block element that occupies a line alone, which means that its content automatically starts a new line. The document can be divided into independent and different parts, and partitions or sections in the document can be defined. The paragraph format can be represented as p. The p tag is used to define a paragraph, and some blanks can be automatically created before and after it. The table format can be represented as table, which is used to define a table.

[0070] In the above scheme, the content in the flow document can be output in structures of different formats according to different typeset modes in the layout document. The above is only an example.

[0071] For example, Figure 5 A schematic diagram of a streaming document provided by an embodiment of the present disclosure, such as Figure 5 As shown in the figure, a page 500 of a streaming document is shown, and the page 500 is an HTML document and is displayed in a web browser. Figure 2 In page 200 and page 500, the positions and sizes of some texts and / or pictures are changed, for example, the title, abstract, and keywords are adjusted from being displayed in the center to being displayed in the left alignment.

[0072] According to the document processing method of the embodiment of the present disclosure, it is possible to obtain a layout document, the layout document includes at least one target page, parse the layout document, determine the unit element information of the target page, the unit element information includes the element information of the unit element on the target page, and the unit element includes a text element and / or a picture; divide the target page into regions according to the unit element information to obtain a plurality of unit regions, wherein the unit region includes a unit element, then merge the elements of each unit region in the target page to obtain a text paragraph and / or a picture, and then convert the format of the layout document according to the element information of the text paragraph and / or the picture on the target page to obtain a streaming document. The embodiment of the present disclosure can convert the layout document from a layout file with a fixed layout to a streaming file that supports adjustment by parsing, dividing the regions, merging the elements, and converting the formats of the layout document, thereby being able to meet the user's various adjustment requirements during subsequent display, and also providing the possibility for the conversion of annotation notes, and because the conversion process does not depend on the reader, the efficiency of document processing is improved.

[0073] For example, Figure 6 A flowchart of another document processing method provided by an embodiment of the present disclosure is shown as follows: Figure 6 As shown, in a feasible implementation manner, after converting the format of the layout document according to the element information of the text paragraph and / or the picture on the target page to obtain the streaming document, the document processing method may further include the following steps:

[0074] Step 601: Display the streaming document in the reader.

[0075] The reader may be any electronic device that can display an electronic document to a user so that the user can read the document. The embodiments of the present disclosure are not limited to a specific reader.

[0076] Specifically, after the document processing device converts the format of the layout document according to the element information of the text paragraphs and / or pictures on the target page and obtains the streaming document, the streaming document can be displayed on the display screen of the reader. When displaying, the structural layout of each element in the streaming document can be adjusted according to the parameters such as the size and resolution of the display screen of the reader, so that the streaming document can achieve a better display effect in the reader. For example, for the left and right parts of the content arranged in columns, if the font size is reduced and the left part of the content does not occupy the full area, the right part of the content can splice the text lines upwards so that there is no blank area on the screen, achieving a better display effect.

[0077] For example, Figure 7 A schematic diagram of a reader displaying a streaming document provided by an embodiment of the present disclosure, such as Figure 7 As shown in the figure, a page 700 of a streaming document is shown, and the page 700 is displayed in a reader. Figure 5 In page 500, the position and size of some text and / or pictures in page 500 are adjusted based on different hardware environments and / or software environments. For example, the font style of the entire page is adjusted to the same font style to achieve a better display effect in the reader.

[0078] In some embodiments, the position information of the image includes the position of the image in the target page, and the size information of the image includes the percentage of the image in the target page and the aspect ratio of the image; displaying the streaming document in the reader may include: for the image in the streaming document, determining the height and width of the image in the reader according to the screen size of the reader and the size information of the image; scaling the image according to the height and width of the image in the reader, and then displaying it in the reader based on the position of the image in the target page.

[0079] The percentage of the above-mentioned picture in the target page may include the first percentage of the width of the picture in the width of the target page and / or the second percentage of the height of the picture in the height of the target page. Alternatively, the percentage of the picture in the target page may also include the third percentage of the width of the picture in the width of the target text paragraph, and the target text paragraph is a text paragraph adjacent to the picture above and below, and may be a text paragraph adjacent to the top of the picture or a text paragraph adjacent to the bottom of the picture. The aspect ratio is the ratio of width to height. Since the aspect ratio of the picture is fixed, the other value can be determined based on one of the width and height.

[0080] Since the images in the streaming document may exceed the resolution of the display screen when displayed directly in the reader, in the embodiments of the present disclosure, for the images in the streaming document, the height and width of the images in the reader can be determined based on the screen size of the reader, the height and width of the images in the target page, the percentage of the images in the target page, and the aspect ratio of the images.

[0081] For example, the screen size of the reader is 600*600, and the width and height are both 600. Assuming that the first percentage is 50% and the second percentage is 30%, the width of the picture in the reader is 600*50%=300, and the height of the picture in the reader is 600*30%=180; or assuming that the third percentage is 20% and the aspect ratio of the picture is 2:1, the width of the picture in the reader is 600*20%=120, and the height of the picture in the reader is 120 / 2=60.

[0082] After determining the height and width of the image in the reader, the document processing device can scale the image from its original size to the height and width in the reader, and display the image in the reader according to the position of the image in the target page.

[0083] In the above solution, when displaying images in a streaming document in a reader, the images can be scaled according to the percentage of the images in the layout document before display, thereby avoiding defects such as incomplete or unclear image display. At the same time, the style display relationship with the original text is maintained as much as possible, thereby improving the display effect of the streaming document.

[0084] Optionally, the image location information also includes a rotation angle of the image in the target page.

[0085] The rotation angle may be the angle at which the image is rotated with respect to the target page as a reference. For example, when the image is a rectangular image, the angle between the central axis of the rectangular image and the central axis of the target page is the rotation angle.

[0086] In the disclosed embodiment, during the parsing of the layout document, the rotation angle of the image on the target page can also be parsed, so that after the subsequent conversion to obtain the streaming document, the image in the streaming document is displayed in the reader according to the rotation angle. This ensures that the display effect of the image in the layout document and the streaming document is the same, avoids the problem of image inversion due to rearrangement, and further improves the display effect of the streaming document.

[0087] Step 602: Receive a zoom-out operation and / or a zoom-in operation on the streaming document from the user.

[0088] Among them, the zoom-in operation and the zoom-in operation are both trigger operations of the user on the streaming document, and can be two trigger operations with opposite functions. The specific operations are not limited. For example, the zoom-out operation can be a two-finger inward sliding operation, and the zoom-in operation can be a two-finger outward sliding operation. These are just examples.

[0089] After the streaming document is displayed in the reader, the document processing device may detect a trigger operation of the user, and then receive a zoom-out operation and / or a zoom-in operation on the streaming document.

[0090] Step 603: When the streaming document includes text paragraphs and / or pictures arranged in columns, the display effects of the text paragraphs and / or pictures arranged in columns are dynamically adjusted according to the reduction factor of the reduction operation and / or the magnification factor of the magnification operation.

[0091] Among them, column layout can be understood as an area divided into two parts on the left and right by the maximum column spacing of the text line. The size of the area is not limited, and the area can include text paragraphs and / or pictures. The above-mentioned reduction factor and magnification factor can be determined by the operation range of the reduction operation and the magnification operation. After the display effect is adjusted, the location or page of some text and / or pictures in the text paragraphs and / or pictures arranged in columns changes.

[0092] Specifically, after receiving the user's zoom-in operation and / or zoom-in operation on the streaming document, the document processing device may first determine the zoom-out ratio corresponding to the zoom-in operation and / or the zoom-in ratio corresponding to the zoom-in operation, and then adjust the position or page of some text and / or pictures when they are displayed according to the above zoom-out ratio and / or zoom-in ratio, so as to achieve the dynamic adjustment of the display effect of the text paragraphs and / or pictures arranged in columns in the streaming document, that is. For example, assuming that the user's zoom-in operation is received, the zoom-in ratio is greater than a preset value, and the preset value may be the maximum ratio that can be displayed in column layout, that is, when the zoom-in ratio is greater than the preset value, the content arranged in columns in the streaming document can no longer be displayed in columns, and at this time, the text and / or pictures of the streaming document can be displayed one by one in order.

[0093] In the above scheme, after converting the layout document from a fixed-layout layout file to a streaming file that supports adjustment, it can not only be displayed flexibly in the reader, but also the display layout of the content in the streaming document can be adjusted according to the screen parameters of the reader and the user's adjustment operations, thereby achieving a better display effect. On the basis of meeting the user's needs for free adjustment, the user's reading experience is further improved.

[0094] In some embodiments, the document processing method may further include: in the process of converting the format of the layout document, recording the offset of each word in the layout document in the source file of the streaming document.

[0095] The offset of the text in the source file of the streaming document can be used to locate the text. The offset is the offset relative to the first character of the text line. The character is the text, which can be Chinese characters and / or English characters.

[0096] After a layout document is converted into a streaming document, the position of the document content when displayed may change as needed, and the coordinate system becomes invalid at this time. However, the offset of the character in the source file of the streaming document is relatively unchanged, and the embodiment of the present disclosure can locate the text by the offset. In the embodiment of the present disclosure, during the format conversion of the layout document, the offset of each character in the layout document in the source file of the streaming document can be recorded. Optionally, the document processing device can store the mapping relationship between the text and its offset in the source file of the streaming document as a mapping table for subsequent use.

[0097] In some embodiments, the unit element also includes a first annotation mark, and the element information of the first annotation mark includes the starting text and the ending text corresponding to the first annotation mark; the document processing method may also include: drawing the first annotation mark in the streaming document according to the offset of each text in the layout document in the source file of the streaming document, and the starting text and the ending text corresponding to the first annotation mark.

[0098] The first annotation mark may be an annotation mark added by the user to the layout document, and the first annotation mark may be a unit element when parsing the layout document. After parsing, the coordinates of the text at the starting position and the coordinates of the text at the ending position of the first annotation mark may be obtained, and then the starting text and the ending text may be recorded. The embodiments of the present disclosure are not limited to specific annotation marks, for example, the annotation mark includes at least one of an underline, a polygonal box, a highlight, etc.

[0099] Specifically, if there is a first annotation mark in the layout document, when the streaming document is displayed in the reader, the document processing device can determine the offsets of the starting text and the ending text corresponding to the first annotation mark based on the offsets of each text in the source file of the streaming document recorded in advance, and then redraw the first annotation mark in the streaming document based on the offsets of the starting text and the ending text and display it to the user.

[0100] In some embodiments, the document processing method may also include: receiving a second annotation mark added to the streaming document; obtaining a starting offset and an ending offset corresponding to the second annotation mark; receiving a reflow return trigger operation for the streaming document, and displaying the layout document in a reader; and drawing the second annotation mark in the layout document according to the offset of each word in the layout document in the source file of the streaming document, and the starting offset and the ending offset corresponding to the second annotation mark.

[0101] The second annotation mark may be an annotation mark added by the user to the streaming document, and the second annotation mark may be the same as or different from the first annotation mark, without limitation. The rearrangement return trigger operation may be a trigger operation for returning to the display layout document after displaying the streaming document, and may include a gesture trigger operation, a sound trigger operation, etc., without limitation.

[0102] Specifically, after displaying the streaming document in the reader, the second annotation mark added by the user in the streaming document can be received, and the starting offset and the ending offset corresponding to the second annotation mark can be determined; after receiving the user's rearrangement return trigger operation for the streaming document, the previous layout document can be obtained and displayed in the reader, and the specific displayed page corresponds to the current page of the streaming document; then, based on the offset of each text recorded in advance in the source file of the streaming document, the starting text corresponding to the starting offset of the second annotation mark and the ending text corresponding to the ending offset are determined, and then the second annotation mark can be redrawn in the layout document according to the starting text and the ending text of the second annotation mark and displayed to the user.

[0103] For example, when the layout document is a PDF document and the streaming document is an HTML document, and underline marks are made under the text in the PDF document, how to map it to the HTML document for display, the specific process may include: in the PDF document, the user can select several consecutive words by long pressing, and then click the underline button, the underline will be fixed and displayed on the page, and the coordinate position index of the text corresponding to the starting position and the end position of the underline will be recorded. When the PDF document is rearranged, that is, when the document is converted from PDF format to web page, that is, HTML format, the offset of each word in the PDF document in the web page source file can be recorded, and a mapping table can be generated.

[0104] If the characters corresponding to the underline in the PDF document are "w1w2w3w4w5w6", a total of six characters, of course, the characters can be English characters or Chinese characters, after converting to a web page, that is, an HTML document, the corresponding source code of this part can be " w1w2w3w4w5w6... ", in UTF-8 encoding, because Each occupies one byte. If w1 is an English character, it occupies one byte. If it is a Chinese character, it occupies three bytes. Assuming w1 is a Chinese character, the first character The offset of w1 is 0, the offset of w1 is 3 bytes, the offset of w2 is 6 bytes, and so on. Through the previously generated mapping table, in one case, the underline can be redrawn in the HTML document according to the offset; in another case, after returning the PDF document from the HTML document, the underline is presented at the corresponding position in the PDF document.

[0105] For example, see Figure 2 and Figure 7 , Figure 2 A first annotation mark 202 is shown in page 200 of the layout document in FIG. 1 , which is an underline under the text "ABCD", and Figure 7 A corresponding comment mark 701, ie, an underline under the same text "ABCD", may be drawn in the page 700 of the flow document.

[0106] In the above scheme, by recording the offset of each word in the source file of the streaming document during the conversion of the layout document into the streaming document, the comment marks in the layout document can be adaptively displayed in the streaming document and the comment marks in the streaming document can also be displayed in the layout document, thereby realizing the mutual mapping of the comment marks before and after the layout rearrangement, further providing the interactivity and accuracy of the document display, thereby improving the user's reading experience.

[0107] The disclosed embodiment also provides an electronic device, which may include a processor and a memory, and the memory may be used to store executable instructions. The processor may be used to read the executable instructions from the memory, and execute the executable instructions to perform the following operations: obtain a layout document, the layout document includes at least one target page; parse the layout document to determine the unit element information of the target page, the unit element information includes element information of the unit element on the target page, and the unit element includes text elements and / or pictures; divide the target page into regions according to the unit element information to obtain multiple unit regions, wherein the unit region includes a unit element; merge the elements of each unit region in the target page to obtain text paragraphs and / or pictures; convert the format of the layout document according to the element information of the text paragraphs and / or pictures on the target page to obtain a streaming document.

[0108] Figure 8 The electronic device 800 in the embodiment of the present disclosure may be the electronic device described above. It should also be noted that: Figure 8 The electronic device 800 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0109] The electronic device 800 conventionally includes a processor 810 and a computer program product or computer-readable medium in the form of a memory 820. The memory 820 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk or a ROM. The memory 820 has a storage space 821 for executable instructions (or program codes) 8211 for executing any method steps in the above-mentioned document processing method. For example, the storage space 821 for executable instructions may include individual executable instructions 8211 for respectively implementing various steps in the above-mentioned document processing method. These executable instructions may be read from or written to one or more computer program products. These computer program products include program code carriers such as a hard disk, a compact disk (CD), a memory card or a floppy disk. Such a computer program product is typically a portable or fixed storage unit. The storage unit may have a storage device 8211 having a storage device 8212 configured to store and store executable instructions. Figure 8 The memory unit may be a memory segment or a memory space arranged similarly to the memory 820 in the electronic device. The executable instructions may be compressed, for example, in an appropriate form. Generally, the storage unit includes executable instructions for executing the steps of the document processing method according to the present invention, that is, codes that can be read by a processor such as the processor 810, and when these codes are executed by the electronic device, the electronic device executes the various steps in the document processing method described above.

[0110] An embodiment of the present invention further provides a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the document processing method provided by each embodiment of the present invention.

[0111] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0112] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0113] In embodiments of the present invention, computer program code for performing the operations of the present invention may be written in one or more programming languages ​​or combinations thereof, including but not limited to object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as a separate software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0114] The various component embodiments of the present invention may be implemented in hardware in all or part of the steps, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in the online learning device according to an embodiment of the present invention. The present invention may also be implemented as a device or device program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0115] a1. According to one or more embodiments of the present disclosure, the present disclosure provides a document processing method, including:

[0116] Acquire a layout document, wherein the layout document includes at least one target page;

[0117] Parsing the layout document to determine unit element information of the target page, wherein the unit element information includes element information of the unit element on the target page, and the unit element includes a text element and / or a picture;

[0118] Divide the target page into regions according to the unit element information to obtain a plurality of unit regions, wherein the unit regions include a unit element;

[0119] Merging elements of each unit area in the target page to obtain text paragraphs and / or pictures;

[0120] According to the element information of the text paragraph and / or the picture on the target page, the format of the layout document is converted to obtain a streaming document.

[0121] a2. The method according to a1, wherein the element information includes size information and position information, the text element is a text line, and the position information of the text element includes the line spacing and / or column spacing of the text line.

[0122] a3. The method according to a2, wherein the target page is divided into regions according to the unit element information to obtain a plurality of unit regions, including:

[0123] Determine the target page as the area to be processed, and determine the maximum line spacing and / or maximum column spacing in the area to be processed according to the line spacing and / or column spacing of the text lines;

[0124] Dividing the area to be processed according to the maximum row spacing and / or the maximum column spacing to obtain at least two sub-areas;

[0125] Each of the sub-regions is re-determined as the area to be processed, and secondary area division is performed until each of the sub-regions obtained by division meets a preset condition, and each of the sub-regions is determined as a unit area.

[0126] a4. The method according to a3, wherein the sub-area satisfies a preset condition, including:

[0127] When the sub-area includes only a single text line, a single picture, or multiple continuous text lines with the same preset element information and a first line indent, it is determined that the sub-area meets the preset conditions, and the preset element information includes at least one of font style, font size, text line height, text line width, and text line spacing.

[0128] a5. The method according to a1, wherein, after merging the elements of each unit area in the target page to obtain text paragraphs and / or pictures, the method further comprises:

[0129] Parsing, region division and element merging are performed again on the text paragraph and / or picture return.

[0130] a6. The method according to a1, wherein:

[0131] For the text paragraphs and / or pictures that are typeset in lines in the layout document, the corresponding format in the flow document is a line format or a paragraph format;

[0132] For the text paragraphs and / or pictures that are arranged in columns in the layout document, their format in the flow document is a table format.

[0133] a7. The method according to a1, wherein, according to the element information of the text paragraph and / or the picture on the target page, after the format of the layout document is converted to obtain a streaming document, the method further comprises:

[0134] The streaming document is displayed in a reader.

[0135] a8. The method according to a7, wherein the position information of the picture includes the position of the picture in the target page, and the size information of the picture includes the percentage of the picture in the target page and the aspect ratio of the picture;

[0136] The step of displaying the streaming document in a reader includes:

[0137] For the picture in the streaming document, determine the height and width of the picture in the reader according to the screen size of the reader and the size information of the picture;

[0138] The image is scaled according to the height and width of the image in the reader and then displayed in the reader based on the position of the image in the target page.

[0139] a9. The method according to a7, wherein the location information of the image also includes a rotation angle of the image in the target page.

[0140] a10. The method according to a7, wherein after displaying the streaming document in the reader, the method further comprises:

[0141] receiving a zoom-out operation and / or a zoom-in operation of the streaming document from a user;

[0142] When the streaming document includes text paragraphs and / or pictures arranged in columns, the display effect of the text paragraphs and / or pictures arranged in columns is dynamically adjusted according to the reduction factor of the reduction operation and / or the magnification factor of the magnification operation.

[0143] a11. The method according to a10, wherein after the display effect is adjusted, the position or page of part of the text and / or pictures in the column-layout text paragraph and / or picture changes.

[0144] a12. The method according to a1, wherein the method further comprises:

[0145] In the process of converting the format of the layout document, the offset of each character in the layout document in the source file of the stream document is recorded.

[0146] a13. The method according to a12, wherein the unit element further includes a first annotation mark, and the element information of the first annotation mark includes a start character and an end character corresponding to the first annotation mark;

[0147] The method further comprises:

[0148] The first annotation mark is drawn in the flow document according to the offset of each character in the layout document in the source file of the flow document and the start character and the end character corresponding to the first annotation mark.

[0149] a14. The method according to a12, wherein the method further comprises:

[0150] receiving a second annotation mark added to the streaming document;

[0151] Obtaining the starting offset and the ending offset corresponding to the second annotation mark;

[0152] receiving a re-arrangement return trigger operation for the streaming document, and displaying the layout document in the reader;

[0153] The second annotation mark is drawn in the layout document according to the offset of each character in the layout document in the source file of the flow document and the start offset and the end offset corresponding to the second annotation mark.

[0154] a15. The method according to a13 or 14, wherein the annotation mark includes at least one of an underline, a polygonal box, and a highlight.

[0155] a16. The method according to a1, wherein the layout document is a document with a fixed layout, and the flow document is a document with a non-fixed structure.

[0156] a17. The method according to a1, wherein the layout document includes at least one of a PDF document, an OFD document, an XPS document, and a CEB document, and the streaming document includes an HTML document.

[0157] a18. According to one or more embodiments of the present disclosure, the present disclosure provides an electronic device, including:

[0158] processor;

[0159] a memory for storing processor-executable instructions;

[0160] A processor that reads executable instructions from memory and executes the instructions to:

[0161] Acquire a layout document, wherein the layout document includes at least one target page;

[0162] Parsing the layout document to determine unit element information of the target page, wherein the unit element information includes element information of the unit element on the target page, and the unit element includes a text element and / or a picture;

[0163] Divide the target page into regions according to the unit element information to obtain a plurality of unit regions, wherein the unit regions include a unit element;

[0164] Merging elements of each unit area in the target page to obtain text paragraphs and / or pictures;

[0165] According to the element information of the text paragraph and / or the picture on the target page, the format of the layout document is converted to obtain a streaming document.

[0166] a19. An electronic device according to a18, wherein the element information includes size information and position information, the text element is a text line, and the position information of the text element includes a line spacing and / or a column spacing of the text line.

[0167] a20. The electronic device according to a19, wherein the executable instructions further cause the processor to perform the following operations:

[0168] The target page is divided into regions according to the unit element information to obtain a plurality of unit regions, including:

[0169] Determine the target page as the area to be processed, and determine the maximum line spacing and / or maximum column spacing in the area to be processed according to the line spacing and / or column spacing of the text lines;

[0170] Dividing the area to be processed according to the maximum row spacing and / or the maximum column spacing to obtain at least two sub-areas;

[0171] Each of the sub-regions is re-determined as the area to be processed, and secondary area division is performed until each of the sub-regions obtained by division meets a preset condition, and each of the sub-regions is determined as a unit area.

[0172] a21. The electronic device according to a20, wherein the executable instruction further causes the processor to perform the following operations:

[0173] The sub-area meets the preset conditions, including:

[0174] When the sub-area includes only a single text line, a single picture, or multiple continuous text lines with the same preset element information and a first line indent, it is determined that the sub-area meets the preset conditions, and the preset element information includes at least one of font style, font size, text line height, text line width, and text line spacing.

[0175] a22. The electronic device according to a18, wherein after merging the elements of each unit area in the target page to obtain a text paragraph and / or a picture, the executable instruction further causes the processor to perform the following operations:

[0176] Parsing, region division and element merging are performed again on the text paragraph and / or picture return.

[0177] a23. The electronic device according to a18, wherein:

[0178] For the text paragraphs and / or pictures that are typeset in lines in the layout document, the corresponding format in the flow document is a line format or a paragraph format;

[0179] For the text paragraphs and / or pictures that are arranged in columns in the layout document, their format in the flow document is a table format.

[0180] a24. The electronic device according to a18, wherein, after the format of the layout document is converted according to the element information of the text paragraph and / or the picture on the target page to obtain a streaming document, the executable instructions further cause the processor to perform the following operations:

[0181] The streaming document is displayed in a reader.

[0182] a25. The electronic device according to a24, wherein the position information of the picture includes the position of the picture in the target page, and the size information of the picture includes the percentage of the picture in the target page and the aspect ratio of the picture;

[0183] The executable instructions further cause the processor to perform the following operations:

[0184] The step of displaying the streaming document in a reader includes:

[0185] For the picture in the streaming document, determine the height and width of the picture in the reader according to the screen size of the reader and the size information of the picture;

[0186] The image is scaled according to the height and width of the image in the reader and then displayed in the reader based on the position of the image in the target page.

[0187] a26. An electronic device according to a24, wherein the location information of the image also includes a rotation angle of the image in the target page.

[0188] a27. The electronic device according to a24, wherein after displaying the streaming document in the reader, the executable instructions further cause the processor to perform the following operations:

[0189] receiving a zoom-out operation and / or a zoom-in operation of the streaming document from a user;

[0190] When the streaming document includes text paragraphs and / or pictures arranged in columns, the display effect of the text paragraphs and / or pictures arranged in columns is dynamically adjusted according to the reduction factor of the reduction operation and / or the magnification factor of the magnification operation.

[0191] a28. An electronic device according to a27, wherein after the display effect is adjusted, the position or page of part of the text and / or pictures in the column-layout text paragraph and / or picture changes.

[0192] a29. The electronic device according to a18, wherein the executable instructions further cause the processor to perform the following operations:

[0193] In the process of converting the format of the layout document, the offset of each character in the layout document in the source file of the stream document is recorded.

[0194] a30. The electronic device according to a29, wherein the unit element further includes a first annotation mark, and the element information of the first annotation mark includes a start character and an end character corresponding to the first annotation mark;

[0195] The executable instructions further cause the processor to perform the following operations:

[0196] The first annotation mark is drawn in the flow document according to the offset of each character in the layout document in the source file of the flow document and the start character and the end character corresponding to the first annotation mark.

[0197] a31. The electronic device according to a29, wherein the executable instructions further cause the processor to perform the following operations:

[0198] receiving a second annotation mark added to the streaming document;

[0199] Obtaining the starting offset and the ending offset corresponding to the second annotation mark;

[0200] receiving a re-arrangement return trigger operation for the streaming document, and displaying the layout document in the reader;

[0201] The second annotation mark is drawn in the layout document according to the offset of each character in the layout document in the source file of the flow document and the start offset and the end offset corresponding to the second annotation mark.

[0202] a32. An electronic device according to a30 or 31, wherein the annotation mark includes at least one of an underline, a polygonal box, and a highlight.

[0203] a33. An electronic device according to a18, wherein the layout document is a document with a fixed layout, and the flow document is a document with a non-fixed structure.

[0204] a33. An electronic device according to a18, wherein the layout document includes at least one of a PDF document, an OFD document, an XPS document, and a CEB document, and the streaming document includes an HTML document.

[0205] According to one or more embodiments of the present disclosure, the present disclosure provides a computer-readable storage medium, the storage medium stores a computer program, and the computer program is used to execute any document processing method provided by the present disclosure.

[0206] The above description is only a preferred embodiment of the present invention and an explanation of the technical principles used. Those skilled in the art should understand that the disclosure scope involved in the present invention is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present invention (but not limited to) to form a technical solution.

[0207] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present invention. Certain features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination. Although the subject matter has been described in a language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms for implementing the claims.

Claims

1. A document processing method, characterized in that: include: Acquire a layout document, wherein the layout document includes at least one target page; Parsing the layout document to determine unit element information of the target page, wherein the unit element information includes element information of the unit element on the target page, and the unit element includes a text element and / or a picture; Divide the target page into regions according to the unit element information to obtain a plurality of unit regions, wherein the unit regions include a unit element; Merging elements of each unit area in the target page to obtain text paragraphs and / or pictures; According to the element information of the text paragraph and / or the picture on the target page, the format of the layout document is converted to obtain a streaming document; The unit element further includes a first annotation mark, and the element information of the first annotation mark includes a start character and an end character corresponding to the first annotation mark; The method further comprises: The first annotation mark is drawn in the flow document according to the offset of each character in the layout document in the source file of the flow document and the start character and the end character corresponding to the first annotation mark.

2. The method according to claim 1, characterized in that The element information includes size information and position information. The text element is a text line. The position information of the text element includes the line spacing and / or column spacing of the text line.

3. The method according to claim 2, characterized in that The target page is divided into regions according to the unit element information to obtain a plurality of unit regions, including: Determine the target page as the area to be processed, and determine the maximum line spacing and / or maximum column spacing in the area to be processed according to the line spacing and / or column spacing of the text lines; Dividing the area to be processed according to the maximum row spacing and / or the maximum column spacing to obtain at least two sub-areas; Each of the sub-regions is re-determined as the area to be processed, and secondary area division is performed until each of the sub-regions obtained by division meets a preset condition, and each of the sub-regions is determined as a unit area.

4. The method according to claim 3, characterized in that The sub-area meets the preset conditions, including: When the sub-area includes only a single text line, a single picture, or multiple continuous text lines with the same preset element information and a first line indent, it is determined that the sub-area meets the preset conditions, and the preset element information includes at least one of font style, font size, text line height, text line width, and text line spacing.

5. The method according to claim 1, characterized in that After merging the elements of each unit area in the target page to obtain text paragraphs and / or pictures, the method further includes: Parsing, region division and element merging are performed again on the text paragraph and / or picture return.

6. The method according to claim 1, characterized in that For the text paragraphs and / or pictures that are typeset in lines in the layout document, the corresponding format in the flow document is a line format or a paragraph format; For the text paragraphs and / or pictures that are arranged in columns in the layout document, their format in the flow document is a table format.

7. The method according to claim 1, characterized in that After converting the format of the layout document according to the element information of the text paragraph and / or the picture on the target page to obtain a streaming document, the method further includes: The streaming document is displayed in a reader.

8. The method according to claim 7, characterized in that The position information of the picture includes the position of the picture in the target page, and the size information of the picture includes the percentage of the picture in the target page and the aspect ratio of the picture; The step of displaying the streaming document in a reader includes: For the picture in the streaming document, determine the height and width of the picture in the reader according to the screen size of the reader and the size information of the picture; The image is scaled according to the height and width of the image in the reader and then displayed in the reader based on the position of the image in the target page.

9. The method according to claim 7, characterized in that: The position information of the image also includes a rotation angle of the image in the target page.

10. The method according to claim 7, characterized in that After displaying the streaming document in the reader, the method further includes: receiving a zoom-out operation and / or a zoom-in operation of the streaming document from a user; When the streaming document includes text paragraphs and / or pictures arranged in columns, the display effect of the text paragraphs and / or pictures arranged in columns is dynamically adjusted according to the reduction factor of the reduction operation and / or the magnification factor of the magnification operation.

11. The method according to claim 10, characterized in that After the display effect is adjusted, the location or page of part of the text and / or pictures in the text paragraphs and / or pictures arranged in columns changes.

12. The method according to claim 1, characterized in that The method further comprises: In the process of converting the format of the layout document, the offset of each character in the layout document in the source file of the stream document is recorded.

13. The method according to claim 12, characterized in that The method further comprises: receiving a second annotation mark added to the streaming document; Obtaining the starting offset and the ending offset corresponding to the second annotation mark; Receiving a re-arrangement return trigger operation for the streaming document, and displaying the layout document in a reader; The second annotation mark is drawn in the layout document according to the offset of each character in the layout document in the source file of the flow document and the start offset and the end offset corresponding to the second annotation mark.

14. The method according to claim 13, characterized in that The annotation mark includes at least one of an underline, a polygonal box, and a highlight.

15. The method according to claim 1, characterized in that The layout document is a document with a fixed layout, and the flow document is a document with a non-fixed structure.

16. The method according to claim 1, characterized in that The layout document includes at least one of a PDF document, an OFD document, an XPS document, and a CEB document, and the streaming document includes an HTML document.

17. An electronic device, characterized in that: include: processor; A memory for storing executable instructions; The processor is used to read the executable instructions from the memory and execute the executable instructions to perform the following operations: Acquire a layout document, wherein the layout document includes at least one target page; Parsing the layout document to determine unit element information of the target page, wherein the unit element information includes element information of the unit element on the target page, and the unit element includes a text element and / or a picture; Divide the target page into regions according to the unit element information to obtain a plurality of unit regions, wherein the unit regions include a unit element; Merging elements of each unit area in the target page to obtain text paragraphs and / or pictures; According to the element information of the text paragraph and / or the picture on the target page, the format of the layout document is converted to obtain a streaming document; The unit element further includes a first annotation mark, and the element information of the first annotation mark includes a start character and an end character corresponding to the first annotation mark; The operations also include: The first annotation mark is drawn in the flow document according to the offset of each character in the layout document in the source file of the flow document and the start character and the end character corresponding to the first annotation mark.

18. The electronic device according to claim 17, characterized in that: The element information includes size information and position information. The text element is a text line. The position information of the text element includes the line spacing and / or column spacing of the text line.

19. The electronic device according to claim 18, characterized in that: The executable instructions further cause the processor to perform the following operations: The target page is divided into regions according to the unit element information to obtain a plurality of unit regions, including: Determine the target page as the area to be processed, and determine the maximum line spacing and / or maximum column spacing in the area to be processed according to the line spacing and / or column spacing of the text lines; Dividing the area to be processed according to the maximum row spacing and / or the maximum column spacing to obtain at least two sub-areas; Each of the sub-regions is re-determined as the area to be processed, and secondary area division is performed until each of the sub-regions obtained by division meets a preset condition, and each of the sub-regions is determined as a unit area.

20. The electronic device according to claim 19, characterized in that: The executable instructions further cause the processor to perform the following operations: The sub-area meets the preset conditions, including: When the sub-area includes only a single text line, a single picture, or multiple continuous text lines with the same preset element information and a first line indent, it is determined that the sub-area meets the preset conditions, and the preset element information includes at least one of font style, font size, text line height, text line width, and text line spacing.

21. The electronic device according to claim 17, characterized in that: After merging the elements of each unit area in the target page to obtain a text paragraph and / or a picture, the executable instruction further causes the processor to perform the following operations: Parsing, region division and element merging are performed again on the text paragraph and / or picture return.

22. The electronic device according to claim 17, characterized in that: For the text paragraphs and / or pictures that are typeset in lines in the layout document, the corresponding format in the flow document is a line format or a paragraph format; For the text paragraphs and / or pictures that are arranged in columns in the layout document, their format in the flow document is a table format.

23. The electronic device according to claim 17, characterized in that: After converting the format of the layout document according to the element information of the text paragraph and / or the picture on the target page to obtain a streaming document, the executable instructions further cause the processor to perform the following operations: The streaming document is displayed in a reader.

24. The electronic device according to claim 23, characterized in that: The position information of the picture includes the position of the picture in the target page, and the size information of the picture includes the percentage of the picture in the target page and the aspect ratio of the picture; The executable instructions further cause the processor to perform the following operations: The step of displaying the streaming document in a reader includes: For the picture in the streaming document, determine the height and width of the picture in the reader according to the screen size of the reader and the size information of the picture; The image is scaled according to the height and width of the image in the reader and then displayed in the reader based on the position of the image in the target page.

25. The electronic device according to claim 23, characterized in that: The position information of the image also includes a rotation angle of the image in the target page.

26. The electronic device according to claim 23, characterized in that: After displaying the streaming document in the reader, the executable instructions further cause the processor to perform the following operations: receiving a zoom-out operation and / or a zoom-in operation of the streaming document from a user; When the streaming document includes text paragraphs and / or pictures arranged in columns, the display effect of the text paragraphs and / or pictures arranged in columns is dynamically adjusted according to the reduction factor of the reduction operation and / or the magnification factor of the magnification operation.

27. The electronic device according to claim 26, characterized in that: After the display effect is adjusted, the location or page of part of the text and / or pictures in the text paragraphs and / or pictures arranged in columns changes.

28. The electronic device according to claim 17, characterized in that: The executable instructions further cause the processor to perform the following operations: In the process of converting the format of the layout document, the offset of each character in the layout document in the source file of the stream document is recorded.

29. The electronic device according to claim 28, characterized in that The executable instructions further cause the processor to perform the following operations: receiving a second annotation mark added to the streaming document; Obtaining the starting offset and the ending offset corresponding to the second annotation mark; Receiving a re-arrangement return trigger operation for the streaming document, and displaying the layout document in a reader; The second annotation mark is drawn in the layout document according to the offset of each character in the layout document in the source file of the flow document and the start offset and the end offset corresponding to the second annotation mark.

30. The electronic device according to claim 29, characterized in that The annotation mark includes at least one of an underline, a polygonal box, and a highlight.

31. The electronic device according to claim 17, characterized in that: The layout document is a document with a fixed layout, and the flow document is a document with a non-fixed structure.

32. The electronic device according to claim 17, characterized in that: The layout document includes at least one of a PDF document, an OFD document, an XPS document, and a CEB document, and the streaming document includes an HTML document.

33. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the document processing method described in any one of claims 1 to 16.

Citation Information

Patent Citations

  • A format document conversion method and device

    CN109582934A

  • Electronic book typesetting processing method, electronic equipment and storage medium

    CN112699634A

  • Format document processing method and device, electronic equipment and readable storage medium

    CN113408251A