File conversion method, device, equipment and program product

By identifying elements and logically layering images or PDF documents, generating structured documents and converting them into editable PDFs, the problem of pure image PDF and partially editable PDF conversion is solved, realizing instant editing and efficient use of documents.

CN120471022APending Publication Date: 2025-08-12UCWEB

Patent Information

Application Number
CN202510952283.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-10
Publication Date
2025-08-12

AI Technical Summary

Technical Problem

Existing pure image PDFs and partially editable PDFs are difficult to convert into editable PDFs, resulting in users being unable to directly extract text information and adjust formats, making it inconvenient to process and reuse.

Method used

By recognizing elements and logically hierarchizing images or PDF documents, structured documents, such as HTML documents, and support users to edit and preview in real time, and finally convert them into editable PDFs.

Benefits of technology

Realize instant editing and effect preview of images or PDF documents, improves file operability and convenience of editable elements, while retaining the original layout, improving document processing efficiency and reuse convenience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120471022A_ABST
    Figure CN120471022A_ABST
Patent Text Reader

Abstract

The invention provides a file conversion method and device, equipment and a program product, and the method comprises the steps: obtaining a to-be-converted file which is an image file or a portable document format file, i.e., a PDF file; identifying elements in the to-be-converted file, determining attributes of the identified elements based on an identification result, and performing logic layering on the identified elements; the elements comprise texts; generating a structured document based on the logical layering result and the attributes of the identification elements; and converting the structured document or the edited structured document into an editable file in a portable document format, so that the PDF can be edited. According to the method and the device, the automatic conversion from the image or the PDF to the editable PDF is realized, and in the conversion process, through the structured document generated in the middle, while the logic level of the document is improved, a user is supported to carry out instant editing, and the editing efficiency and convenience are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of document processing technology, and in particular to a file conversion method, device, equipment and program product. Background Art

[0002] Existing documents include editable documents, such as Word, and non-editable documents, such as images. PDF (Portable Document Format) has been widely used due to its cross-platform compatibility, precise layout control, and data security.

[0003] PDF files are primarily categorized as image-only PDF (also known as photocopy PDF), editable PDF, and partially editable PDF. Editable PDFs store structured text, images, and vector graphics data, allowing users to directly select and copy text content, edit, and search the document. Essentially, they are digital documents constructed from text and graphics instructions. Editable PDFs contain editable elements, such as text and vector graphics, as well as non-editable elements, such as images. Image-only PDFs, on the other hand, are typically generated by scanning paper documents or directly converting images. The entire document content is stored as an image, resulting in higher memory consumption. While image-only PDFs retain the visual appearance of the original document, they lack editable text data, making it difficult to directly extract text information and format the document. This creates significant inconveniences when processing and reusing these documents. Partially editable PDFs are a combination of image-only and editable PDFs, and suffer from similar issues as image-only PDFs.

[0004] Therefore, there is an urgent need to provide a technical solution for converting images, pure image PDFs or partially editable PDFs into editable PDFs. Summary of the Invention

[0005] The embodiments of the present application provide a file conversion method, apparatus, device, and program product, which realize the conversion of images or PDFs into editable PDFs. Moreover, through the structured documents generated in the middle, not only a clear hierarchical logical structure is given to the document, but also real-time editing is supported throughout the conversion process, significantly improving document processing efficiency and the convenience of content reuse.

[0006] In a first aspect, an embodiment of the present application provides a file conversion method, comprising: obtaining a file to be converted; the file to be converted is an image file or a portable document format file; identifying elements in the file to be converted, and determining attributes of the identified elements based on the identification results and logically stratifying the identified elements; the elements include text; generating a structured document based on the logical stratification results and the attributes of the identified elements; and converting the structured document or the edited structured document into an editable portable document format file.

[0007] In a second aspect, an embodiment of the present application provides a file conversion device, comprising: a file to be converted acquisition module, used to obtain the file to be converted; the file to be converted is an image file or a portable document format file; an element identification module, used to identify the elements in the file to be converted, and determine the attributes of the identified elements based on the identification results and logically stratify the identified elements; the elements include text; a structured document generation module, used to generate a structured document based on the logical stratification results and the attributes of the identified elements; an editable file conversion module, used to convert the structured document or the edited structured document into an editable portable document format file.

[0008] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory and a processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the processor executes the method provided in the first aspect of the present application and / or various possible implementations of the first aspect.

[0009] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the method provided in the first aspect of the present application and / or various possible implementation methods of the first aspect.

[0010] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the method provided in the first aspect of the present application and / or various possible implementation methods of the first aspect.

[0011] The file conversion method, apparatus, device, and program product provided in the embodiments of the present application are for files to be converted that are partially or completely uneditable and occupy a large amount of memory, such as images or PDF documents. Through an element recognition step, the attributes of the elements in the file are determined and the identified elements are logically layered, and then a structured document, such as an HTML document, is generated based on the element attributes and the layering results; finally, the structured document or the edited structured document is converted into an editable PDF document, and the user can directly perform operations such as text selection, copying, and searching in the editable PDF document, thereby improving the operability of the file and the convenience of reusing editable elements such as text in the file; through the generation of an intermediate structured document, instant editing of the document and effect preview are supported, thereby improving the convenience of editing; at the same time, the structured document can completely retain the layout of the image or PDF, thereby improving the quality of the editable PDF conversion. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0013] Figure 1 A schematic diagram of a scenario provided in an embodiment of the present application;

[0014] Figure 2 Schematic diagram of the file conversion process provided by this application Figure 1 ;

[0015] Figure 3 A schematic diagram of a hierarchical relationship provided in an embodiment of the present application;

[0016] Figure 4 A schematic diagram of an editing interface for a structured document provided in an embodiment of the present application;

[0017] Figure 5 Schematic diagram of the file conversion process provided by this application Figure 2 ;

[0018] Figure 6 A schematic diagram of a visual operation interface for an editable PDF document provided in an embodiment of the present application;

[0019] Figure 7 A schematic diagram of the structure of a file conversion device provided in an embodiment of the present application;

[0020] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0021] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION

[0022] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.

[0023] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and corresponding operation entrances must be provided for users to choose to authorize or refuse.

[0024] The following specific embodiments describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0025] Some software provides the function of converting images to PDF. Figure 1 A schematic diagram of a scenario provided in an embodiment of the present application, such as Figure 1 As shown, users can upload scanned images of documents or documents in other formats, such as Word, through the "Upload" button or the photo button of the software, and obtain PDF documents through the PDF conversion function of the software, such as converting scanned images into pure image PDFs, and converting Word documents into editable PDF documents.

[0026] However, users cannot participate in the entire conversion process, which makes it difficult for users to control and adjust the conversion effect in real time and unable to optimize document details according to actual needs. At the same time, when converting pictures or pure image PDFs to editable PDFs, documents with complex layouts (such as multi-column layouts, nested tables, mixed text and graphics) are prone to text misalignment, formatting confusion, image loss and other problems, resulting in a significant reduction in the readability and usability of the converted editable PDF.

[0027] In order to solve the aforementioned problems, the present application provides a file conversion method. In order to convert an image or pure image PDF document into an editable PDF document, first, by accurately identifying the elements in the image or pure image PDF document, attribute parsing and logical stratification are realized, and the document is decomposed into structured data, providing a reliable data foundation for subsequent conversion; the introduction of intermediate structured documents such as HTML (Hyper Text Markup Language) documents supports users to edit documents in real time and preview the editing effects, thereby improving the flexibility of document editing and the controllability of the conversion process.

[0028] Figure 2 Schematic diagram of the file conversion process provided by this application Figure 1 The file conversion method can be executed by any device or module with corresponding data processing capabilities, such as a user terminal, a software server, etc. Figure 2 As shown, the file conversion method includes:

[0029] Step S201, obtaining a file to be converted; the file to be converted is an image file or a PDF file.

[0030] The file to be converted may be a PDF file that includes at least some non-editable content. The non-editable content may be an image. Non-editable means that it cannot be edited using general software. This part of the content can be edited using some professional software.

[0031] Exemplarily, the file to be converted can be a PDF file whose content on some pages is an image, or a PDF file consisting of pure images, i.e., a pure image PDF document. The content of a pure image PDF document is not composed of editable elements such as text and vector images, but is composed of a combination of images, and the content cannot be edited directly. That is, the elements in a pure image PDF document only include images, and there are no editable elements such as text, tables, vector graphics, etc. A pure image PDF document can be a PDF document obtained by scanning a paper document, a scan of an electronic document, a PDF document obtained by splicing pictures, etc. Pure image PDFs are usually large in file size, which is not convenient for transmission and storage.

[0032] For example, the file upload function can be used as Figure 1 , directly upload the file to be converted, such as a pure image PDF document, by clicking the "Upload" button. You can also scan a document using the scan or photo function to obtain one or more scanned images as the files to be converted, or process multiple scanned images into pure image PDF documents, and then perform subsequent file conversion using the pure image PDF document as the file to be converted to obtain an editable PDF document.

[0033] When uploading files to be converted, you can upload them from various paths, such as local files on the device, recently browsed or saved files, and files in preset programs.

[0034] In some embodiments, a screenshot of the web page can be taken, and the web page screenshot can be used as the file to be converted, or the web page screenshot can be processed into a pure image PDF document, and the pure image PDF document can be used as the file to be converted.

[0035] The specific method of processing an image into a pure image PDF document is: importing the image into a blank PDF document, or using relevant software or tools to convert the image into a pure image PDF document.

[0036] Step S202 : identifying elements in the file to be converted, determining attributes of the identified elements based on the identification results, and logically stratifying the identified elements; the elements include text.

[0037] Since the files to be converted cannot be edited directly, recognition or detection algorithms are required to identify the elements within them. In addition to text, these elements can also include one or more of images, tables, and graphs. Images typically refer to raster images, also known as bitmaps, which are composed of a matrix of pixels, each containing color and position information. Common formats include JPEG, PNG, and GIF. Graphics are typically vector graphics, such as those composed of basic elements like points, lines, and polygons, or shapes defined by mathematical formulas, such as flowcharts and curve graphs.

[0038] The attributes of an element include the attributes of the element itself, such as position, size, text content or type, font, color, bold, italic, etc., as well as the typesetting attributes of the element, such as alignment, spacing, etc.

[0039] Before identifying elements in the file to be converted, in order to improve the accuracy of recognition, the file to be converted can be preprocessed, such as image enhancement, tilt correction, page segmentation, etc. Among them, image enhancement specifically improves the clarity of the image in the file to be converted through contrast adjustment, noise reduction, binarization and other processes. Tilt correction is used to correct the angle of the image in the file to be converted so that the text lines in the image are arranged horizontally. Tilt correction can be achieved through Hough transform, projection method, deep learning algorithm, etc. Page segmentation is used to divide the file to be converted containing multiple pages into single pages, and / or to obtain different areas from a single page to perform element recognition on the segmented single page or area.

[0040] Various elements in the file to be converted can be identified through element detection and positioning algorithms, such as edge detection algorithms, target detection models (such as YOLO, Faster R-CNN, etc.), morphological operations (dilation, erosion), etc.

[0041] Taking text as an example, the text in image files or PDF files can be recognized using the Optical Character Recognition (OCR) algorithm.

[0042] Specifically, projection methods, connected domain analysis, or deep learning models can be used to locate text lines in the file to be converted, and then the text lines can be split into individual characters. Characters can be recognized through models such as RNN (Recurrent Neural Network) and CNN (Convolutional Neural Network), and some character attributes such as font, size, and color can be determined.

[0043] For images and graphics, computer vision algorithms can be used to achieve image or graphic recognition. Specifically, color threshold segmentation can be used to identify image and graphic regions, edge detection can be performed on these regions to extract boundaries, and connected domain analysis can be used to locate image and graphic outlines, thereby achieving image and graphic location. Alternatively, object detection models or instance segmentation models can be used to identify or segment image elements and graphics in the file to be converted, for example, outputting the coordinate boxes of image elements and graphics.

[0044] For tables, morphological processing and connectivity analysis can be used to identify them. Alternatively, line segment detection and straight line fitting can be performed on the identified text area to determine linear elements and their intersections. Based on these linear elements and their intersections, a connection network can be constructed to determine whether the connection network is a table. Alternatively, deep learning algorithms can be used to identify tables in the file to be converted.

[0045] After identifying various elements in the file to be converted, the attributes of each element are determined based on the recognition results, such as position, coordinates, alignment, resolution, text type, font, font size, color, number of rows and columns, cell spacing, etc., and can also include the relationship attributes between elements, such as spatial relationships, logical relationships, etc.

[0046] The logical stratification step is used to organize the identified elements into a multi-level structure in a logical or reading order. Specifically, based on the type and position of each type of identified element, the logical stratification of the identified elements can be achieved to obtain a background layer, a text layer, a graphic layer, a table layer, etc. The background layer can be composed of non-content elements, such as watermarks, page borders, backgrounds, etc. The text layer is obtained by dividing the identified text blocks into paragraphs, titles, etc. The text block consists of the text identified in a connected area. In the image layer, each identified image can be an independent layer, and the identified graphics can be one or more layers. The table is located in a separate table layer, which contains row and column data and the relationship with the text.

