CN106445531A - Cross-platform document reader based on mobile terminal and achieving method of cross-platform document reader - Google Patents

Cross-platform document reader based on mobile terminal and achieving method of cross-platform document reader Download PDF

Info

Publication number
CN106445531A
CN106445531A CN201610859076.9A CN201610859076A CN106445531A CN 106445531 A CN106445531 A CN 106445531A CN 201610859076 A CN201610859076 A CN 201610859076A CN 106445531 A CN106445531 A CN 106445531A
Authority
CN
China
Prior art keywords
document
reader
ios
type
url
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
CN201610859076.9A
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.)
Sichuan Changhong Electric Co Ltd
Original Assignee
Sichuan Changhong Electric 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 Sichuan Changhong Electric Co Ltd filed Critical Sichuan Changhong Electric Co Ltd
Priority to CN201610859076.9A priority Critical patent/CN106445531A/en
Publication of CN106445531A publication Critical patent/CN106445531A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Human Computer Interaction (AREA)
  • Telephone Function (AREA)

Abstract

The invention relates to the field of mobile application development, and provides a cross-platform document reader based on a mobile terminal and an achieving method of the cross-platform document reader. The document reader comprises an Android native reader, an iOS native reader, an equipment recognition module, a URL generator, a URL interceptor, a document opening module, a javascriptInterface function interface, an iOS type opening module and an Android type opening module. By adopting the technical scheme of the invention, a reader which crosses platforms and is compatible with different types of documents can be achieved, the types of documents can be judged according to routes through which the documents are received, appropriate modes can be selected to open the documents, then a user can read the documents, and the user experience can be improved.

Description

