File previewing method and device, computer equipment and storage medium
By parsing file links and using HTML5 technology to generate custom preview pages, the problem of lack of flexibility in file preview functions in the financial technology business field is solved, and file preview with high security and regulatory compliance is achieved.
Patent Information
- Application Number
- CN202510423382.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-08-26
AI Technical Summary
In the prior art, the file preview function in the financial technology business field lacks flexibility, cannot customize and expand styles, and cannot meet high security and regulatory requirements.
By parsing file links, determining the target file structure and parameters, using HTML5 technology to generate a custom file preview page, supporting preview requirements for different file formats and content.
Improves flexibility and adaptability of file preview functions to meet the needs of security and regulatory compliance in the fintech business.
Smart Images

Figure CN120541323A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of R&D management technology, and in particular to a file preview method, device, computer equipment, and storage medium. Background Art
[0002] With the widespread adoption of mobile devices and the continuous upgrade of operating systems, users are increasingly demanding file previews on mobile devices. In app (application software) development, file preview functionality has become almost essential. For example, PDF (Portable Document Format) is widely used in scenarios such as agreement and contract previews and online office work, placing high demands on PDF preview style configuration.
[0003] In the fintech sector, preview functionality has a wide range of applications. For example, electronic contracts signed between banks and customers, financial product instructions, and insurance policies are typically presented in PDF format. Financial institutions need to provide high-quality preview functionality in their mobile apps so that customers can easily view and sign relevant documents. However, financial documents often contain a large amount of sensitive information, such as personal identification information, account information, and transaction records, placing extremely high demands on the security and confidentiality of file previews. Furthermore, document preview functionality in financial apps must meet regulatory compliance requirements, such as electronic signatures and file encryption.
[0004] While some existing operating systems offer a Web (World Wide Web) component for previewing various file types, these only use default styles and lack the ability to customize or extend these tools and styles. This limits the flexibility of these preview functions and the user experience. Therefore, improving the flexibility of file previews in the fintech sector has become a pressing technical challenge. Summary of the Invention
[0005] The present application provides a file preview method, apparatus, computer equipment and storage medium to improve the flexibility of the file preview function in the financial technology business field.
[0006] In a first aspect, the present application provides a file preview method, the method comprising:
[0007] Parsing the link of the file to be previewed, and determining the target file structure and target parameters of the file to be previewed;
[0008] A target file preview page corresponding to the file to be previewed is generated by using a fifth generation Hypertext Markup Language HTML5 blank page, the target structure and the target parameters.
[0009] In a second aspect, the present application further provides a file preview device, the device comprising:
[0010] A file link parsing module, configured to parse the link of a file to be previewed and determine the target file structure and target parameters of the file to be previewed;
[0011] The preview page generation module is used to generate a target file preview page corresponding to the file to be previewed by using a blank page of the fifth generation hypertext markup language HTML5, the target structure and the target parameters.
[0012] In a third aspect, the present application also provides a computer device, which includes a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program and implement the file preview method as described above when executing the computer program.
[0013] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the file preview method as described above.
[0014] The present application discloses a file preview method, apparatus, computer equipment and storage medium, wherein the file preview method includes parsing the link of the file to be previewed, determining the target file structure and target parameters of the file to be previewed; and generating a target file preview page corresponding to the file to be previewed through a blank page of the fifth generation hypertext markup language HTML5, the target structure and the target parameters. In the above manner, the present application provides custom styles and tools for different files by parsing file links and determining the target file structure and target parameters. In view of the strong application compatibility of HTML5 technology, it can flexibly generate corresponding preview pages according to different file structures and parameters to meet the preview requirements of files of various formats and contents, and has strong versatility and adaptability, thereby improving the flexibility of the file preview function in the financial technology business field. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0016] Figure 1 is a schematic flow chart of a file preview method provided in the first embodiment of the present application;
[0017] Figure 2 is a schematic flow chart of a file preview method provided in the second embodiment of the present application;
[0018] Figure 3 is a schematic flow chart of a file preview method provided in the third embodiment of the present application;
[0019] Figure 4 A schematic block diagram of a file preview device provided in an embodiment of the present application;
[0020] Figure 5 A schematic block diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0021] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0022] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, combined, or partially merged, so the actual execution order may vary depending on the actual situation.
[0023] It should be understood that the terms used in this specification are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in this specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
[0024] It will also be understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0025] Embodiments of the present application provide a file preview method, apparatus, computer equipment, and storage medium. The file preview method can be applied to a server, providing customized styles and tools for different files by parsing file links and determining the target file structure and target parameters. Given the strong application compatibility of HTML5 technology, it can flexibly generate corresponding preview pages based on different file structures and parameters to meet the preview requirements of files of various formats and contents. It has strong versatility and adaptability, thereby improving the flexibility of file preview functions in the financial technology business field. The server can be a standalone server or a server cluster.
[0026] In this application, the file to be previewed is a PDF file to be previewed as an example to illustrate the various embodiments in this application. It should be noted that the PDF file is only an example, and the file to be previewed is not limited to a PDF file, and can be a file in various other formats.
[0027] The following describes some embodiments of the present application in detail with reference to the accompanying drawings. In the absence of conflict, the following embodiments and features therein may be combined with each other.
[0028] See also Figure 1 , Figure 1 The following is a schematic flow chart of a file preview method provided in the first embodiment of this application. This file preview method can be applied to a server to parse file links and determine the target file structure and parameters, providing customized styles and tools for different files. Given the strong application compatibility of HTML5 technology, it can flexibly generate corresponding preview pages based on different file structures and parameters to meet the preview requirements of files of various formats and contents. This method has strong versatility and adaptability, thereby improving the flexibility of file preview functions in the fintech business field.
[0029] like Figure 1 As shown, the file preview method specifically includes steps S10 to S30.
[0030] Step S10: parsing the link of the file to be previewed, and determining the target file structure and target parameters of the file to be previewed;
[0031] Specifically, in the financial sector, a link to a PDF to be previewed can be obtained from a user request or business process. For example, when a user clicks to view a PDF file of a financial product contract in a mobile banking app, the system obtains the stored link to the PDF to be previewed. After obtaining the stored link to the PDF to be previewed, the system checks whether the link to be previewed is valid, including whether the link is accessible and whether the file exists. If the link is invalid, the user is prompted to retrieve it again.
[0032] By parsing the PDF link to be previewed, basic information about the file can be obtained, such as file name, file size, file type, etc. At the same time, based on the domain name or path of the link, the source of the PDF file can be determined, such as whether it comes from the bank's internal business system, a third-party financial institution, or other data sources.
[0033] When the file to be previewed is not a PDF file, the corresponding preset file parsing tool is a PDF parsing tool. The PDF parsing tool is used to perform a structural analysis on the obtained PDF to be previewed to determine the page layout, text content, image elements, table structure and other information of the PDF file. For example, in a PDF file of financial transaction details, the layout of each page is analyzed to include the account information in the header, the page number and date in the footer, and the transaction record table in the middle. According to the needs of the fintech business, relevant target parameters are extracted from the PDF to be previewed. The target parameters can be key information such as customer name, ID number, account balance, transaction amount, transaction time, etc. For example, when previewing a PDF file of loan approval results, parameters such as loan amount, loan term, interest rate, etc. are extracted so that they can be highlighted on the preview page.
[0034] There is a certain correspondence between the target file structure of the file to be previewed and the target parameters. For example, it is determined that a certain position in the file to be previewed corresponds to the customer's signature image, and transaction details can be obtained in a certain table, so that when generating the preview page, the target parameters are accurately placed in the corresponding position.
[0035] In one embodiment, if the link of the PDF to be previewed is: https: / / shili.com / read.pdf,
[0036] On the PDF preview page, it is parsed as: https: / / pafactoring.cn / pdfviewer / viewer.html?url=https: / / shili.com / read.pdf&toobar=false&scale=false&download=false.
[0037] Among them, pafactoring.cn is a fixed domain name address, which is used to determine whether to load the PDF preview H5. It needs to be replaced with the actual domain name in actual use;
[0038] The url is the actual file link that needs to be previewed. The actual PDF resource will be loaded in H5 according to this address.
[0039] Toolbar is whether to display the toolbar. If the parameter is false, the toolbar is hidden. If it is not set or other values are set, the toolbar is displayed.
[0040] scale indicates whether PDF scaling is supported. If the parameter is false, scaling is not supported. If it is not set or other values are set, PDF scaling is supported.
[0041] Download indicates whether PDF download is supported. If the parameter is false, download is not supported. If it is not set or has other values, download is supported.
[0042] Step S20: Generate a target file preview page corresponding to the file to be previewed using a blank HTML5 page, the target structure, and the target parameters.
[0043] Specifically, when the file to be previewed is a PDF, a blank page is created using HTML5 as the basic page for PDF preview. The basic page includes a basic HTML5 structure and some common style settings, such as page background color, font size, etc.
[0044] According to the target file structure of the file to be previewed, the corresponding page elements are constructed in the HTML5 blank page. For example, using Tags create header, footer and page body areas, use
[0045]
[0046]
[0047]
[0048] Figure 2 Figure 2
[0049] Figure 1 Figure 2
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
[0056]
[0057]
[0058] Figure 2
[0059]
[0060]
[0061]
[0062]
[0063]
[0064]
[0065]
[0066] Figure 1
[0067]
[0068]
[0069]
[0070]
[0071] Figure 3 Figure 3
[0072] Figure 1 Figure 3
[0073]
[0074] The element is used as a container and a unique ID is set for it to facilitate subsequent operations.
[0075] Generate paging buttons or page navigation based on the total number of pages in the target file structure. For example, you can create a List, each page number corresponds to a Element with a link or click event to jump to a specific page. At the same time, you can add "Previous Page" and "Next Page" buttons to facilitate users to quickly turn pages.
[0076] Based on the content characteristics of the target file, other relevant navigation controls are generated, such as thumbnail navigation, bookmark navigation, and search functions. Again, this embodiment is explained using a PDF file as an example. Thumbnail navigation can be implemented by extracting thumbnails from PDF pages, bookmark navigation generates navigation links based on bookmark information in the PDF file, and the search function allows users to search for specific text content in the preview page.
[0077] Step S202: Determine the size and position information of each of the page navigation controls on the HTML5 blank page according to the target parameters;
[0078] Specifically, the width and height of the HTML5 page's visible area are obtained to appropriately position and size the navigation control based on the page size. The width and height of the navigation control are determined based on the page size and orientation information in the target file structure, as well as the size of the page's visible area. For example, if the PDF file's pages are in landscape orientation, the paging control's width can be set to a certain percentage of the page's visible area width, such as 80%, and the height can be adjusted based on the control's content.
[0079] Determine the location of navigation controls within an HTML5 page based on the page layout and user interaction habits. For example, you can place the paging control at the bottom center of the page so that users can easily turn pages when browsing PDF files. Place thumbnail navigation and bookmark navigation in the sidebar of the page to facilitate quick browsing and navigating to specific pages.
[0080] Step S203: embed each of the page navigation controls and the size information and position information corresponding to each of the page navigation controls into the HTML5 blank page to generate the target file preview page.
[0081] Specifically, embed the generated navigation control into a container element on an HTML5 page and add styles to the embedded navigation control to align with the overall page style. You can use inline styles or external style sheets to set style attributes such as color, font, and margins. For example, you can set a background color, rounded borders, and hover effects for the paging buttons to enhance the user experience.
[0082] In one embodiment, the target parameters include the total number of pages, page size, and orientation, which determine the size and placement of the control. For example, if a PDF file has many pages, the generated page number bar may need to be longer; if the page is in landscape orientation, the page number bar may be more appropriately placed on the side.
[0083] The present embodiment discloses a file preview method, which includes parsing the link of the file to be previewed, determining the target file structure and target parameters of the file to be previewed; generating at least one page navigation control according to the target file structure; determining the size information and position information of each of the page navigation controls on the HTML5 blank page according to the target parameters; and embedding each of the page navigation controls and the size information and position information corresponding to each of the page navigation controls into the HTML5 blank page to generate the target file preview page. In the above manner, the present application improves the convenience of file access by directly previewing files on the HTML5 page. In business scenarios such as fintech, the file preview page is quickly generated and a convenient navigation function is provided, thereby improving the flexibility of the file preview function in the fintech business field.
[0084] Based on any of the above embodiments, in this embodiment, before step S20, the following steps are included:
[0085] The HTML5 blank page is generated by presetting the HTML5 document structure and presetting the local area network WEB component.
[0086] In a specific embodiment, the HTML5 blank page is generated by presetting the HTML5 document structure and the presetting the local area network WEB component, including:
[0087] Defining the document type and viewport setting parameters of each preset HTML5 document through the HTML5 document structure;
[0088] Determining the preset WEB component that matches each of the preset HTML5 documents according to the document type and the viewport setting parameters;
[0089] Each of the preset WEB components is embedded in the preset HTML5 document, and the HTML5 blank page corresponding to each of the preset HTML5 documents is generated.
[0090] Specifically, based on the purpose and objectives of the HTML5 document, analyze which web components are needed to implement its functionality. For example, if the document is used to display a data report, a table component might be needed; if the document is used for user login, a form component might be needed. Based on the analysis results, select web components that comply with HTML5 standards.
[0091] Embed the selected WEB component into the appropriate location of the document as required, and add styles to the embedded WEB component to achieve the desired appearance and layout. For example, you can use inline styles, internal style sheets, or external style sheets to set styles.
[0092] See also Figure 4 , Figure 4 1 is a schematic block diagram of a file preview device provided by an embodiment of the present application, wherein the file preview device is used to execute the aforementioned file preview method.
[0093] like Figure 4 As shown, the file preview device 400 includes:
[0094] The file link parsing module 410 is used to parse the link of the file to be previewed and determine the target file structure and target parameters of the file to be previewed;
[0095] The preview page generating module 420 is configured to generate a target file preview page corresponding to the file to be previewed using a blank HTML5 page, the target structure, and the target parameters.
[0096] Furthermore, the file link parsing module 410 includes:
[0097] a coded character classification unit, configured to call a metadata interface of a preset file parsing library through a preset file parsing library, extract metadata fields of the file to be previewed, and classify the metadata fields into standard coded characters and non-standard coded characters;
[0098] A non-standard coded character conversion unit, configured to convert the non-standard coded characters to generate the standard coded characters;
[0099] The target file structure generating unit is used to parse each of the standard encoding characters to generate the target file structure.
[0100] Furthermore, the target file structure generating unit includes:
[0101] An OCR technology recognition subunit, configured to recognize text information, image information and / or table information of the standard coded characters by using optical character recognition (OCR) technology;
[0102] The target file structure determination subunit is configured to determine the text information, the image information and / or the table information as the target file structure.
[0103] Furthermore, the file link parsing module 410 includes:
[0104] a page information acquisition unit for a file to be previewed, configured to acquire information about the total number of pages of the file to be previewed, and to identify page size information and page orientation information of the file to be previewed;
[0105] The target parameter determination unit is configured to extract the encryption information and permission information of the file to be previewed, and determine the total number of pages, the page size, the page orientation, the encryption information and / or the permission information as the target parameters.
[0106] Furthermore, the preview page generation module 420 includes:
[0107] A page navigation control generating unit, configured to generate at least one page navigation control according to the target file structure;
[0108] A size and position information determining unit, configured to determine the size and position information of each of the page navigation controls on the HTML5 blank page according to the target parameter;
[0109] The target file preview page generating unit is used to embed each of the page navigation controls and the size information and position information respectively corresponding to each of the page navigation controls into the HTML5 blank page to generate the target file preview page.
[0110] Furthermore, the file preview device 400 includes:
[0111] The HTML5 blank page generation module is used to generate the HTML5 blank page through a preset HTML5 document structure and a preset local area network WEB component.
[0112] Furthermore, the HTML5 blank page generation module includes:
[0113] A document structure definition unit, configured to define the document type and viewport setting parameters of each preset HTML5 document through the HTML5 document structure;
[0114] A preset WEB component determining unit, configured to determine the preset WEB component matching each of the preset HTML5 documents according to the document type and the viewport setting parameters;
[0115] The HTML5 blank page generating unit is configured to embed each of the preset WEB components into the preset HTML5 document, and generate the HTML5 blank page corresponding to each of the preset HTML5 documents.
[0116] It should be noted that those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0117] The above-mentioned device can be realized in the form of a computer program. The computer program can be used in Figure 5 Runs on the computer equipment shown.
[0118] See also Figure 5 , Figure 5 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device may be a server.
[0119] See Figure 5 The computer device includes a processor, a memory, and a network interface connected through a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.
[0120] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any file preview method.
[0121] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0122] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any file preview method.
[0123] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0124] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
[0125] In one embodiment, the processor is configured to execute a computer program stored in the memory to implement the following steps:
[0126] Parsing the link of the file to be previewed, and determining the target file structure and target parameters of the file to be previewed;
[0127] A target file preview page corresponding to the file to be previewed is generated by using a fifth generation Hypertext Markup Language HTML5 blank page, the target structure and the target parameters.
[0128] In one embodiment, the link of the file to be previewed is parsed to determine the target file structure and target parameters of the file to be previewed, so as to achieve:
[0129] Calling a metadata interface of the preset file parsing library through the preset file parsing library to extract metadata fields of the file to be previewed, and dividing the metadata fields into standard coded characters and non-standard coded characters;
[0130] Converting the non-standard coded characters to generate the standard coded characters;
[0131] Parse each of the standard encoding characters to generate the target file structure.
[0132] In one embodiment, each of the standard encoding characters is parsed to generate the target file structure for implementing:
[0133] Recognize text information, image information and / or table information of the standard coded characters by optical character recognition (OCR) technology;
[0134] The text information, the image information and / or the table information are determined as the target file structure.
[0135] In one embodiment, the link of the file to be previewed is parsed to determine the target file structure and target parameters of the file to be previewed, so as to achieve:
[0136] Obtaining information about the total number of pages of the file to be previewed, and identifying page size information and page orientation information of the file to be previewed;
[0137] The encryption information and permission information of the file to be previewed are extracted, and the total number of pages, the page size, the page direction, the encryption information and / or the permission information are determined as the target parameters.
[0138] In one embodiment, a target file preview page corresponding to the file to be previewed is generated using a blank HTML5 page, the target structure, and the target parameters, to achieve:
[0139] generating at least one page navigation control according to the target file structure;
[0140] Determining size information and position information of each of the page navigation controls on the HTML5 blank page according to the target parameters;
[0141] According to each of the page navigation controls and the size information and position information respectively corresponding to each of the page navigation controls, they are embedded into the HTML5 blank page to generate the target file preview page.
[0142] In one embodiment, before generating a target file preview page corresponding to the file to be previewed using a blank HTML5 page, the target structure, and the target parameters, the following steps are implemented:
[0143] The HTML5 blank page is generated by presetting the HTML5 document structure and presetting the local area network WEB component.
[0144] In one embodiment, the HTML5 blank page is generated by presetting the HTML5 document structure and presetting the local area network WEB component to achieve:
[0145] Defining the document type and viewport setting parameters of each preset HTML5 document through the HTML5 document structure;
[0146] Determining the preset WEB component that matches each of the preset HTML5 documents according to the document type and the viewport setting parameters;
[0147] Each of the preset WEB components is embedded in the preset HTML5 document, and the HTML5 blank page corresponding to each of the preset HTML5 documents is generated.
[0148] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the processor executes the program instructions to implement any one of the file preview methods provided in the embodiments of the present application.
[0149] The computer-readable storage medium may be an internal storage unit of the computer device described in the aforementioned embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a SmartMedia Card (SMC), a Secure Digital (SD) card, a flash memory card, etc., equipped on the computer device.
[0150] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present application, and such modifications or substitutions should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims. Tags are used to create tables to display transaction details, and tags are used to insert images of customer signatures, etc. The extracted target parameters are populated into corresponding locations on the HTML5 page. For example, the customer's name is displayed in a specific location in the header, and the transaction amount and time are populated into corresponding cells in the transaction details table. In one embodiment, to further enhance the user experience, interactive features can be added to the preview page. For example, paging can be added to allow users to view file contents page by page; zoom in and out can be added to facilitate viewing of detailed information; and a download button can be added to allow users to download files. The preview page is style-optimized based on visual standards and user experience requirements in the financial business field. For example, a unified font style and color scheme can be set, and the layout and spacing of page elements can be adjusted to make the preview page more aesthetically pleasing and professional. This embodiment discloses a file preview method, which includes parsing a link to a file to be previewed, determining a target file structure and target parameters for the file to be previewed; and generating a target file preview page corresponding to the file to be previewed using a blank HTML5 page, the target structure, and the target parameters. In the above manner, the present application provides custom styles and tools for different files by parsing file links and determining the target file structure and target parameters. In view of the strong application compatibility of HTML5 technology, it can flexibly generate corresponding preview pages according to different file structures and parameters to meet the preview requirements of files of various formats and contents. It has strong versatility and adaptability, thereby improving the flexibility of the file preview function in the financial technology business field. Please refer to the schematic flow chart of a file preview method provided by the second embodiment of the present application. The file preview method can be applied to a server, using a preset file parsing library to accurately extract the metadata field in the file to be previewed, and convert the non-standard coded characters in the metadata field into standard coded characters, thereby improving the compatibility of the metadata field, improving the usability of the file, and thereby improving the flexibility of the file preview function in the financial technology business field. Based on the illustrated embodiment, as shown in this embodiment, step S10 includes steps S101 to S103. Step S101: Calling a metadata interface of a preset file parsing library through a preset file parsing library to extract metadata fields of the file to be previewed, and dividing the metadata fields into standard coded characters and non-standard coded characters. Specifically, extracting required metadata fields, such as author, title, creation date, modification date, etc., from the result returned by calling the metadata interface. Dividing the characters in the extracted metadata fields to distinguish standard coded characters from non-standard coded characters.Standard coded characters generally refer to those that conform to the ASCII (American Standard Code for Information Interchange) encoding standard, such as letters, numbers, and common symbols. Non-standard coded characters include special characters, symbols, and possibly garbled characters. Step S102: Convert the non-standard coded characters to generate the standard coded characters. Specifically, the non-standard coded characters are identified by examining the character's code value. For example, the ASCII code range is 0 to 127. If a character's code value exceeds this range, it is determined to be a non-standard coded character and converted to a standard coded character. Specifically, a character mapping table can be created to map non-standard coded characters to corresponding standard coded characters. For example, certain special symbols can be mapped to common symbols or character strings. Step S103: Parse the standard coded characters to generate the target file structure. Specifically, the converted standard coded characters are parsed and organized into structured information. For example, the standard coded characters in the extracted metadata field may include file title, author information, creation date, and other information. This information can be obtained by parsing the character sequence. Based on the parsed information, the target file structure is generated. The target file structure may include constructing a data structure containing file information, generating a text file summary, or creating a metadata report, etc. For example, the file title, author, and creation date may be stored in a dictionary for subsequent display and processing. This embodiment discloses a file preview method, which includes calling the metadata interface of the preset file parsing library through a preset file parsing library, extracting the metadata field of the file to be previewed, and dividing the metadata field into standard coded characters and non-standard coded characters; converting the non-standard coded characters to generate the standard coded characters; parsing each of the standard coded characters to generate the target file structure and target parameters; and generating a target file preview page corresponding to the file to be previewed through a blank page of the fifth-generation hypertext markup language HTML5, the target structure, and the target parameters. In the above manner, the present application utilizes the preset file parsing library to accurately extract the metadata fields in the file and convert the non-standard coded characters in the metadata fields into standard coded characters, thereby improving the compatibility of the metadata fields, improving the usability of the files, and thereby improving the flexibility of the file preview function in the fintech business field. Based on the illustrated embodiment, in this embodiment, step S103 includes: identifying the text information, image information and / or table information of the standard coded characters through optical character recognition (OCR) technology; and determining the text information, the image information and / or the table information as the target file structure.In one embodiment, the detected text area is segmented to separate connected text, ensuring that each character can be individually recognized. The segmented individual characters are then recognized based on machine learning or pattern recognition techniques, such as recurrent neural networks or long-short-term memory networks. For tabular information, the table is first located in the image. The row and column structure of the table is then analyzed to determine the boundaries of each cell. The characters within each cell are then recognized and converted to text format. Finally, the table structure is restored to generate editable tabular data. For non-textual information in the image, such as graphics and charts, image recognition technology can be used for classification and recognition. Feature extraction and pattern matching are used to determine the image type and content, such as identifying a financial product trend chart or organizational chart. The identified text, image, and tabular information are then integrated and organized according to a specific logical order and structure. For example, the text content can be divided into structures such as paragraphs and chapters, and images and tables can be inserted into the corresponding locations. Based on the integrated information, a target file structure is generated. The target file structure can be in various file formats, such as text files, HTML files, and JSON (JavaScript Object Notation) files, to facilitate subsequent storage, retrieval, and display. For example, text, images, and table information can be stored in a single JSON file. Based on the illustrated embodiment, in this embodiment, step S10 further includes: obtaining the total number of pages of the file to be previewed, identifying the page size and page orientation information of the file to be previewed; extracting encryption information and permission information of the file to be previewed, and determining the total number of pages, the page size, the page orientation, the encryption information, and / or the permission information as the target parameters. In a specific embodiment, for each page for which dimension information needs to be extracted, the corresponding page object is obtained, and the width and height information is extracted from the page object. The page orientation is determined based on the extracted page width and height. Common page orientations are landscape and portrait. When the page width is greater than or equal to the height, the page is landscape; conversely, when the width is less than the height, the page is portrait. Use the preset file parsing tool to check whether the file to be previewed is encrypted. If the previewed PDF file is encrypted, you can further obtain the encrypted permission information and parse the specific permission content, such as whether printing is allowed, whether editing is allowed, etc., based on the permission information data structure provided by the tool. The permission data storage method of different tools and file versions may be different, and it needs to be parsed according to the actual situation. Please refer to the schematic flow chart of a file preview method provided in the third embodiment of this application. The file preview method can be applied to the server to improve the convenience of file access by directly previewing the file on the HTML5 page.In business scenarios such as fintech, the file preview page is quickly generated and convenient navigation functions are provided, which improves the flexibility of the file preview function in the fintech business field. Based on the illustrated embodiment, this embodiment is shown as follows: Step S20 includes Steps S201 to S203. Step S201: Generate at least one page navigation control based on the target file structure; specifically, create one or more container elements in an HTML5 blank page for placing the page navigation control. For example, you can use
Claims
1. A file preview method, characterized in that: include: Parsing the link of the file to be previewed, and determining the target file structure and target parameters of the file to be previewed; A target file preview page corresponding to the file to be previewed is generated through a fifth generation Hypertext Markup Language HTML5 blank page, the target structure and the target parameters.
2. The file preview method according to claim 1, wherein: The step of parsing the link of the file to be previewed and determining the target file structure and target parameters of the file to be previewed includes: Calling a metadata interface of the preset file parsing library through the preset file parsing library to extract metadata fields of the file to be previewed, and dividing the metadata fields into standard coded characters and non-standard coded characters; Converting the non-standard coded characters to generate the standard coded characters; Parse each of the standard encoding characters to generate the target file structure.
3. The file preview method according to claim 2, characterized in that: The step of parsing the standard coded characters to generate the target file structure includes: Recognize text information, image information and / or table information of the standard coded characters by optical character recognition (OCR) technology; The text information, the image information and / or the table information are determined as the target file structure.
4. The file preview method according to claim 1, wherein: The step of parsing the link of the file to be previewed and determining the target file structure and target parameters of the file to be previewed includes: Obtaining information about the total number of pages of the file to be previewed, and identifying page size information and page orientation information of the file to be previewed; The encryption information and permission information of the file to be previewed are extracted, and the total number of pages, the page size, the page direction, the encryption information and / or the permission information are determined as the target parameters.
5. The file preview method according to claim 1, wherein: The step of generating a target file preview page corresponding to the file to be previewed by using a blank page of the fifth generation Hypertext Markup Language (HTML5), the target structure, and the target parameters includes: generating at least one page navigation control according to the target file structure; Determining size information and position information of each of the page navigation controls on the HTML5 blank page according to the target parameters; According to each of the page navigation controls and the size information and position information respectively corresponding to each of the page navigation controls, they are embedded into the HTML5 blank page to generate the target file preview page.
6. The file preview method according to any one of claims 1 to 5, characterized in that: Before generating a target file preview page corresponding to the file to be previewed using the fifth generation Hypertext Markup Language HTML5 blank page, the target structure, and the target parameters, the method includes: The HTML5 blank page is generated by presetting the HTML5 document structure and presetting the local area network WEB component.
7. The file preview method according to claim 6, characterized in that: The method of generating the HTML5 blank page by presetting the HTML5 document structure and the presetting the local area network WEB component includes: Defining the document type and viewport setting parameters of each preset HTML5 document through the HTML5 document structure; Determining the preset WEB component that matches each of the preset HTML5 documents according to the document type and the viewport setting parameters; Each of the preset WEB components is embedded in the preset HTML5 document, and the HTML5 blank page corresponding to each of the preset HTML5 documents is generated.
8. A file preview device, characterized in that: include: A file link parsing module, configured to parse the link of a file to be previewed and determine the target file structure and target parameters of the file to be previewed; The preview page generation module is used to generate a target file preview page corresponding to the file to be previewed by using a blank page of the fifth generation hypertext markup language HTML5, the target structure and the target parameters.
9. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is configured to execute the computer program and implement the file preview method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, enables the processor to implement the file preview method according to any one of claims 1 to 7.