[0047] In the logical hierarchical step, a tree structure may be used to store the obtained hierarchical relationship of the elements.

[0048] For example, Figure 3 A schematic diagram of a hierarchical relationship provided in an embodiment of the present application is shown as follows: Figure 3 As shown, the pure image PDF document consists of 2 pages. Page 1 includes, from top to bottom, a text segment (including a title H1 and two paragraphs p1 and p2), an image img1, and a table Table1. The hierarchical relationship of the pure image PDF document is as follows: Figure 3 As shown in the figure, the root node represents an image-only PDF document. The child nodes of the root node are the pages, such as Page 1 and Page 2. Each page's corresponding node has multiple descendant nodes, representing the structure of the page's content. Taking Page 1 as an example, the child nodes included are the background layer, the text layer, the image layer, and the table layer. The text layer has three child nodes: Title (H1), Body Paragraph 1 (p1), and Body Paragraph 2 (p2). The image layer and table layer nodes include Image 1 (img1) and Table 1 (table1) child nodes, respectively.

[0049] Step S203: generating a structured document based on the logical stratification result and the attributes of the identified elements.

[0050] Illustratively, the structured document may be an HTML document, an XML (Extensible Markup Language) document, or a document in another structured format.

[0051] Specifically, taking HTML documents as an example, HTML tags can be mapped to each layer based on the logical layering results. For example, the text layer can be mapped to the title (such as <h1> to< / h1> <h6>), paragraphs (e.g. 、 ), etc., the image layer is mapped to 、 <figure>etc., the table layer is mapped to

[0052]

[0053]

[0054]

[0055]

[0056]

[0057]

[0058]

[0059]

[0060] Figure 4 Figure 4 Figure 4 + - U

[0061]

[0062]

[0063]

[0064]

[0065] Figure 5 Figure 2 Figure 2 Figure 5

[0066]

[0067]

[0068]

[0069]

[0070]

[0071]

[0072]

[0073]

[0074]

[0075]

[0076]

[0077]

[0078]

[0079]

[0080]

[0081]

[0082]

[0083]

[0084]

[0085]

[0086]

[0087]

[0088]

[0089]

[0090]

[0091]

[0092]

[0093]

[0094]

[0095]

[0096]

[0097]

[0098]

[0099]

[0100]

[0101]

[0102]

[0103]

[0104]

[0105]

[0106]

[0107]

[0108]

[0109]

[0110]

[0111]

[0112]

[0113]

[0114]

[0115]

[0116]

[0117]

[0118]

[0119]

[0120]

[0121]

[0122]

[0123]

[0124]

[0125]

[0126]

[0127]

[0128] Figure 6 Figure 6 Figure 6

[0129]

[0130]

[0131]

[0132]

[0133]

[0134]

[0135]

[0136]

[0137] Figure 7 Figure 7

[0138]

[0139]

[0140]

[0141]

[0142]

[0143]

[0144]

[0145]

[0146]

[0147]

[0148] Figure 8 Figure 8

[0149]

[0150]

[0151]

[0152]

[0153]

[0154]

[0155]

[0156]

[0157]

[0158]

[0159]

[0160]

[0161]

[0162]

[0163] The content and style of the HTML tags are determined by the attributes of the elements, and visual restoration is achieved using CSS styles. The logical hierarchical result can be in JSON or XML format. An HTML template can be pre-defined to convert the logical hierarchical result into a data structure that can be recognized by the template engine. The attributes of each element after parsing are matched with HTML or CSS tags to determine the presentation method of each element in HTML. The converted data is combined with the HTML module through the template engine to generate the final displayable HTML document. After the structured document is generated, the structured document can be displayed through an editor to facilitate users to edit the structured document, such as modifying text content, changing text attributes, adjusting image size, replacing images, adjusting image position, editing tables, etc. Step S204, converting the structured document or the edited structured document into an editable PDF file. Exemplarily, an editable PDF file can edit a PDF document, and its format can be PDF / A, PDF / X, PDF / E, standard PDF, etc. After the structured document is generated, the structured document can be directly converted into an editable PDF document. Alternatively, after generating a structured document, the structured document can be displayed first. If a PDF conversion instruction issued by the user is detected, or if no user editing operation is detected within a preset time period, the structured document is converted into an editable PDF document. Taking an HTML document as an example, converting the HTML document (or an edited HTML document) into an editable PDF document can specifically include three steps: document parsing, layout calculation, and element mapping. The document parsing step primarily implements parsing the HTML document to obtain an abstract syntax tree, extract tags, text content, and hierarchical relationships, and parses CSS styles to merge styles of the same element and obtain the final style of the element. The layout calculation step converts the element from the HTML box model to the PDF coordinate system to obtain the absolute coordinates of the element in the PDF document. The element is mapped to the PDF document based on the absolute coordinates and the final style, preserving the original style of the element. For text lines, the text line breakpoints can be determined based on the width of the PDF document and the text font size. Optionally, the method further includes: providing an editing interface for the structured document; and updating the content of the structured document in response to an editing operation input by the user on the structured document through the editing interface, thereby obtaining the edited structured document. After displaying the structured document, users are supported to edit the content of the structured document through the editing interface.Text editing operations include, but are not limited to, adding text, deleting text, modifying text, and adjusting text attributes. Adjusting text attributes specifically includes adjusting the font, font size, color, character spacing, line spacing, bolding, italics, etc. Image editing operations include scaling, image replacement, image position adjustment, rotation, and alignment adjustment. Graphic editing operations include scaling, position adjustment, and rotation, and can also include adjustments to fill, transparency, shadow, and alignment. Graphic editing can also include modifying curve shapes and combining and splitting elements in graphics. Table editing operations include inserting rows / columns, deleting rows / columns, adjusting the number of rows and columns, merging cells, splitting cells, editing cell content, and adjusting table styles. Adjusting table styles includes adjusting border color, thickness, background color, and font style. It can also adjust table row height and column width, change table position, and sort data in a column. After generating a structured document, or generating a page of a structured document, page-by-page rendering and interactive editing based on page granularity are supported. As an example, a schematic diagram of the editing interface of a structured document provided in an embodiment of the present application is shown. As shown, the editing interface of the structured document adopts a dual toolbar collaborative design, including a bottom permanent toolbar and a regional floating toolbar. The bottom permanent toolbar is fixed at the bottom of the interface and contains controls that can be default controls or dynamically adjusted based on the type of element selected by the user. The regional floating toolbar is dynamically rendered in the user operation area. When the user selects a page element, the editing controls for that type of element are displayed above the selected element. Taking the user selecting a piece of text as an example, the editing interface presents text attribute adjustment controls. The bottom permanent toolbar includes controls for adjusting text attributes, color, and spacing (including character spacing and line spacing), such as font, font size (for example, increasing font size by A, decreasing font size by A), bold (B), italic (I), underline (), etc. The regional floating toolbar includes controls for operations such as text editing, text deletion, selecting all, copying, translating, moving, adjusting font size (including font size + and font size -), bolding, and alignment (including left alignment, center alignment, and right alignment).The file conversion method provided in this embodiment targets files to be converted that are non-editable and occupy a large amount of memory, such as images or PDF documents. The method determines the attributes of elements in the file and logically stratifies the identified elements through an element recognition step. A structured document, such as an HTML document, is then generated based on the element attributes and stratification results. The method ultimately converts the structured document or the edited structured document into an editable PDF document, allowing users to directly perform operations such as text selection, copying, and searching within the editable PDF document. This improves the operability of the file and the convenience of reusing editable elements within the file, such as text. The method also supports instant editing and previewing of documents through the generation of intermediate structured documents, improving editing convenience. Furthermore, the structured document can completely preserve the layout of the image or PDF, improving the quality of editable PDF conversion. Optionally, the elements in the file to be converted include at least two of text, images, tables, and graphics; identifying the elements in the file to be converted, determining the attributes of the identified elements based on the recognition results, and logically stratifying the identified elements includes: performing multimodal recognition on the file to be converted, identifying the elements therein and determining the attributes of each identified element; determining spatial relationships and semantic associations between the identified elements based on the attributes of each identified element; and logically stratifying the identified elements based on the spatial relationships and semantic associations. Optionally, before identifying the elements in the file to be converted, the method further includes: determining interference attributes of the file to be converted, the interference attributes including at least one of text clarity, table completeness, and image interference level; and if the interference attributes indicate that the file to be converted is typeset, then performing the step of identifying the elements in the file to be converted. Optionally, obtaining the file to be converted includes: obtaining at least one image to be converted; and embedding the at least one image into a blank Portable Document Format file (i.e., a blank PDF document) to obtain an image-only PDF document (i.e., the file to be converted). The process diagram of the file conversion method provided in this application is provided. This embodiment provides a detailed description of the file conversion method based on the embodiment. As shown, the file conversion method may specifically include the following steps: Step S501, obtaining at least one image to be converted. The at least one image to be converted may be a scanned image of a document or an image uploaded by a user. Step S502, embedding the at least one image into a blank PDF document to obtain a file to be converted. The file to be converted is a pure image PDF document. The at least one image may be a scanned image of a document, or a photograph (such as a landscape photo, an artistic photo, etc.), or an image of a chart, an e-book, a comic book, etc., such as a screenshot. The page in the blank PDF document can be regarded as a canvas, and each image to be converted can be located by a coordinate system. The image is stored in the PDF page in the form of a stream to obtain a pure image PDF document.Before embedding at least one image into a blank PDF document, the at least one image can be pre-processed, such as by format conversion, color space conversion, size and resolution adaptation, and lossless compression. The at least one image can be processed into an image list, and PDF pages can be generated one by one according to the order in the image list to obtain an image-only PDF document. Each image can correspond to a single PDF page, or multiple consecutive images can be spliced based on size to obtain a spliced image, which is then embedded into the same PDF page. In the image list, at least one image can be sorted according to the order in which they were uploaded or obtained, or the page number and / or content of the image can be identified, and the order of the images in the image list determined based on the identified page number and / or content. After all images are embedded into the PDF page, a border, page number, and title can be added to the PDF page to obtain an image-only PDF document. Step S503: Determine the interference attributes of the file to be converted. The interference attributes include at least one of text clarity, table integrity, and image interference level. The image interference level indicates the degree to which watermarks, seals, and non-text areas detected in the file to be converted, such as an image-only PDF document, obscure text areas. After obtaining the file to be converted and before converting it, the complexity of the file to be converted must be determined to determine whether its layout can be identified in the subsequent steps of this embodiment. Specifically, the interference properties of the file to be converted can be quantified based on computer vision, machine learning algorithms, and the like to assess its typesetability. For text regions (the region containing text) within the file to be converted, the text clarity can be determined by calculating the edge gradient value of the text region. The text clarity of the text regions is then averaged at the granularity of a page, a single image, or the entire file. Based on this average, a text clarity metric is determined, and this metric indicates whether the file to be converted is typesetable. In some embodiments, text clarity can be determined based on the accuracy of optical character recognition (OCR) or the quality of each image or page in the file to be converted. Specifically, taking an image-only PDF document as an example, the text clarity of the image-only PDF document or each page thereof can be determined based on the average confidence value of the characters in the OCR recognition. The higher the average confidence value, the better the text clarity. The Laplacian operator variance of an image-only PDF document or the text region on each page can be calculated. A smaller variance indicates poorer clarity (i.e., blurrier) for the image-only PDF document or the text on that page. If the text clarity of the document to be converted falls below a set threshold, the document is considered untypesetting. Alternatively, if the text clarity of any page falls below a set threshold, the document is considered untypesetting.For table integrity, a Hough transform is used to detect the continuity and intersection density of table lines. Table integrity is determined based on these two factors. The higher the continuity of the table lines and the closer the intersection density is to the number of rows and columns in the table, the higher the table integrity. Alternatively, a U-Net segmentation model can be used to divide the table into line segments and background. The number of connected domains within the segmented line segments is calculated. A greater number of connected domains indicates a more severe table fragmentation and lower table integrity. When the table integrity falls below a set threshold, the file to be converted, the table, or the page containing the table can be deemed non-typesetting. For image interference, the percentage of text recognition obstructed by watermarks, seals, or non-text areas in the file to be converted can be identified. A higher percentage indicates a higher level of image interference. If the image interference level exceeds a set threshold, the file to be converted or the corresponding page is deemed non-typesetting. In step S504, if the interference attribute indicates that the file to be converted is typeset, multimodal recognition is performed on the file to be converted to identify elements and determine the attributes of each identified element. Specifically, based on the calculated weighted values of each interference attribute, it can be determined whether the file to be converted or the corresponding page is typeset. If the file to be converted is typeset, the subsequent element attribute identification step is performed. If some pages of the file to be converted are not typeset, the non-typesettable pages can be skipped, and element identification can be performed only on the typesettable pages. In the generated structured document, blank pages can be sampled to represent the non-typesettable pages. If no typesettable pages exist in the file to be converted, the file to be converted is determined to be typeset. Optionally, the method further includes: if the text clarity is greater than a first threshold, the table completeness is greater than a second threshold, and the image interference level is less than a third threshold, then determining that the file to be converted is typeset. The first, second, and third thresholds are all configurable parameters. Typesettability determination can be performed at the page granularity. That is, for each page of the file to be converted, if the text clarity of the page is greater than a first threshold, the table completeness is greater than a second threshold, and the image interference level is less than a third threshold, then the page is determined to be typeset. By setting the threshold of the document interference attribute, the typeset attribute of the file to be converted is determined. The logic is simple and easy to implement. It realizes the identification of fuzzy files that are not suitable for processing, and realizes the quality pre-judgment of the file before element recognition, avoiding invalid conversion of files with serious noise and fuzziness, reducing computing overhead, and ensuring the quality of editable PDF conversion. Furthermore, when the file to be converted or part of the page of the file to be converted cannot be typeset, a prompt message can be generated and fed back to the user. The prompt message can be generated based on the page where the attribute that does not meet the typeset determination conditions is located, the corresponding element, etc., to prompt the user to rescan the corresponding page, thereby improving the clarity of the corresponding element. Optionally, the elements in the file to be converted include at least two elements of text, images, tables and graphics.When the file to be converted is typeset, when identifying the elements in the file to be converted, in order to be competent for multimodal scenarios, a multimodal recognition algorithm can be used for recognition. Specifically, the OCR engine can be used to locate the text block, extract the text content and the bounding box coordinates; distinguish different types of text such as the main text, title, header and footer in the text block through layout analysis; identify the image area based on color clustering and edge detection, and use a deep learning model to distinguish whether the elements in the image area are images or graphics, so as to achieve the positioning of images and graphics; detect table lines based on Hough transform, segment cells in combination with connected domain analysis, and use a semantic segmentation model to determine the table structure and the content in the cell, so as to achieve the positioning of the table. The font, font size, bold, italic, etc. in the text attributes can be extracted through the deep learning model, and the color can be obtained through the color picker. Optionally, the multimodal recognition of the file to be converted, identifying the elements therein and determining the attributes of each identified element, includes: performing text detection on the file to be converted, identifying the text elements therein and determining the attributes of the identified text elements; for areas where text is not recognized, identifying image elements and determining the attributes of the identified image elements based on the characteristics of the pixels in the area and the spatial relationship of the pixels; identifying table elements and determining the attributes of the identified table elements based on the alignment pattern of the recognized text and the visual dividing lines between the recognized text; if there are still unrecognized remaining areas in the file to be converted, identifying graphics and determining the attributes of the recognized graphics based on the contour features and connected domains of the images in the remaining areas. When performing multimodal recognition, the recognition order of text, image, table and graphics can be followed. Specifically, the text blocks are located based on a deep learning model or a machine vision algorithm; and the attributes of the characters in the text blocks are identified based on an OCR algorithm. After identifying the area where the text at the text block level is located, image recognition is performed in the area where the text is not recognized. Specifically, based on the characteristics and spatial relationships of pixels in areas where text has not been recognized, pixels are clustered, for example, using the K-means clustering algorithm. Texture analysis is then performed on each resulting cluster to determine whether the area corresponding to the cluster is an image. If so, the image size is determined based on the connected components of the image area, and the image content is identified using an object detection model. Recognized text blocks are grouped into rows and columns: horizontally, they are clustered by y-coordinate to form row groups, and vertically, they are clustered by x-coordinate to form column groups. Based on the spacing between row and column groups, the row and column intersections (cell vertices) are calculated. Visual separators are extracted using the Hough transform, and the degree of overlap between the visual separators and the intersections is calculated. Based on this overlap and the alignment of the text block, the presence of a table is determined, enabling table location. The number of rows and columns, row height, column width, and cell content of the table are then determined. For the remaining area after text, image, and table recognition, edge detection, contour extraction, and connected component analysis are performed. Based on the analysis results, the presence of graphics in the remaining area is determined.The order in which multimodal elements are identified ensures effective identification of text, the core information carrier. By setting different identification strategies for different elements, the characteristic expressions of different elements are fully considered, thereby improving the accuracy of multimodal element identification. Step S505: Based on the attributes of each identified element, the spatial relationships and semantic associations of the identified elements are determined. Spatial relationships can include at least one of adjacency, alignment, and inclusion. For each identified element, the adjacency relationship between elements can be determined based on the distance between the elements, such as the Euclidean distance, using a set threshold. A spatial adjacency graph is constructed based on the adjacency relationship, with the nodes being the identified elements and the edge weights being the inverse of the distance. Alignment relationships between elements can be determined by determining whether the element centers lie on the same horizontal / vertical line within an allowable error range. Containment relationships between elements can also be determined by determining whether their bounding boxes contain each other. Semantic associations represent the degree of semantic relevance between elements, such as the degree of relevance between the text content of different paragraphs or the degree of relevance between the content and / or title of an image, table, or graphic and the preceding or following paragraphs. Step S506: Based on the spatial relationships and semantic relevance of the elements, the identified elements are logically layered. The elements can be sorted along the z-axis based on their spatial relationship, and the background layer, content layer, and decoration layer can be obtained based on the sorting results. For the content layer, the spatial relationship and semantic association of the elements can be used to determine the stratification of the content layer identification elements. Taking text as an example, the text blocks can be clustered based on the spatial relationship and semantic association between each text line or each text block, and the identified text can be divided into different levels based on the clustering results, such as the title layer, the body layer, etc. For the text adjacent to the identified image / graphic / table, the title of the image / graphic / table can be determined from the adjacent text based on the semantic association; the title and the image / graphic / table are divided into the same level. Step S507: Generate a structured document based on the logical stratification results and the attributes of the identified elements. Step S508: Convert the structured document or the edited structured document into an editable PDF document. In this embodiment, a minimalist generation link starting with an image is constructed. Users can quickly start the editable PDF generation process directly from a single or batch of images, which is more convenient. By quantifying the interference properties of the document, the typeset type of the file to be converted is determined, avoiding the identification of documents that are not suitable for processing fuzzy documents. The quality of the document is pre-judged before element recognition, avoiding invalid conversion of documents with severe noise and fuzziness, reducing computing overhead, and ensuring the quality of PDF conversion. Multimodal recognition is used to effectively identify multimodal elements in the document, improving the comprehensiveness of element recognition. By deeply understanding the spatial relationship and semantic association between elements, the logical stratification of elements is achieved, the accuracy of the stratification is improved, and the restoration degree of the editable PDF document is improved. When the file to be converted includes multiple pages, an asynchronous processing mechanism can be used to significantly improve the user experience.In order to solve the pain point that users need to wait for the entire PDF document to be converted into a structured document before they can edit it, this embodiment adopts an asynchronous processing mechanism to achieve a smooth experience of loading subsequent pages while previewing. Specifically, each page in the file to be converted can be processed in parallel as an independent task, and each page of the file to be converted can be converted into a page in the structured document one by one according to the aforementioned method. After each page in the structured document is obtained, the page can be preloaded, thereby improving rendering efficiency. For structured documents, page rendering can be performed page by page in order, or the page rendering process can be dynamically triggered based on user behavior to give priority to rendering the page the user is viewing and its subsequent pages. Optionally, the structured document is a markup language document; the file to be converted includes multiple pages; identifying elements in the file to be converted, determining attributes of the identified elements based on the recognition results, and logically stratifying the identified elements includes: identifying elements on each page of the file to be converted, determining attributes of the identified elements on each page based on the recognition results of each page, and logically stratifying the identified elements on each page; generating the structured document based on the logical stratification results and the attributes of the identified elements includes: while generating a page corresponding to the current page in the structured document based on the logical stratification results of the current page and the attributes of the identified elements, asynchronously generating a page corresponding to the subsequent page in the structured document based on the logical stratification results of the subsequent page and the attributes of the identified elements. For each page in the file to be converted, an asynchronous mechanism can be used to identify elements on the page, determine attributes of the identified elements on the page based on the recognition results of the page, logically stratify the page, and generate a structured page corresponding to the page based on the logical stratification results of the page and the attributes of the identified elements. The structured document is then composed of the structured pages of each page. In order to improve the efficiency of converting the file to be converted into a structured document, while generating the structured page of the previous page, such as the i-th page, an asynchronous mechanism can be used to generate the structured pages of subsequent pages, such as the i+1th page, the i+2th page, etc. The specific steps of generating the structured page of each page can be performed with reference to the steps of generating the structured document, and only the object is replaced by the entire file to be converted to a certain page of the file to be converted, which will not be repeated here. Optionally, the method also includes: based on the monitored operation events, determining the page currently viewed by the user; after generating the page corresponding to the page to be rendered, immediately push it to the front end for rendering, and the page to be rendered includes the current page viewed by the user, and the subsequent pages of the current page. Among them, the subsequent page can be one or more pages after the current page viewed by the user. The page corresponding to the page to be rendered is specifically the page corresponding to the page to be rendered in the structured document, that is, the structured page of the page to be rendered.To prioritize rendering the page the user is viewing and its subsequent pages, front-end interaction events can be monitored to capture user action events in real time, such as scroll events, click events, keyboard events, and touch events. Based on these events, the page the user is currently viewing (referred to as the current page) is determined. For scroll events, the current page can be determined by the vertical scroll distance and the height of a single page. Users can also navigate to a corresponding page using a page navigation button, which determines the current page. When users turn pages by swiping, the current page can be determined by the swiping distance and speed. After determining the current page, the current page and N subsequent pages can be selected as the pages to be rendered, where N is a positive integer, such as 2, 3, or 5. N can be a default value, such as 2, or it can be determined based on the total number of pages in the file to be converted, device performance, or user behavior scenarios. For example, the number of subsequent pages, i.e., the value of N, can be determined based on swiping speed. When a user is detected editing a page, N can be set to a minimum value, such as 0 or 1. Since users have less need to browse subsequent pages when editing a page, reducing N can optimize resource allocation, ensuring responsiveness and improving the smoothness of editing operations. For example, when a structured document is first loaded, the current page is set to the first page, and the number of subsequent pages is set to 2. When a user flips pages slowly (swiping or scrolling slower than a preset speed), N can be 1; when a user flips pages quickly, N can be 5; and when a user is detected editing a page, N can be 1. Furthermore, after generating an editable PDF document, the editable PDF document can be displayed or previewed, allowing the user to review the editable PDF document and determine whether to export or save it, as well as whether to edit it. The visual interface for the editable PDF document provides flexible and diverse interactive features to fully meet user editing and management needs. This interface supports detailed single-page display and multi-page thumbnail overviews, and users can quickly switch browsing perspectives using the sidebar's paging navigation bar or zoom ratio. It supports users to select single pages or batches of pages for editing. Whether it is to modify the text content of a certain page or to adjust the unified format of multiple pages, it can be easily achieved. In terms of content editing, it provides a wealth of editing tools, covering the addition and deletion of annotations, the insertion and position adjustment of pictures, and the addition and deletion of text content, to help users efficiently optimize the content. In terms of file attribute management, users can flexibly adjust the page number format, page size, compression attributes, and encryption attributes. In addition, the visual operation interface also supports page deletion and addition operations. When adding new pages, you can refer to the aforementioned method of generating editable PDF documents, which will not be repeated here.As an example, a schematic diagram of a visual operation interface for an editable PDF document provided in an embodiment of the present application is shown. After generating an editable PDF document, the generated editable PDF document is displayed through the display interface of the visual operation interface. Taking a single page display as an example, multiple functional controls are deployed at the bottom of the display interface, including "Edit," "Page Management," "File Properties," "Add," and "Done." The "Done" control is used to indicate the end of the editable PDF document operation, so as to export or store the editable PDF document; the "Edit" control is used to edit the currently displayed content. When the "Edit" control is triggered, the edit mode of the currently displayed page is activated, and the cursor changes to a text selection state, supporting editing operations such as text editing and element deletion. When the "Page Management" control is triggered, the page management interface is displayed, which is used to perform operations on a single page or batch of pages, including extracting, deleting, rotating, and adding pages. The functions include extracting some pages and saving them as separate PDF files, deleting selected pages, rotating selected pages according to a configured angle, and adding some pages. The page order can also be adjusted by dragging and dropping, and the page numbers can be automatically adjusted after the order is adjusted. When the "File Properties" control is triggered, a floating panel appears above it, containing multiple controls such as "Volume Compression," "Document Encryption," "Page Number Adjustment," and "Page Size." The "Volume Compression" control is used to compress the entire document, with options such as lossless, standard, and extreme compression. The "Document Encryption" control is used to encrypt the document, allowing you to set both an open password and an edit access password, and supports selecting an encryption algorithm. "Page Number Adjustment" and "Page Size" are used to adjust the page number format and page size, respectively. The "Add" control is used to add content to an editable PDF document. When triggered, the corresponding toolbar appears above it, containing controls such as "Annotation," "Handwriting," "Insert Text," "Insert Image," and "Eraser." The "Annotation" control supports inserting yellow sticky note-style comments, allowing you to enter text and set text attributes such as color and font. It also supports adding highlights, underlining, and strikethroughs to selected text. The "Handwriting" control allows you to customize the stroke color and thickness, drawing handwriting in real time to mimic handwriting and add content to the page. The "Eraser" control allows you to erase handwritten content or annotations in a specified area. The "Insert Text" and "Insert Image" controls allow you to insert text and images at specified locations, automatically adjusting the position of subsequent content after the text and images are inserted. In some embodiments, it also supports converting editable PDF documents to other formats, such as Word.The present application also provides another file conversion method, comprising: in response to a file to be converted uploaded by a user, processing the file to be converted into a structured document; wherein the file to be converted is an image file or a portable document format file (PDF); displaying the structured document; and, in response to a file conversion instruction, converting the displayed structured document or the edited structured document into an editable portable document format file (i.e., an editable PDF document). The specific process of processing the file to be converted into a structured document can be carried out with reference to the aforementioned embodiments. Specifically, elements in the file to be converted can be identified, and based on the identification results, attributes of the identified elements can be determined and logically layered. The elements can include text. Based on the logical layering results and the attributes of the identified elements, a structured document can be generated. After obtaining a hierarchical relationship of the file to be converted (specifically obtained through a logical layering step) during the processing of the file to be converted into a structured document, the hierarchical relationship can be displayed to facilitate user adjustment of the hierarchical relationship, thereby generating a structured document based on the adjusted hierarchical relationship and the attributes of the identified elements. Structured documents can be displayed through an editor or editing interface, and users can edit the displayed structured documents, including but not limited to: modifying text content (adding text, deleting text, modifying text, etc.), changing text attributes (font, size, bold, italic, color, etc.), adjusting image size, replacing images, adjusting image position, editing tables, etc. An editing interface for structured documents is provided and the generated structured document is displayed on the editing interface; in response to editing operations on the structured document input by the user through the editing interface, the content of the structured document is updated to obtain the edited structured document. After displaying the structured document, if a file conversion instruction issued by the user is detected, or if no user editing operation is detected within a preset time period, the structured document is converted into an editable PDF document; if a user editing operation is detected within a preset time period, the structured document is updated based on the user editing operation to obtain an edited structured document; and when a file conversion instruction issued by the user is detected, the edited structured document is converted into an editable PDF document; in the case where the user edits the document multiple times, the structured document is updated based on each user editing operation; if no user editing operation is detected within a preset time period after the last editing operation, the structured document updated after the last editing operation is converted into an editable PDF document.For text in a structured document, the user's editing operations include but are not limited to adding text, deleting text, modifying text, adjusting text attributes, etc. Adjusting text attributes can specifically include adjusting the font, font size, color, character spacing, line spacing, bolding, italicization, etc. of the text; image editing operations include scaling, image replacement, image position adjustment, rotation, alignment adjustment, etc.; graphic editing operations include scaling, position adjustment, rotation, and can also include adjustments to fill, transparency, shadow, alignment, etc., and can also perform graphic editing such as modifying the shape of a curve, combining and splitting elements in the graphic, etc.; table editing operations include: inserting rows / columns, deleting rows / columns, adjusting the number of rows and columns, merging cells, splitting cells, editing cell content, adjusting table style, etc. Adjusting table style includes adjusting border color, thickness, background color, font style, etc., and can also adjust table row height, column width, change table position, sort data in a column of the table, etc. Corresponding to the file conversion method provided in the aforementioned embodiment, the embodiment of the present application also provides a file conversion device. The schematic diagram of the structure of the file conversion device provided in the embodiment of the present application is shown as follows. The file conversion device includes: a file acquisition module for obtaining a file to be converted, which is an image file or a portable document format file; an element recognition module for identifying elements in the file to be converted, and determining the attributes of the identified elements based on the recognition results and logically stratifying the identified elements; the elements include text; a structured document generation module for generating a structured document based on the logical stratification results and the attributes of the identified elements; an editable file conversion module for converting the structured document or the edited structured document into an editable portable document format file, i.e., an editable PDF document. In one possible implementation, the elements in the file to be converted include at least two elements selected from the group consisting of text, images, tables, and graphics; the element recognition module includes: a multimodal recognition unit for performing multimodal recognition on the file to be converted, identifying the elements therein and determining the attributes of each identified element; a relationship analysis unit for determining the spatial relationship and semantic association of the identified elements based on the attributes of each identified element; and a logical stratification unit for logically stratifying the identified elements based on the spatial relationship and semantic association. In one possible implementation, the multimodal recognition unit is specifically used to: perform text detection on the file to be converted, identify text elements therein, and determine the attributes of the identified text elements; for areas where text is not recognized, identify image elements and determine the attributes of the identified image elements based on the characteristics of pixels in the area and the spatial relationship of pixels; identify table elements and determine the attributes of the identified table elements based on the alignment pattern of the recognized text and the visual dividing line between the recognized text; if there are still unrecognized remaining areas in the file to be converted, identify graphics and determine the attributes of the recognized graphics based on the contour features and connected domains of the image in the remaining areas.In one possible implementation, the device further includes a document screening module, which is used to: before identifying the elements in the file to be converted, identify the interference attributes of the file to be converted, wherein the interference attributes include at least one of text clarity, table completeness, and image interference level; if the interference attributes indicate that the file to be converted can be typeset, then perform the step of identifying the elements in the file to be converted. In one possible implementation, the device further includes a typesetability determination module, which is used to: determine that the file to be converted can be typeset if the text clarity is greater than a first threshold, the table completeness is greater than a second threshold, and the image interference level is less than a third threshold. In one possible implementation, the file to be converted includes multiple pages; the element identification module is specifically used to: identify the elements of each page in the file to be converted, and determine the attributes of the identified elements of each page based on the identification results of each page, and logically layer the identified elements of each page. Accordingly, the structured document generation module is specifically used to: when generating the page corresponding to the current page in the structured document based on the logical hierarchical results of the current page and the attributes of the identified elements, asynchronously execute the logical hierarchical results of the subsequent pages and the attributes of the identified elements to generate the page corresponding to the subsequent pages in the structured document. In one possible implementation, the device also includes a to-be-rendered page determination and rendering module, which is used to: determine the current page viewed by the user based on the monitored operation events; immediately push the page corresponding to the to-be-rendered page to the front end for rendering after generating it, and the to-be-rendered page includes the current page viewed by the user and the subsequent pages of the current page viewed by the user. In one possible implementation, the device also includes a document editing module, which is used to: provide an editing interface for the structured document; and update the content of the structured document in response to the editing operation input by the user for the structured document through the editing interface to obtain the edited structured document. In one possible implementation, the module for obtaining files to be converted is specifically used to: obtain at least one image to be converted; embed the at least one image into a blank portable document format file, i.e., a blank PDF document, to obtain a pure image PDF document, i.e., the file to be converted. The file conversion device provided in this embodiment can execute the file conversion method provided in any of the above embodiments, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here. This is a structural diagram of an electronic device provided in an embodiment of the present application. As shown, the electronic device 80 provided in this embodiment includes: at least one processor 801 and a memory 802. Optionally, the electronic device 80 also includes a communication component 803. The processor 801, the memory 802, and the communication component 803 are connected via a bus 804. In the specific implementation process, at least one processor 801 executes the computer execution instructions stored in the memory 802, so that at least one processor 801 executes the above method.The specific implementation process of processor 801 can be found in the above-mentioned method embodiment. The implementation principles and technical effects are similar and will not be further described in this embodiment. In the above-mentioned embodiment, it should be understood that the processor can be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the present invention can be directly executed by a hardware processor or by a combination of hardware and software modules within the processor. The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk drive. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, and control buses. For ease of illustration, the buses depicted in the drawings of this application are not limited to a single bus or a single type of bus. This application also provides a computer program product comprising a computer program that, when executed by a processor, implements the aforementioned method. This application also provides a computer-readable storage medium storing computer-executable instructions that, when executed by the processor, implements the aforementioned method. The readable storage medium can be implemented by any type of volatile or non-volatile memory device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer. An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor.The processor and readable storage medium may be located in an application-specific integrated circuit (ASIC). Of course, the processor and readable storage medium may also exist as discrete components within the device. The division of units is merely a logical functional division; in actual implementation, other divisions may be employed. For example, multiple units or components may be combined or integrated into another system, or some features may be omitted or not implemented. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through interfaces, devices, or units, and may be electrical, mechanical, or other. Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units; they may be located in one location or distributed across multiple network units. Some or all of the units may be selected to achieve the objectives of the present embodiment as needed. Furthermore, the functional units in various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product, stored in a storage medium, includes instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk. Those skilled in the art will understand that all or part of the steps of the aforementioned method embodiments can be implemented using hardware associated with the program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the aforementioned method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as a ROM, RAM, a magnetic disk, or an optical disk. Finally, it is to be noted that other embodiments of the present invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein.The present invention is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary technical means in the technical field not disclosed by the present invention, are not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from the scope thereof. < / figure> < / h6>

