CN111767491B - Method and system for analyzing and displaying OFD (OFD) document based on browser - Google Patents

Method and system for analyzing and displaying OFD (OFD) document based on browser Download PDF

Info

Publication number
CN111767491B
CN111767491B CN202010615139.2A CN202010615139A CN111767491B CN 111767491 B CN111767491 B CN 111767491B CN 202010615139 A CN202010615139 A CN 202010615139A CN 111767491 B CN111767491 B CN 111767491B
Authority
CN
China
Prior art keywords
ofd
document
browser
rendering
layer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010615139.2A
Other languages
Chinese (zh)
Other versions
CN111767491A (en
Inventor
梁烨慧
魏鹏
刘海洋
施筱璐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Tiangu Information Technology Co ltd
Original Assignee
Hangzhou Tiangu Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Tiangu Information Technology Co ltd filed Critical Hangzhou Tiangu Information Technology Co ltd
Priority to CN202010615139.2A priority Critical patent/CN111767491B/en
Publication of CN111767491A publication Critical patent/CN111767491A/en
Application granted granted Critical
Publication of CN111767491B publication Critical patent/CN111767491B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/106Display of layout of documents; Previewing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Document Processing Apparatus (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention provides a method and a system for analyzing and displaying an OFD document based on a browser. The interface layer provides OFD document analysis and rendering capability for external calling; the rendering layer provides rendering capabilities of text, pictures, graphics and the like based on canvas; the analysis layer provides the analysis capability of OFD documents, pages, fonts, pictures, seals and the like; the file layer provides the reading and decompression capabilities of remote and local OFD documents. The system can be completely separated from a server end to independently operate, can quickly check local and remote OFD files, can complete the analysis and rendering of the OFD files at a browser end, can support the analysis and rendering of the OFD files in an asynchronous mode as required, and can improve the opening speed of large files.

Description

Method and system for analyzing and displaying OFD (OFD) document based on browser
Technical Field
The invention relates to an OFD reading method and system, in particular to a browser-based method and system for analyzing and displaying OFD documents.
Background
The national standard management committee officially approves and issues the national standard GB/T33190-2016 electronic File storage and exchange Format document (OFD for short) based on autonomous technology on the world standard day of 10 months and 14 days of 2016. The format document is an electronic document with a fixed layout presentation effect, the presentation effect of the electronic document is independent of a software and hardware platform, and the electronic document has stronger consistency when being read, printed or printed on various devices. The current application range of the format electronic file is increasingly wide, and the format electronic file becomes an important component of the national strategic resource of the electronic file, so that the format of the format document is called as digital paper in the computer age, and in the current age, technical support of the format document is required for electronic commerce, electronic business, information release, file exchange, file management and the like, so that the format document format is inevitably dependent.
At present, the standard is supported by the major domestic office software manufacturer and format manufacturer, and various products of Windows, linux and mobile platforms are developed. The OFD standard describes the format based on XML, is convenient for application expansion, and supports technical advantages of domestic cryptographic algorithm and the like. The method can meet the actual requirements of electronic file management such as manageability, controllability, long-term storage and the like of format files.
The current OFD document opening mode is that a special reader is used for opening, and when online reading is performed, a server is arranged, and relevant display information is returned from the server.
For example, the publication number of the patent application is CN107943915A, and the invention is an online display method and device of an OFD file based on HTML 5; the patent application publication number is CN201911018601, the invention is a method and a system for browsing an OFD document web page end, and the main defects of the method and the system by arranging a server end are as follows: (1) A set of service ends are required to be deployed, and the deployment and maintenance cost is high; (2) The server decompresses and analyzes the OFD document, converts the OFD document into a data structure required by the browser, and the server pressure is high under the condition of large document and high concurrence.
Disclosure of Invention
The invention provides a method and a system for analyzing and displaying an OFD document based on a browser, which solve the reading problem of the OFD document and have the following technical scheme:
A browser-based OFD document analysis display system comprises an interface layer, a rendering layer, an analysis layer and a file layer.
The interface layer comprises getDocument interfaces, getPage interfaces, getSignatures interfaces and render interfaces and is used for providing OFD document analysis and rendering capabilities for external calls;
The rendering layer is connected with a render interface of the interface layer and provides rendering capability of texts, pictures, graphics and the like based on canvas;
The analysis layer is connected with getPage interfaces and getSignatures interfaces of the interface layer and provides analysis capability of OFD documents, pages, fonts, pictures and seals;
The file layer is connected with getDocument interfaces of the interface layer and provides reading and decompression capabilities of remote and local OFD documents.
The system is a set of OFD document analysis and display system written by using JavaScript programming language, and can be called by browser page integration through an < script > tag of HTML.
The method for analyzing and displaying the OFD document based on the browser of the system comprises the following steps:
s1: reading a remote or local OFD document by using a getDocument interface;
s2: the system reads the file stream, decompresses the OFD document and caches the OFD document in the memory;
s3: the system analyzes page structure information, document level and public level resources of the decompressed OFD document, and returns the OFD basic data to a calling party;
s4: the user calls getPage an interface according to the returned page structure information by the page dimension, analyzes the OFD page content, and returns the analyzed page data to the user;
s5: the user calls getSignatures an interface according to the returned page data, analyzes seal information in the OFD document and returns the seal information to the calling party;
S6: and the user invokes a render interface of the system to draw the text, the picture, the graphics and other elements in the OFD document onto the browser according to the returned page data.
Further, the text rendering of the render includes the steps of:
s11: if the page data uses the font resource, searching the analyzed fonts in the browser cache, and if the cache hits, jumping to the step S13; if the cache does not hit, continuing to step S12;
S12: searching a corresponding font resource file in the OFD resource, analyzing the font resource file, storing the font resource file in a browser cache, and supporting a WOFF, OTF, TTF format;
S13: text is drawn using the font file.
Further, the rendering of the picture of the render includes the steps of:
s21: if the image is used in the page data, searching a corresponding image resource file in the OFD resource, if the image is in an image format supported by a browser, creating an HTMLImageelement object, and drawing the HTMLImageelement to a target canvas by using a canvas of HTML 5;
S22: if the picture is in a picture format which is not supported by the browser, decoding corresponding picture data by using different picture decoders, creating a temporary HTMLCANVASELEMENT, drawing the decoded picture data on the temporary HTMLCANVASELEMENT, and drawing HTMLCANVASELEMENT to a target canvas by using a canvas of the HTML 5;
s23: other page data is drawn to the target canvas using the canvas of HTML 5.
The invention has the following advantages:
1. the browser end directly analyzes the OFD document, and the OFD document is not required to be analyzed through the server end, so that the method is lighter;
2. the browser side caches the document data, so that the analysis pressure of the browser is reduced;
3. The local OFD file can be directly checked, and the OFD file does not need to be uploaded to a server side.
Drawings
FIG. 1 is an architecture diagram of the system for browser-based OFD document parsing presentation;
FIG. 2 is a flow diagram of a method for browser-based OFD document parsing presentation;
FIG. 3 is a flowchart illustrating the use of text and pictures by a render;
fig. 4 is a schematic overall flow diagram combining fig. 2 and 3.
Detailed Description
In order to achieve the purpose of reading an OFD document by a browser, the invention provides a lightweight method and a lightweight system for analyzing and displaying the OFD document based on the browser.
As shown in FIG. 1, the system for analyzing and displaying the OFD document based on the browser is a set of OFD document analyzing and displaying system written by using a JavaScript programming language, and can be integrally called by a browser page through an HTML < script > tag.
The system comprises an interface layer, a rendering layer, an analysis layer and a file layer.
The interface layer comprises getDocument interfaces, getPage interfaces, getSignatures interfaces and render interfaces and is used for providing OFD document analysis and rendering capabilities for external calls;
The rendering layer is connected with a render interface of the interface layer, and provides rendering capability of texts, pictures, graphics and the like based on a canvas of the HTML5 (a canvas label of the browser provides the capability of drawing graphic images on a webpage);
The analysis layer is connected with getPage interfaces and getSignatures interfaces of the interface layer and provides analysis capability of OFD documents, pages, fonts, pictures, seals and the like;
The file layer is connected with getDocument interfaces of the interface layer and provides reading and decompression capabilities of remote and local OFD documents.
The system can be completely separated from a server end to independently operate, can quickly check local and remote OFD files, can complete the analysis and rendering of the OFD files at a browser end, can support the analysis and rendering of the OFD files in an asynchronous mode as required, and can improve the opening speed of large files.
As shown in fig. 2, on the basis of a system for analyzing and displaying an OFD document based on a browser, a corresponding method for analyzing and displaying an OFD document based on a browser comprises the following steps:
s1: reading a remote or local OFD document by using a getDocument interface;
s2: the system reads the file stream, decompresses the OFD document and caches the OFD document in the memory;
S3: the system analysis layer acquires page structure information, document level and public level resources of the decompressed OFD document from the memory, and returns the OFD basic data to the calling party; the analysis layer is responsible for analyzing files such as xml, fonts (including WOFF, OTF, TTF and other font formats), pictures (including bmp, png, jpg, gif, jb2, jp2 and other picture formats), seals and the like in the OFD document;
s4: the user calls getPage an interface according to the returned page structure information by the page dimension, analyzes the OFD page content, and returns the analyzed page data to the user;
S5: the user can analyze seal information in the OFD document and return the seal information to the caller by calling getSignatures interfaces according to the returned page data, and the seal specification supports the technical specifications of national government service platform standards C0120-2018 and the security electronic signature password industry standards GM/T0031-2014 of the people's republic of China;
S6: and the user invokes a render interface of the system to draw the text, the picture, the graphics and other elements in the OFD document onto the browser according to the returned page data.
As shown in fig. 3, further, the text rendering of the render uses the following steps:
s11: if the page data uses the font resource, searching the analyzed fonts in the browser cache, and if the cache hits, jumping to the step S13; if the cache does not hit, continuing to step S12;
S12: searching a corresponding font resource file in the OFD resource, analyzing the font resource file, storing the font resource file in a browser cache, and supporting a WOFF, OTF, TTF format;
S13: text is drawn using the font file.
The picture rendering using steps of the render are as follows:
s21: if the image is used in the page data, searching a corresponding image resource file in the OFD resource, if the image is in an image format supported by a browser, creating an HTMLImageelement object, and drawing the HTMLImageelement to a target canvas by using a canvas of HTML 5;
S22: if the picture is in a picture format which is not supported by the browser, decoding corresponding picture data by using different picture decoders, creating a temporary HTMLCANVASELEMENT, drawing the decoded picture data on the temporary HTMLCANVASELEMENT, and drawing HTMLCANVASELEMENT to a target canvas by using a canvas of the HTML 5;
s23: other page data is drawn to the target canvas using the canvas of HTML 5.
Finally, the content of fig. 3 is embedded in fig. 2, forming the overall flow diagram of fig. 4.
The method and the device can be separated from a server to independently operate, can conveniently browse local OFD files, and do not need to upload the files to the server; the asynchronous loading analysis mode is adopted, so that the waiting time of a user is reduced; and the page is rendered according to the requirement, so that the performance of the system can be greatly improved for the oversized OFD document.

Claims (1)

1. The method for analyzing and displaying the OFD document based on the browser comprises an interface layer, a rendering layer, an analyzing layer and a file layer;
The interface layer comprises getDocument interfaces, getPage interfaces, getSignatures interfaces and render interfaces and is used for providing OFD document analysis and rendering capabilities for external calls;
The rendering layer is connected with a render interface of the interface layer and provides rendering capability of texts, pictures and graphics based on canvas;
The analysis layer is connected with getPage interfaces and getSignatures interfaces of the interface layer and provides analysis capability of OFD documents, pages, fonts, pictures and seals;
the file layer is connected with getDocument interfaces of the interface layer and provides reading and decompression capabilities of remote and local OFD documents;
the browser end directly analyzes the OFD document without analyzing the OFD document by the server end, and the method comprises the following steps:
s1: reading a remote or local OFD document by using a getDocument interface;
s2: the system reads the file stream, decompresses the OFD document and caches the OFD document in the memory;
s3: the system analyzes page structure information, document level and public level resources of the decompressed OFD document, and returns the OFD basic data to a calling party;
s4: the user calls getPage an interface according to the returned page structure information by the page dimension, analyzes the OFD page content, and returns the analyzed page data to the user;
s5: the user calls getSignatures an interface according to the returned page data, analyzes seal information in the OFD document and returns the seal information to the calling party;
s6: according to the returned page data, the user invokes a render interface of the system to draw text, pictures and graphic elements in the OFD document to a browser;
the text rendering of the render includes the steps of:
s11: if the page data uses the font resource, searching the analyzed fonts in the browser cache, and if the cache hits, jumping to the step S13; if the cache does not hit, continuing to step S12;
S12: searching a corresponding font resource file in the OFD resource, analyzing the font resource file, storing the font resource file in a browser cache, and supporting a WOFF, OTF, TTF format;
S13: drawing a text by using the font file;
the rendering of the picture of the render comprises the following steps:
S21: if the image is used in the page data, searching a corresponding image resource file in the OFD resource, if the image is in an image format supported by a browser, creating an HTMLImageelement object, and drawing the HTMLImageelement to a target canvas by using a canvas of HTML 5;
S22: if the picture is in a picture format which is not supported by the browser, decoding corresponding picture data by using different picture decoders, creating a temporary HTMLCANVASELEMENT, drawing the decoded picture data on the temporary HTMLCANVASELEMENT, and drawing HTMLCANVASELEMENT to a target canvas by using a canvas of the HTML 5;
s23: other page data is drawn to the target canvas using the canvas of HTML 5.
CN202010615139.2A 2020-06-30 2020-06-30 Method and system for analyzing and displaying OFD (OFD) document based on browser Active CN111767491B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010615139.2A CN111767491B (en) 2020-06-30 2020-06-30 Method and system for analyzing and displaying OFD (OFD) document based on browser

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010615139.2A CN111767491B (en) 2020-06-30 2020-06-30 Method and system for analyzing and displaying OFD (OFD) document based on browser

Publications (2)

Publication Number Publication Date
CN111767491A CN111767491A (en) 2020-10-13
CN111767491B true CN111767491B (en) 2024-07-26

Family

ID=72723530

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010615139.2A Active CN111767491B (en) 2020-06-30 2020-06-30 Method and system for analyzing and displaying OFD (OFD) document based on browser

Country Status (1)

Country Link
CN (1) CN111767491B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112487335A (en) * 2020-12-03 2021-03-12 江苏中威科技软件系统有限公司 OFD file reading method based on browser
CN114676097A (en) * 2020-12-25 2022-06-28 航天信息股份有限公司企业服务分公司 A kind of OFD file processing method, device, equipment and medium
CN113296774B (en) * 2021-06-16 2024-06-14 北京数科网维技术有限责任公司 Processing method and system of OFD file based on browser
CN113535647A (en) * 2021-06-29 2021-10-22 福昕鲲鹏(北京)信息科技有限公司 A method and system for paging rendering of OFD files
CN114118007B (en) * 2021-12-02 2022-07-08 江苏中威科技软件系统有限公司 Method for converting format data stream file into OFD file
CN114356507A (en) * 2022-01-13 2022-04-15 深圳睿品通信息科技有限公司 Method, device and equipment for processing document based on browser and storage medium
CN114444444A (en) * 2022-01-20 2022-05-06 浪潮软件集团有限公司 Method for converting html file into picture file based on domestic CPU environment
CN114841125B (en) * 2022-04-20 2024-08-30 厦门稿定股份有限公司 AI format file processing method, AI format file processing device and storage medium
CN114791989B (en) * 2022-05-26 2025-09-26 厦门稿定股份有限公司 A browser-based PSD file parsing method, system, and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101833542A (en) * 2010-04-21 2010-09-15 中兴通讯股份有限公司 Method and device for rendering fonts of user interface
CN110134922A (en) * 2018-02-02 2019-08-16 鼎复数据科技(北京)有限公司 A method of table content in PDF is directly acquired by browser
CN110765385A (en) * 2019-10-24 2020-02-07 北京华宇信息技术有限公司 Method and system for browsing OFD document webpage end
CN111198999A (en) * 2020-01-03 2020-05-26 北京字节跳动网络技术有限公司 Method, device, medium and electronic equipment for loading pictures of webpage end

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150161277A1 (en) * 2011-03-14 2015-06-11 Browsium, Inc. Methods and systems for one browser version to use a rendering engine of another browser version for displaying information
US9098228B2 (en) * 2013-01-02 2015-08-04 International Business Machines Corporation Determining content rendering capabilities for web browser optimization
CN104346322B (en) * 2013-08-08 2018-07-10 北大方正集团有限公司 Document format processing unit and document format processing method
CN107943915B (en) * 2017-11-20 2020-05-08 福建亿榕信息技术有限公司 Method and device for OFD (office file) online display based on HTML5
CN109815451B (en) * 2018-12-13 2023-08-22 方正璞华软件(武汉)股份有限公司 PDF (Portable document Format) generation method, device and equipment
CN110851092A (en) * 2019-11-15 2020-02-28 厦门商集网络科技有限责任公司 Customized printing method and system based on printing template under B/S framework

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101833542A (en) * 2010-04-21 2010-09-15 中兴通讯股份有限公司 Method and device for rendering fonts of user interface
CN110134922A (en) * 2018-02-02 2019-08-16 鼎复数据科技(北京)有限公司 A method of table content in PDF is directly acquired by browser
CN110765385A (en) * 2019-10-24 2020-02-07 北京华宇信息技术有限公司 Method and system for browsing OFD document webpage end
CN111198999A (en) * 2020-01-03 2020-05-26 北京字节跳动网络技术有限公司 Method, device, medium and electronic equipment for loading pictures of webpage end

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
PDF.js实现个性化PDF渲染(文本复制);庞小明;https://cloud.tencent.com/developer/article/1432749;第1-4页 *

Also Published As

Publication number Publication date
CN111767491A (en) 2020-10-13

Similar Documents

Publication Publication Date Title
CN111767491B (en) Method and system for analyzing and displaying OFD (OFD) document based on browser
JP4192150B2 (en) Presentation of HTML content on the small screen terminal display
US10261983B2 (en) Method and device for webpage browsing, and mobile terminal
US8707164B2 (en) Integrated document viewer
US8923651B2 (en) Data system and method
US8648858B1 (en) Hybrid text and image based encoding
CN100356372C (en) Generating method of computer format document and opening method
CN104156207A (en) File display method and device
CN110717127A (en) Method and device for on-line analysis and browsing of OFD (office file)
US20080091784A1 (en) Converting a text-based email message to an email message including image-based fonts
CN117875263B (en) Reading method of DLF dynamic format file
CN101697157A (en) Electronic document browse processing method and system
CN109815451B (en) PDF (Portable document Format) generation method, device and equipment
US10600212B2 (en) Extracting color schemes of pages written in a markup language
JP2023537767A (en) Image processing method and apparatus, and computer-readable storage medium
CN112487763A (en) SVG-based OFD file online display method, server side and system
CN105956133B (en) Method and device for displaying file on intelligent terminal
CN117093386B (en) Page screenshot method, device, computer equipment and storage medium
CN116578795A (en) Webpage generation method and device, storage medium and electronic equipment
CN112328930B (en) Webpage rendering method, server, client and system based on cobalt
CN115329720B (en) A document display method, apparatus, device, and storage medium
CN102099806A (en) Information output device, information output method, and recording medium
CN114676097A (en) A kind of OFD file processing method, device, equipment and medium
CN112287263A (en) Webpage display method, device, system, terminal and computer readable storage medium
CN116701806B (en) Page display processing method and device, terminal and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant