CN112612978A - File online browsing method based on browser - Google Patents

File online browsing method based on browser Download PDF

Info

Publication number
CN112612978A
CN112612978A CN202011495271.0A CN202011495271A CN112612978A CN 112612978 A CN112612978 A CN 112612978A CN 202011495271 A CN202011495271 A CN 202011495271A CN 112612978 A CN112612978 A CN 112612978A
Authority
CN
China
Prior art keywords
file
pdf
type
browser
acquiring
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.)
Pending
Application number
CN202011495271.0A
Other languages
Chinese (zh)
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.)
Shandong Inspur Business System Co Ltd
Original Assignee
Shandong Inspur Business System 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 Shandong Inspur Business System Co Ltd filed Critical Shandong Inspur Business System Co Ltd
Priority to CN202011495271.0A priority Critical patent/CN112612978A/en
Publication of CN112612978A publication Critical patent/CN112612978A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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
    • G06F16/9577Optimising the visualization of content, e.g. distillation of HTML documents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation

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)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The invention provides a method for browsing files on line based on a browser, which belongs to the technical field of internet on-line browsing and comprises the following steps: 1) file acquisition, 2) file type identification, 3) file conversion, and 4) paging the converted PDF; 5) and (6) previewing the file. The invention can realize the on-line browsing of common office type files without installing plug-ins at the front end.

Description

File online browsing method based on browser
Technical Field
The invention relates to an internet online browsing technology, in particular to a file online browsing method based on a browser.
Background
Today, people are working, studying and living with more and more frequent use of the internet. Files on the internet are transmitted and shared on line more frequently, and one common scenario is online browsing and viewing of shared documents.
At present, the traditional document data sharing and viewing method has three modes:
the method has the advantages that firstly, a document data downloading function is provided, documents are downloaded and viewed locally, the method needs a client to locally install viewing application programs corresponding to the documents, such as Office, WPS and other software, and document copyright problems can be caused;
secondly, a third-party plug-in is installed locally, different versions of different browsers need to be installed by the third-party plug-in, and a user selects the corresponding versions to adapt, so that the operation is relatively complicated, and errors are easy to occur;
thirdly, converting document data into a PDF (document format) text from a background, converting the PDF file into a swf file, displaying the swf file by means of a swf plug-in of a third party of a browser to achieve an online browsing effect, wherein the speed of the method is relatively slow, the data distortion phenomenon is increased along with the increase of conversion times in the conversion process, and the swf plug-in is required to be installed during front-end display, so that the overall effect is not good.
Disclosure of Invention
In order to solve the technical problems, the invention provides a file online browsing method based on a browser, which can realize online browsing of common office type files and does not need to install a plug-in at the front end. The supported file types include Txt, Word, Excel, PPT, etc.
The technical scheme of the invention is as follows:
a method for browsing files on line based on a browser,
the method comprises the following steps:
1) acquiring a file, namely acquiring a file uploaded by a user or a stored file;
2) identifying the file type, and acquiring a suffix name of the file to judge the type of the file;
3) converting the file, namely converting the file into a PDF file through an Aspose toolkit;
4) paging the converted PDF;
5) and previewing the file, setting a response type, returning the converted file to the foreground, and realizing online browsing of the file in a browser.
Further, in the above-mentioned case,
the supported file types include Txt, Word, Excel, PPT.
In a still further aspect of the present invention,
the method comprises the following specific steps:
1) acquiring a file uploaded by a user or a stored file;
2) identifying the uploaded File type, and dynamically acquiring a suffix name of the File through a Java File class;
3) the three packaging methods are respectively wordToPDF, excelToPDF and pptToPDF by using an Aspose tool class, so that the conversion of Word, Excel and PPT into PDF is realized;
4) after the file conversion is finished, judging the size of the converted PDF file, and if the page number of the file exceeds a set page, paging the PDF file by using itextPDF;
5) when a user initiates an online browsing request, response header information is set according to different types of files, the response header information of the Txt file is set to be text/play, the response header information of the PDF file type is set to be application/PDF, and the front end displays the converted file by using a browser.
In a still further aspect of the present invention,
and judging the type according to the identified file suffix name. If the suffix of the file is a Word type file of doc or docx, calling a wordToPDF method to convert the file into a PDF file.
If the file is subsequently an Excel file of xls or xlsx, an excelToPDF method is called to convert the file into a PDF file.
If the file suffix is ppT or pptx, the pptToPDF method is called to convert the file into a PDF file.
If the file type is a text file of txt, no processing is performed.
The invention has the advantages that
1. A third-party plug-in is not required to be installed at the client of the user, so that the requirement on the environment of the client is reduced, the configuration of the user on the client is reduced, and the user can conveniently and directly use a browser to browse files online;
2. the efficiency is high, the pressure on the server is less, the server does not need to convert the PDF file into a file with an SWf format, and the previewing effect can be achieved by performing file conversion on the uploaded file for one time;
3. the probability of data distortion is less, and the data effectiveness is higher because one conversion is omitted;
4. the file does not need to be downloaded to the local, so that the security of the file is improved.
Drawings
FIG. 1 is a schematic workflow diagram of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer and more complete, the technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention, and based on the embodiments of the present invention, all other embodiments obtained by a person of ordinary skill in the art without creative efforts belong to the scope of the present invention.
The invention realizes the following specific steps: see figure 1.
The method comprises the following specific steps:
1. and acquiring the file uploaded by the user or the stored file.
2. Identifying the uploaded File type, and dynamically acquiring a suffix name of the File through a Java File class;
3. and (3) using an Aspose tool class to package the wordToPDF, the excelToPDF and the pptToPDF respectively, so that the conversion of Word, Excel and PPT into PDF is realized.
Carrying out type judgment according to the identified file suffix name, and calling a wordToPDF method to convert the file into a PDF file if the file suffix is a Word type file of doc or docx; if the file is subsequently an Excel file of xls or xlsx, calling an excelToPDF method to convert the file into a PDF file; if the suffix of the file is PPT or pptx, calling a pptToPDF method to convert the file into a PDF file; if the file type is a text file of txt, no processing is performed.
4. After the file conversion is finished, judging the size of the converted PDF file, if the page number of the file exceeds 10 pages, paging the PDF file by using itextPDF, so as to improve the efficiency of front-end first-screen loading.
5. When a user initiates an online browsing request, response header information is set according to different types of files, the response header information of an Txt file is set to be text/play, the response header information of a PDF file type is set to be application/PDF, and a front end displays the converted file by using a browser.
The above description is only a preferred embodiment of the present invention, and is only used to illustrate the technical solutions of the present invention, and not to limit the protection scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (8)