Claims

1. A file conversion method, characterized in that: include: Obtaining a file to be converted; the file to be converted is an image file or a portable document format file; Identifying elements in the file to be converted, and determining attributes of the identified elements based on the identification results and logically stratifying the identified elements; the elements include text; Generate structured documents based on the logical hierarchical results and the attributes of the identified elements; The structured document or the edited structured document is converted into an editable portable document format file.

2. The method according to claim 1, characterized in that The portable document format file includes at least partially non-editable content.

3. The method according to claim 1, characterized in that The elements in the file to be converted include at least two elements selected from the group consisting of text, images, tables, and graphics; and identifying the elements in the file to be converted, determining attributes of the identified elements based on the identification results, and logically stratifying the identified elements, including: Performing multimodal recognition on the file to be converted, identifying elements therein and determining attributes of each identified element; Based on the attributes of each identified element, determine the spatial relationship and semantic association of the identified elements; Based on the spatial relationship and semantic association, the identified elements are logically layered.

4. The method according to claim 3, characterized in that The performing multimodal recognition on the file to be converted, identifying elements therein and determining attributes of each identified element includes: Performing text detection on the file to be converted, identifying text elements therein and determining attributes of the identified text elements; For an area where text is not recognized, identifying image elements and determining attributes of the recognized image elements based on features of pixels in the area and spatial relationships of pixels; identifying table elements and determining properties of the identified table elements based on an alignment pattern of the identified text and a visual separator between the identified text; If there are still unidentified remaining areas in the file to be converted, graphics are identified based on the contour features and connected domains of the image in the remaining areas and the attributes of the identified graphics are determined.