Cross-platform document reader and its implementation based on mobile terminal
Technical field
The invention belongs to Mobile solution development field, more particularly to a kind of cross-platform document based on mobile terminal are read Device and its implementation.
Background technology
At present, intelligent mobile terminal is popularized, and Mobile solution software has obtained quick development therewith, each application In market, the application of the terminal such as the suitable mobile phone of restocking, flat board is also more and more, and much applies and check various documents Demand.
The document for having the types such as PDF, TXT, Office of a lot of android versions and ios release currently on the market is read Device, but these reader generally existings can not the cross-platform problem using with compatible documents in various formats simultaneously.On the other hand, with The maturation of HTML5 technology, increasing mobile terminal developer begins to use the mixed developing side of HTML5+Android/IOS Formula is realizing Cross Platform Technology, and based on this development scheme, the present invention not only solves the cross-platform problem of document reader, also Solve document formats compatibling problem.
Content of the invention
【Technical problem to be solved】
It is an object of the invention to provide a kind of cross-platform document reader based on mobile terminal and its implementation, with Solve the problems, such as that current reader cross-platform can not be used and while compatible documents in various formats.
【Technical scheme】
The present invention is achieved by the following technical solutions.
Present invention firstly relates to a kind of implementation method of the cross-platform document reader based on mobile terminal, including following Step:
A, the primary module of exploitation document reader, end user is by opening the road of the incoming document to be opened of document module Footpath, the primary module of the document reader includes the primary reader of Android and the primary reader of iOS, the Android original Raw reader is the Android reader for being capable of compatible dissimilar document with the exploitation of Android primary code, the iOS Primary reader is the iOS reader for being capable of compatible dissimilar document with the exploitation of iOS primary code;
B, by equipment identification module obtain current device type;
If the type of C current device is Android type, to call javascriptInterface function interface, JavascriptInterface function interface calls the primary reader of Android to open document;
If the type of D current device is iOS type, builds the URL for opening document reader and call URL to occur Device, after URL intercepted by URL blocker, parses the iOS method name and document path for needing to call, and URL blocker calls iOS Primary reader, opens document.
As one kind preferred embodiment, the equipment identification module passes through HTML DOM userAgent attributive judgment Browser type simultaneously determines whether the equipment that the browser is located is iOS type, if not iOS type, then the equipment is Android type.
Used as another preferred embodiment, the URL generator is used for one iframe of dynamic creation and for being somebody's turn to do Iframe arranges src attribute, and the URL blocker is worth to document path by intercepting src attribute.
Used as another preferred embodiment, step A also includes:Enter under Eclipse environment and Xcode environment The primary Development of Module of row document reader.
Used as another preferred embodiment, the type of the document is PDF, TXT or Office.
The invention further relates to a kind of cross-platform document reader based on mobile terminal, including the primary reading of Android The primary reader of device, iOS, equipment identification module, URL generator, URL blocker, open document module, JavascriptInterface function interface, iOS type open module and Android type opens module,
The primary reader of the Android be with the exploitation of Android primary code being capable of compatible dissimilar document Android reader;
The primary reader of the iOS is read with the iOS for being capable of compatible dissimilar document of iOS primary code exploitation Device;
The document module of opening is for the path of incoming document to be opened;
The equipment identification module is used for obtaining current device type;
The Android type is opened module and is configured to:If the type of current device is Android type, to adjust JavascriptInterface function interface is used, javascriptInterface function interface calls the primary reading of Android Document opened by device;
The iOS type is opened module and is configured to:If the type of current device is iOS type, builds and open text The URL of shelves reader simultaneously calls URL generator, after URL intercepted by URL blocker, parse the iOS method name for needing to call and Document path, URL blocker calls the primary reader of iOS, opens document.
As one kind preferred embodiment, the equipment identification module is specifically configured to:By HTML DOM UserAgent attributive judgment browser type simultaneously determines whether the equipment that the browser is located is iOS type, if not iOS class Type, then the equipment is Android type.
Used as another preferred embodiment, the URL generator is used for one iframe of dynamic creation and for being somebody's turn to do Iframe arranges src attribute, and the URL blocker is worth to document path by intercepting src attribute.
Used as another preferred embodiment, the type of the document is PDF, TXT or Office.
【Beneficial effect】
Technical scheme proposed by the present invention has the advantages that:
Present invention achieves the reader of cross-platform and compatible dissimilar document, can according to the incoming path of document, Judge Doctype, and select suitable mode that document is opened, read for user, improve Consumer's Experience.
Description of the drawings
Fig. 1 is the principle frame of the cross-platform document reader based on mobile terminal of the offer of embodiments of the invention one Figure.
Specific embodiment
For making the object, technical solutions and advantages of the present invention clearer, below by the specific embodiment to the present invention Carry out clear, complete description.
Embodiment one
Fig. 1 is the theory diagram of the cross-platform document reader based on mobile terminal of the offer of the embodiment of the present invention one. As shown in figure 1, the reader include the primary reader of Android, the primary reader of iOS, equipment identification module, URL generator, URL blocker, open document module, javascriptInterface function interface, iOS type and open module and Android class Module opened by type.
The primary reader of Android be with Android primary code exploitation being capable of compatible dissimilar document Android reader.The primary reader of iOS is read with the iOS for being capable of compatible dissimilar document of iOS primary code exploitation Device.Wherein, the type of document is PDF, TXT or Office.
Document module is opened for the path of incoming document to be opened.
Equipment identification module is used for obtaining current device type.Specifically, equipment identification module is configured to:By HTML DOM userAgent attributive judgment browser type simultaneously determines whether the equipment that the browser is located is iOS type, if not IOS type, then the equipment is Android type.
Android type is opened module and is configured to:If the type of current device is Android type, to call JavascriptInterface function interface, javascriptInterface function interface calls the primary reader of Android Open document.
URL generator is used for one iframe of dynamic creation and arranges src attribute for the iframe, and URL blocker passes through Intercept src attribute and be worth to document path.
IOS type is opened module and is configured to:If the type of current device is iOS type, structure is opened document and is read Read the URL of device and URL generator is called, after URL intercepted by URL blocker, parse the iOS method name and document for needing to call Path, URL blocker calls the primary reader of iOS, opens document.
The implementation method of the reader in embodiment one may be referred to following concrete grammar embodiments.
Embodiment two
Embodiment two be a kind of implementation method of the cross-platform document reader based on mobile terminal, the method include with Lower step:
(1) the primary module of document reader, is developed, document can be carried out under Eclipse environment and Xcode environment and read Read the primary Development of Module of device, end user is read by opening the path of the incoming document to be opened of document module, the document The primary module of device includes the primary reader of Android and the primary reader of iOS, and the primary reader of the Android is use The Android reader for being capable of compatible dissimilar document of Android primary code exploitation, the primary reader of the iOS is The iOS reader for being capable of compatible dissimilar document with the exploitation of iOS primary code.The type of document be PDF, TXT or Office.
Specifically, iOS end is realized opening the primary reader of dissimilar document, iOS be by relying on QuickLook The multi-format document preview that framework is realized, by incoming document path is parsed into corresponding url path, by QuickLook Framework identification document path and form open document, and tool topic realization is acted on behalf of by QLPreviewControllerDelegate Method, code sample is as follows:
(id<QLPreviewItem>)previewController:(QLPreviewController
*)controller previewItemAtIndex:(NSInteger)index{
NSURL*url=[NSURL fileURLWithPath:path];
Return url;
}
Wherein path is incoming document path, if incoming document is usually again coded format for txt format file, Version of the ios system below 9.0 is to be unable to the txt Chinese document after automatic identification is encoded, and direct preview document occurs unrest Code situation, if necessary to compatible all system versions, then need exist for carrying out document coding form conversion, the embodiment of the present invention The concrete method for solving txt document coding is as follows:
The whether coding of txt document being first determined whether, if not encoding, directly path solution being carried out by QuickLook framework Analysis, preview time document;If encoded txt document, coded system conversion is carried out, then walking along the street is entered by QuickLook framework Footpath parses.Encoded txt document coding form be generally UNICODE coding or ANSI coding (- 2147482591 ,- 2147482062), the embodiment of the present invention is carried out by original document is converted into NSUTF16StringEncoding coded format Txt document is read.
(2), current device type is obtained by equipment identification module.Specifically, in the step, equipment identification module passes through HTML DOM userAgent attributive judgment browser type simultaneously determines whether the equipment that the browser is located is iOS type, if It is not iOS type, then the equipment is Android type.
(3) if the type of current device is Android type, to call javascriptInterface function to connect Mouthful, javascriptInterface function interface calls the primary reader of Android to open document.
(4) if the type of current device is iOS type, builds the URL for opening document reader and call URL to send out Raw device, after URL intercepted by URL blocker, parses the iOS method name and document path for needing to call, and URL blocker is called The primary reader of iOS, opens document.In the step, URL generator is used for one iframe of dynamic creation and sets for the iframe Src attribute is put, URL blocker is worth to document path by intercepting src attribute.
As can be seen from the above embodiments, the embodiment of the present invention achieves the reading of cross-platform and compatible dissimilar document Device, can judge Doctype, and selects suitable mode to open document according to the incoming path of document, reads for user, carries Consumer's Experience is risen.
It is to be appreciated that the embodiment of foregoing description is a part of embodiment of the present invention, rather than whole embodiments, also not It is limitation of the present invention.Based on embodiments of the invention, those of ordinary skill in the art are not paying creative work premise Lower obtained every other embodiment, belongs to protection scope of the present invention.