1. A method for browsing files on line based on a browser is characterized in that,
the method comprises the following steps:
1) acquiring a file, namely acquiring a file uploaded by a user or a stored file;
2) identifying the file type, and acquiring a suffix name of the file to judge the type of the file;
3) converting the file, namely converting the file into a PDF file through an Aspose toolkit;
4) paging the converted PDF;
5) and previewing the file, setting a response type, returning the converted file to the foreground, and realizing online browsing of the file in a browser.
2. The method of claim 1,
the supported file types include Txt, Word, Excel, PPT.
3. The method of claim 2,
the method comprises the following specific steps:
1) acquiring a file uploaded by a user or a stored file;
2) identifying the uploaded File type, and dynamically acquiring a suffix name of the File through a Java File class;
3) the three packaging methods are respectively wordToPDF, excelToPDF and pptToPDF by using an Aspose tool class, so that the conversion of Word, Excel and PPT into PDF is realized;
4) after the file conversion is finished, judging the size of the converted PDF file, and if the page number of the file exceeds a set page, paging the PDF file by using itextPDF;
5) when a user initiates an online browsing request, response header information is set according to different types of files, the response header information of the Txt file is set to be text/play, the response header information of the PDF file type is set to be application/PDF, and the front end displays the converted file by using a browser.
4. The method of claim 3,
and judging the type according to the identified file suffix name.
5. The method of claim 4,
if the suffix of the file is a Word type file of doc or docx, calling a wordToPDF method to convert the file into a PDF file.
6. The method of claim 4,
if the file is subsequently an Excel file of xls or xlsx, an excelToPDF method is called to convert the file into a PDF file.
7. The method of claim 4,
if the file suffix is ppT or pptx, the pptToPDF method is called to convert the file into a PDF file.
8. The method of claim 4,
if the file type is a text file of txt, no processing is performed.
CN202011495271.0A 2020-12-17 2020-12-17 File online browsing method based on browser Pending CN112612978A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011495271.0A CN112612978A (en) 2020-12-17 2020-12-17 File online browsing method based on browser

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011495271.0A CN112612978A (en) 2020-12-17 2020-12-17 File online browsing method based on browser

Publications (1)

Publication Number Publication Date
CN112612978A true CN112612978A (en) 2021-04-06

Family

ID=75240124

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011495271.0A Pending CN112612978A (en) 2020-12-17 2020-12-17 File online browsing method based on browser

Country Status (1)

Country Link
CN (1) CN112612978A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102651744A (en) * 2012-05-04 2012-08-29 华为技术有限公司 E-mail security management method and E-mail server
CN103729338A (en) * 2013-12-29 2014-04-16 国云科技股份有限公司 File on-line previewing method
CN106790459A (en) * 2016-12-08 2017-05-31 北京致远互联软件股份有限公司 A kind of online method for previewing of file and system
CN108090213A (en) * 2017-12-29 2018-05-29 福建南威软件有限公司 The method that mobile terminal rapid translating generates pdf document
CN109213968A (en) * 2018-08-01 2019-01-15 山东浪潮通软信息科技有限公司 A kind of method of online preview network disk file
CN110232161A (en) * 2019-04-25 2019-09-13 天津市职业大学 A kind of online method for previewing of document based on browser
CN110765378A (en) * 2019-09-20 2020-02-07 苏宁云计算有限公司 Method and system for playing Office document at webpage end

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102651744A (en) * 2012-05-04 2012-08-29 华为技术有限公司 E-mail security management method and E-mail server
CN103729338A (en) * 2013-12-29 2014-04-16 国云科技股份有限公司 File on-line previewing method
CN106790459A (en) * 2016-12-08 2017-05-31 北京致远互联软件股份有限公司 A kind of online method for previewing of file and system
CN108090213A (en) * 2017-12-29 2018-05-29 福建南威软件有限公司 The method that mobile terminal rapid translating generates pdf document
CN109213968A (en) * 2018-08-01 2019-01-15 山东浪潮通软信息科技有限公司 A kind of method of online preview network disk file
CN110232161A (en) * 2019-04-25 2019-09-13 天津市职业大学 A kind of online method for previewing of document based on browser
CN110765378A (en) * 2019-09-20 2020-02-07 苏宁云计算有限公司 Method and system for playing Office document at webpage end

Similar Documents

Publication Publication Date Title
WO2020253389A1 (en) Page translation method and apparatus, medium, and electronic device
CN100363883C (en) Printer with a web server embedded therein and printing method thereof
CN104333531B (en) The sharing of Internet resources and acquisition methods, device, terminal
US20070174420A1 (en) Caching of web service requests
US20020138653A1 (en) Workstation system, computer, data transfer method, data editing method, computer program generation method, computer program and storage medium
US20110173253A1 (en) Methods, Apparatus and Systems for Providing Local and Online Data Services
JP2005524892A5 (en)
CN112307369A (en) Short link processing method, device, terminal and storage medium
CN101754407B (en) Method, server and system for processing service access request
CN102831154B (en) The method and apparatus of data in the Text Entry of preservation and display web page
CN103853767A (en) Method and device for sharing social circle based on browser
CN113296774B (en) Processing method and system of OFD file based on browser
CN112507005A (en) Method and device for processing message
CN110232161A (en) A kind of online method for previewing of document based on browser
CN112187801A (en) Website access method, device and system
CA3061623A1 (en) File sending in instant messaging applications
KR20090009804A (en) Managing network response buffering behavior
CN112581568B (en) Dynamic poster generation method, device, server and storage medium
CN103729338A (en) File on-line previewing method
CN112612978A (en) File online browsing method based on browser
CN104077323A (en) Method and device for converting web page content to multimedia messages
CN111200650B (en) Data transmission method, device, system, equipment and medium
CN112347383A (en) Sharing link generation method and device and electronic equipment
CN103886086A (en) Cross-browser file-displaying system and method
CN108932330B (en) Data display method and device

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210406