5. The method according to claim 1, wherein Before identifying the elements in the file to be converted, the method further includes: Determining an interference attribute of the file to be converted, the interference attribute comprising at least one of text clarity, table completeness, and image interference degree; If the interference attribute indicates that the file to be converted can be typeset, the step of identifying elements in the file to be converted is performed.

6. The method according to claim 5, characterized in that The method further comprises: If the text clarity is greater than a first threshold, the table completeness is greater than a second threshold, and the image interference level is less than a third threshold, it is determined that the file to be converted can be typeset.

7. The method according to claim 1, characterized in that The structured document is a markup language document; the file to be converted includes multiple pages; identifying elements in the file to be converted, determining attributes of the identified elements based on the identification results, and logically stratifying the identified elements, including: Identifying elements of each page in the file to be converted, and determining attributes of the identified elements of each page based on the identification results of each page, and logically stratifying the identified elements of each page; The generating of structured documents based on the logical hierarchical results and the attributes of the identified elements includes: When the page corresponding to the current page in the structured document is generated based on the logical hierarchical results and attributes of the identified elements of the current page, the page corresponding to the subsequent page in the structured document is generated asynchronously based on the logical hierarchical results and attributes of the identified elements of the subsequent pages.

8. The method according to claim 7, characterized in that The method further comprises: Determine the current page viewed by the user based on the monitored operation events; After the page corresponding to the page to be rendered is generated, it is immediately pushed to the front end for rendering. The page to be rendered includes the current page viewed by the user and the subsequent pages of the current page.