Claims (9)

1. a kind of implementation method of the cross-platform document reader based on mobile terminal, it is characterised in that comprise the following steps:
A, the primary module of exploitation document reader, end user by opening the path of the incoming document to be opened of document module, The primary module of the document reader includes the primary reader of Android and the primary reader of iOS, and the Android is primary Reader is the Android reader for being capable of compatible dissimilar document with the exploitation of Android primary code, the iOS original Raw reader is the iOS reader for being capable of compatible dissimilar document with the exploitation of iOS primary code;
B, by equipment identification module obtain current device type;
If the type of C current device is Android type, to call javascriptInterface function interface, JavascriptInterface function interface calls the primary reader of Android to open document;
If the type of D current device is iOS type, builds the URL for opening document reader and URL generator called, After URL intercepted by URL blocker, the iOS method name and document path for needing to call is parsed, URL blocker calls iOS primary Reader, opens document.
2. the implementation method of the cross-platform document reader based on mobile terminal according to claim 1, its feature exists By HTML DOM userAgent attributive judgment browser type and determine that the browser is located in the equipment identification module Equipment whether be iOS type, if not iOS type, then the equipment be.
3. the implementation method of the cross-platform document reader based on mobile terminal according to claim 1, its feature exists It is used for one iframe of dynamic creation in the URL generator and src attribute is set for the iframe, the URL blocker leads to Cross interception src attribute and be worth to document path.
4. the implementation method of the cross-platform document reader based on mobile terminal according to claim 1, step A Also include:The primary Development of Module of document reader is carried out under Eclipse environment and Xcode environment.
5. the implementation method of the cross-platform document reader based on mobile terminal according to claim 1, its feature exists It is PDF, TXT or Office in the type of the document.
6. a kind of cross-platform document reader based on mobile terminal, it is characterised in that including the primary reader of Android, The primary reader of iOS, equipment identification module, URL generator, URL blocker, open document module, JavascriptInterface function interface, iOS type open module and Android type opens module,
The primary reader of the Android be with the exploitation of Android primary code being capable of compatible dissimilar document Android reader;
The primary reader of the iOS is the iOS reader for being capable of compatible dissimilar document with the exploitation of iOS primary code;
The document module of opening is for the path of incoming document to be opened;
The equipment identification module is used for obtaining current device type;
The Android type is opened module and is configured to:If the type of current device is Android type, to call JavascriptInterface function interface, javascriptInterface function interface calls the primary reader of Android Open document;
The iOS type is opened module and is configured to:If the type of current device is iOS type, structure is opened document and is read Read the URL of device and URL generator is called, after URL intercepted by URL blocker, parse the iOS method name and document for needing to call Path, URL blocker calls the primary reader of iOS, opens document.
7. the cross-platform document reader based on mobile terminal according to claim 6, it is characterised in that the equipment Identification module is specifically configured to:By HTML DOM userAgent attributive judgment browser type and determine the browser institute Equipment whether be iOS type, if not iOS type, then the equipment be.
8. the cross-platform document reader based on mobile terminal according to claim 6, it is characterised in that the URL sends out Raw device is used for one iframe of dynamic creation and arranges src attribute for the iframe, and the URL blocker is by intercepting src category Property is worth to document path.
9. the cross-platform document reader based on mobile terminal according to claim 6, it is characterised in that the document Type be PDF, TXT or Office.
CN201610859076.9A 2016-09-28 2016-09-28 Cross-platform document reader based on mobile terminal and achieving method of cross-platform document reader Pending CN106445531A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610859076.9A CN106445531A (en) 2016-09-28 2016-09-28 Cross-platform document reader based on mobile terminal and achieving method of cross-platform document reader

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610859076.9A CN106445531A (en) 2016-09-28 2016-09-28 Cross-platform document reader based on mobile terminal and achieving method of cross-platform document reader

Publications (1)

Publication Number Publication Date
CN106445531A true CN106445531A (en) 2017-02-22

Family

ID=58170255

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610859076.9A Pending CN106445531A (en) 2016-09-28 2016-09-28 Cross-platform document reader based on mobile terminal and achieving method of cross-platform document reader

Country Status (1)

Country Link
CN (1) CN106445531A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114374601A (en) * 2021-12-28 2022-04-19 海南视联大健康智慧医疗科技有限公司 Method and device for determining configuration information

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103309660A (en) * 2013-05-27 2013-09-18 北京尚友通达信息技术有限公司 Mobile application cross-platform development method
CN105204875A (en) * 2014-06-11 2015-12-30 腾讯科技(深圳)有限公司 Native function calling method and system of webpage
CN105607895A (en) * 2014-11-21 2016-05-25 阿里巴巴集团控股有限公司 Operation method and device of application program on the basis of application program programming interface
CN105718512A (en) * 2016-01-13 2016-06-29 北京齐尔布莱特科技有限公司 Method for calling native language by using JS language in Ios system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103309660A (en) * 2013-05-27 2013-09-18 北京尚友通达信息技术有限公司 Mobile application cross-platform development method
CN105204875A (en) * 2014-06-11 2015-12-30 腾讯科技(深圳)有限公司 Native function calling method and system of webpage
CN105607895A (en) * 2014-11-21 2016-05-25 阿里巴巴集团控股有限公司 Operation method and device of application program on the basis of application program programming interface
CN105718512A (en) * 2016-01-13 2016-06-29 北京齐尔布莱特科技有限公司 Method for calling native language by using JS language in Ios system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
HALEY_WONG: ""iOS下JS与原生OC互相调用(总结)"", 《HTTPS://WWW.JIANSHU.COM/P/D19689E0ED83》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114374601A (en) * 2021-12-28 2022-04-19 海南视联大健康智慧医疗科技有限公司 Method and device for determining configuration information