9. The method according to any one of claims 1 to 8, characterized in that The method further comprises: Providing an editing interface for the structured document; In response to an editing operation on the structured document input by a user through the editing interface, the content of the structured document is updated to obtain an edited structured document.

10. The method according to any one of claims 1 to 8, characterized in that The step of obtaining the file to be converted includes: Get at least one image to be converted; The at least one picture is embedded into a blank portable document format file to obtain the file to be converted.

11. A document conversion device, characterized in that: include: A file to be converted obtaining module is used to obtain a file to be converted; the file to be converted is an image file or a portable document format file; An element recognition module, configured to recognize elements in the file to be converted, determine attributes of the recognized elements based on the recognition results, and logically stratify the recognized elements; the elements include text; A structured document generation module is used to generate a structured document based on the logical hierarchical results and the attributes of the identified elements; The editable file conversion module is used to convert the structured document or the edited structured document into an editable portable document format file.

12. An electronic device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 10.

13. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 10 when the computer program is executed by a processor.

Citation Information

Patent Citations

  • PDF document availability analysis system and method

    CN110457276A

  • Table identification method and system based on structural unit, terminal and medium

    CN114529773A

  • Content editable document format conversion method and system based on visual identification

    CN120218015A

Cited By

  • Method and system for code-free definition of contract form based on WORD template

    CN120832877A

  • Document format integrated design method and designed document

    CN121092505A

  • Cross-format document page replacement method and system based on dynamic metadata mapping

    CN121092746A

  • A method and system for cross-format document page replacement based on dynamic metadata mapping

    CN121092746B

  • Document generation method based on OCR (Optical Character Recognition), electronic equipment and medium

    CN121147957A