Similar Documents

Publication Publication Date Title
CN101778168B (en) Method and system for optimization display of wed pages on browser of mobile terminal
US6535896B2 (en) Systems, methods and computer program products for tailoring web page content in hypertext markup language format for display within pervasive computing devices using extensible markup language tools
US5745908A (en) Method for converting a word processing file containing markup language tags and conventional computer code
CN101807192B (en) Webpage optical character recognition processing method used for mobile communication equipment terminal
CN102163233A (en) Method and system for converting webpage markup language format
CN102254550B (en) Method and system for reading characters on webpage
CN108337236A (en) A kind of gRPC call methods and device based on Protobuf and HTTP/1.1
US20150339175A1 (en) Method and device for starting external application program in browser
ATE349056T1 (en) LANGUAGE-INDEPENDENT VOICE-BASED USER INTERFACE
CN106657046A (en) Configurable fine grit authority control method and device
CN103902269B (en) System and method for generating MIB files through XML files
CN102902537A (en) Embedded WEB model view controller (MVC) development framework based on Fast common gateway interface (CGI) and hypertext markup language (HTML) template
CN102722551A (en) Intelligent switching method and system for browser kernels
CN104360937A (en) Intelligent parameter checking device
CN103036891A (en) Method and device based on wireless fidelity (Wi-Fi) for accessing to Internet of Things
CN106534267A (en) File uploading and resolving method and device
US8966108B2 (en) Portable data carrier comprising a CAT interpreter
CN106445531A (en) Cross-platform document reader based on mobile terminal and achieving method of cross-platform document reader
FR2828358B1 (en) METHOD AND DEVICE FOR COMPATIBILITY OF COMMUNICATION ON A NETWORK OF TERMINALS, FOR EXAMPLE TO ENABLE A DIALOGUE WITH AN APPLICATION ON A CHIP CARD
CN102486792A (en) Method and system for reorganizing and displaying universal forum page
WO2017143498A1 (en) Double-render-engine browser, and pc end web page application page conversion method and apparatus
CN109522528A (en) A kind of word document is converted to the method that can calculate automatically html document
CN102915334B (en) picture display processing method and corresponding browser
CN109660672A (en) Conversion method, equipment and the computer readable storage medium of sound-type
CN103020192B (en) Method and system for browsing files

Legal Events

Date Code Title Description
C06 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

Application publication date: 20170222

RJ01 Rejection of invention patent application after publication