Specific embodiment
Example embodiments are described in detail here, and the example is illustrated in the accompanying drawings.Following description is related to
When attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodiment
Described in embodiment do not represent all implementations consistent with this disclosure.On the contrary, they be only with it is such as appended
The example of the consistent device and method of some aspects be described in detail in claims, the disclosure.
Noun according to the present invention is explained first:
EPub: being a free open standard, belongs to the content that one kind " can be rearranged automatically ";Namely text
Content can be shown in a manner of being most suitable for reading according to the characteristic of arrangement for reading.
Portable document format (Portable Document Format, PDF): be by Adobe Systems be used for
The unrelated mode of application program, operating system, hardware carries out the file format that exchange files are developed.
The specific application scenarios of the present invention are as follows.When user needs online reading ePub file, server can be incited somebody to action
The file of ePub format is sent to terminal;Terminal obtains the file of ePub format, and then terminal carries out the file of ePub format
Interpretation processing, is then in the form of a web page handled the file display of ePub format.However in the prior art, since terminal obtains
To when ePub format file, terminal needs the file to ePub format to handle, and in the file of ePub format
Element ratio is more, and terminal is put into the file of ePub format when show in webpage, and the treatment process of terminal is more, such as
It is rendered, typesetting etc., and then would not be slow when the file of terminal Real time displaying ePub format, is not easy to use
Family online reading.
Electronic document treating method and apparatus provided by the invention, it is intended to solve the technical problem as above of the prior art.
How to be solved with technical solution of the specifically embodiment to technical solution of the present invention and the application below above-mentioned
Technical problem is described in detail.These specific embodiments can be combined with each other below, for the same or similar concept
Or process may repeat no more in certain embodiments.Below in conjunction with attached drawing, the embodiment of the present invention is described.
Fig. 1 is a kind of flow diagram of electronic document processing method provided by the embodiments of the present application.As shown in Figure 1, should
Method includes:
Step 101 receives the first read request that terminal is sent, wherein including ePub file in the first read request
The mark of chapters and sections to be read.
In the present embodiment, specifically, the first read request that server receiving terminal is sent, is wrapped in the first read request
Include file type to be read, file identification to be read, file to be read reading chapters and sections mark;And then server can determine
File to be read corresponding with file identification to be read.
Then, server file type to be read be ePub format file when, server can determine to
The mark of the reading chapters and sections of reading file, is the mark of the chapters and sections to be read of ePub file.
Step 102, from electronic document buffer, extract ePub corresponding with the mark of chapters and sections to be read of ePub file
Chapters and sections content, wherein include the ePub file after parsing in electronic document buffer, include in the ePub file after parsing
Corresponding relationship between the mark and ePub chapters and sections content of the marks of ePub chapters and sections, ePub chapters and sections content and ePub chapters and sections.
In the present embodiment, specifically, being provided with an electronic document buffer in server, in electronic document buffer
Include at least one parsing after ePub file, each parsing after ePub file in include ePub chapters and sections mark,
Corresponding relationship between ePub chapters and sections content and the mark and ePub chapters and sections content of ePub chapters and sections.And then server is in determination
After which the requested ePub file of terminal is out, server can inquire ePub text from electronic document buffer
EPub file after parsing corresponding to part;Then server is according to pair between the mark and ePub chapters and sections content of ePub chapters and sections
It should be related to, determine ePub chapters and sections content corresponding with the mark of chapters and sections to be read of ePub file.
It wherein, include at least one below in ePub file chapters and sections content: text, picture, video, audio.
Step 103, by ePub chapters and sections content corresponding with the mark of chapters and sections to be read of ePub file, be sent to terminal,
So that terminal shows ePub chapters and sections content corresponding with the mark of chapters and sections to be read of ePub file on webpage.
In the present embodiment, specifically, the ePub chapters and sections content that server will be determined, is sent to terminal.Server with
When transmitting file between terminal, using hypertext transfer protocol (Hyper Text Transfer Protocol, HTTP)
It is transmitted.
Specifically, server uses the RSA cryptographic algorithms (RSA algorithm) of JavaScript, to what is determined
EPub chapters and sections content, is encrypted, and generates encrypted ePub chapters and sections content;Then server uses http protocol, will
Encrypted ePub chapters and sections content is sent to terminal.
Then encrypted ePub chapters and sections content is decrypted in terminal, the ePub chapters and sections content after being decrypted;Terminal
EPub chapters and sections content after showing decryption on webpage.
Also, terminal can receive the addition request of user's transmission, include addition content in addition request;Terminal will add
Content is added in the ePub chapters and sections content shown.And then it completes and the functions such as the addition annotation of user, bookmark.
User's registration and heartbeat inspection can be completed also, during the present embodiment, between server and terminal
Process, to guarantee the communication quality of terminal and server;It and can also include user information, server in the first read request
Can judge whether terminal where user is supported to read and user's operation is asked by the user information in the first read request
No safe stalwartness of Seeking Truth etc..
The first read request that the present embodiment is sent by receiving terminal, wherein include ePub text in the first read request
The mark of the chapters and sections to be read of part;From electronic document buffer, extract corresponding with the mark of chapters and sections to be read of ePub file
EPub chapters and sections content, wherein include the ePub file after parsing in electronic document buffer, wrap in the ePub file after parsing
The mark of ePub chapters and sections, the mark pass corresponding between ePub chapters and sections content of ePub chapters and sections content and ePub chapters and sections are included
System;By ePub chapters and sections content corresponding with the mark of chapters and sections to be read of ePub file, it is sent to terminal, so that terminal is in webpage
It is upper to show ePub chapters and sections content corresponding with the mark of chapters and sections to be read of ePub file.To in terminal request ePub file
When, server is simply sent to the corresponding ePub chapters and sections content of terminal.Also, server parses ePub file
Processing, be sent to terminal ePub chapters and sections content be parsing after ePub chapters and sections content;To which terminal is to the file of ePub format
It is put into when shown in webpage, the processing such as terminal no longer needs the file to ePub format to be rendered, typesetting is accelerated
The speed of terminal Real time displaying ePub file is convenient for user's online reading.
Fig. 2 is the flow diagram of another electronic document processing method provided by the embodiments of the present application.As shown in Fig. 2,
This method comprises:
Step 201 generates after parsing ePub file progress dissection process according to preset ePub document convention
EPub file.
In the present embodiment, specifically, server can carry out dissection process to ePub file, after generating parsing
EPub file.
Specifically, server carries out pre- decompression processing to ePub file first, obtains the ePub file of decompression processing;So
Afterwards, server is according to ePub document convention, by minetype, content.opf, toc.ncx file etc. to decompression processing after
EPub file integrally carry out parsing classification processing, server can support plurality of picture format collection and classification processing, and
And the linear reading order and chapters and sections bibliographic structure of file can be generated.Include in ePub file after being parsed obtained from
The corresponding relationship of chapters and sections catalogue, chapters and sections content and chapters and sections catalogue and chapters and sections content, chapters and sections catalogue characterize each of ePub file
The mark of chapters and sections.
Step 202, by the ePub file after parsing, store into electronic document buffer.
In the present embodiment, specifically, the ePub file after parsing is put into electronic document buffer and is carried out by server
Storage.Also, server can carry out multiple cache encapsulation, and then utilize to the content of the ePub file after parsing
OpenSymphony (oscache) realizes page-level caching, can cache single file, caching uniform resource locator (Uniform
Resource Locator, URL) mode (Pattern), and cache attribute can be set.
Step 203 receives the first read request that terminal is sent, wherein including ePub file in the first read request
The mark of chapters and sections to be read.
In the present embodiment, it specifically, this step may refer to the step 101 of Fig. 1, repeats no more.
Step 204, from electronic document buffer, extract ePub corresponding with the mark of chapters and sections to be read of ePub file
Chapters and sections content, wherein include the ePub file after parsing in electronic document buffer, include in the ePub file after parsing
Corresponding relationship between the mark and ePub chapters and sections content of the marks of ePub chapters and sections, ePub chapters and sections content and ePub chapters and sections.
In the present embodiment, it specifically, this step may refer to the step 102 of Fig. 1, repeats no more.
Step 205, by ePub chapters and sections content corresponding with the mark of chapters and sections to be read of ePub file, be sent to terminal,
So that terminal shows ePub chapters and sections content corresponding with the mark of chapters and sections to be read of ePub file on webpage.
In the present embodiment, it specifically, this step may refer to the step 103 of Fig. 1, repeats no more.
The present embodiment is by carrying out dissection process to ePub file, after generating parsing according to preset ePub document convention
EPub file;The ePub file after parsing is stored into electronic document buffer;And then in server end to ePub file
It is handled and is parsed, do not needed terminal and ePub file is handled and parsed again.First sent by receiving terminal is read
Read request, wherein the mark of the chapters and sections to be read in the first read request including ePub file;From electronic document buffer,
Extract ePub chapters and sections content corresponding with the mark of chapters and sections to be read of ePub file, wherein include in electronic document buffer
EPub file after parsing includes the mark, ePub chapters and sections content and ePub of ePub chapters and sections in the ePub file after parsing
Corresponding relationship between the mark and ePub chapters and sections content of chapters and sections;It will be corresponding with the mark of chapters and sections to be read of ePub file
EPub chapters and sections content, is sent to terminal so that terminal shown on webpage it is corresponding with the mark of chapters and sections to be read of ePub file
EPub chapters and sections content.To which when terminal request ePub file, server is simply sent to the corresponding ePub chapters and sections of terminal
Content.Also, server has carried out dissection process to ePub file, be sent to terminal ePub chapters and sections content be parsing after
EPub chapters and sections content;To which when terminal, which is put into the file of ePub format, to be shown in webpage, terminal no longer needs
The file of ePub format is rendered, the processing such as typesetting, accelerates the speed of terminal Real time displaying ePub file, be convenient for user
Online reading.
In a kind of optional embodiment, on the basis of the above embodiments, can with the following steps are included:
Step 301 carries out picture cutting processing to pdf document, the pdf document after generating cutting, wherein after cutting
It include pair between the mark and picture path of picture, the mark of PDF chapters and sections, picture path and PDF chapters and sections in pdf document
It should be related to.
In the present embodiment, specifically, server carries out picture cutting processing to pdf document first;Server can incite somebody to action
Pdf document, cutting are at least one picture, the format of picture can for it is below any one: label image file format
(Tag Image File Format, TIFF), portable network figure (Portable Network Graphics, PNG), figure
As interchange format (Graphics Interchange Format, GIF), JPEG, scalable vector graphics (Scalable
Vector Graphics, SVG), text document (TXT).Also, the picture generated is the embedded font for supporting PDF.
Specifically, in order to which more efficient and quick parsing and cutting pdf document, server have used JDk thread pool;Clothes
Device be engaged in using JDk thread pool, pdf document is divided into small documents, small documents are then divided into multiple pictures again;Then it services
Device can zoom in and out processing to each picture.And then while can satisfy certain precision of picture, memory overhead is reduced
And EMS memory occupation, and then reduce the case where EMS memory occupation overflows.
Then, server is each picture configuration diagram piece path, and then obtains the pdf document after cutting, after the cutting
Pdf document in include picture, the mark of PDF chapters and sections, picture path and PDF chapters and sections mark and picture path between
Corresponding relationship.Wherein, picture path is URL.
Step 302, by the corresponding relationship between picture path and the mark and picture path of PDF chapters and sections, storage to electricity
In subdocument buffer.
In the present embodiment, specifically, server will obtain mark and the picture path in picture path and PDF chapters and sections
Between corresponding relationship, store into electronic document buffer.
Also, server can carry out multiple cache encapsulation, and then realize using oscache to obtained picture path
Page-level caching can cache single file, caching URL Pattern, and can set cache attribute.In turn, reduce production
The time-consuming problem that raw picture and pdf document is loaded in server;Server can filter function by the caching of Servlet2.3
Can, arbitrary uniform resource identifier (Uniform Resource Identifier, URI) can be cached.And it integrates
JGroups realizes the cluster of caching, makes to obtain more quick when the file in electronics buffer.
Step 303 receives the second read request that terminal is sent, wherein in the second read request including pdf document to
Read the mark of chapters and sections.
In the present embodiment, specifically, the second read request that server receiving terminal is sent, is wrapped in the second read request
Include file type to be read, file identification to be read, file to be read reading chapters and sections mark;And then server can determine
File to be read corresponding with file identification to be read.
Then, when file type to be read is the file of PDF format, server can be determined wait read server
The mark for reading the reading chapters and sections of file, is the mark of the chapters and sections to be read of pdf document.
Step 304, according to electronic document buffer, determine picture corresponding with the mark of chapters and sections to be read of pdf document
Path, wherein further include the corresponding relationship between the mark of PDF chapters and sections and picture path in electronic document buffer.
In the present embodiment, specifically, due in electronic document buffer with PDF chapters and sections mark and picture path it
Between corresponding relationship, and then server can determine picture corresponding with the mark of chapters and sections to be read of current pdf document
Path.
Step 305, according to the corresponding relationship between preset picture path and picture, determine figure corresponding with picture path
Piece.
In the present embodiment, it specifically, being stored with the corresponding relationship between picture path and picture in server, and then takes
Business device can determine picture corresponding to picture path.
Step 306, will picture corresponding with picture path, terminal is sent to, so that terminal is shown on webpage and picture
The corresponding picture in path.
In the present embodiment, specifically, the picture that server will be determined, is sent to terminal.Between server and terminal
When transmitting picture, transmitted using http protocol.
Then, terminal can show the picture received on webpage.Also, terminal can receive the addition of user's transmission
Request, adding in request includes addition content;Terminal will add content, be added on the picture shown.And then complete with
The functions such as the addition annotation of user, bookmark.
Picture cutting is carried out to pdf document by above step server, is multiple pictures by pdf document cutting, and right
Picture zooms in and out processing;The corresponding picture of reading chapters and sections of pdf document is sent to terminal by server;Terminal is on webpage
Show picture;Terminal does not need to handle the file of PDF formula yet, directly display can, be convenient for user's online reading.
Fig. 3 is a kind of structural schematic diagram of electronic document processing unit provided in an embodiment of the present invention, as shown in figure 3, this
The device of embodiment may include:
First receiving module 31, for receiving the first read request of terminal transmission, wherein include in the first read request
The mark of the chapters and sections to be read of ePub file;
Extraction module 32, for extracting the mark pair with the chapters and sections to be read of ePub file from electronic document buffer
The ePub chapters and sections content answered, wherein including the ePub file after parsing in electronic document buffer, in the ePub file after parsing
Include the marks of ePub chapters and sections, ePub chapters and sections content and ePub chapters and sections mark with it is corresponding between ePub chapters and sections content
Relationship;
First sending module 33, for by ePub chapters and sections content corresponding with the mark of chapters and sections to be read of ePub file,
It is sent to terminal, so that terminal is shown on webpage in ePub chapters and sections corresponding with the mark of chapters and sections to be read of ePub file
Hold.
A kind of electronic document processing side provided in an embodiment of the present invention can be performed in the electronic document processing unit of the present embodiment
Method, realization principle is similar, and details are not described herein again.
The first read request that the present embodiment is sent by receiving terminal, wherein include ePub text in the first read request
The mark of the chapters and sections to be read of part;From electronic document buffer, extract corresponding with the mark of chapters and sections to be read of ePub file
EPub chapters and sections content, wherein include the ePub file after parsing in electronic document buffer, wrap in the ePub file after parsing
The mark of ePub chapters and sections, the mark pass corresponding between ePub chapters and sections content of ePub chapters and sections content and ePub chapters and sections are included
System;By ePub chapters and sections content corresponding with the mark of chapters and sections to be read of ePub file, it is sent to terminal, so that terminal is in webpage
It is upper to show ePub chapters and sections content corresponding with the mark of chapters and sections to be read of ePub file.To in terminal request ePub file
When, server is simply sent to the corresponding ePub chapters and sections content of terminal.Also, server parses ePub file
Processing, be sent to terminal ePub chapters and sections content be parsing after ePub chapters and sections content;To which terminal is to the file of ePub format
It is put into when shown in webpage, the processing such as terminal no longer needs the file to ePub format to be rendered, typesetting is accelerated
The speed of terminal Real time displaying ePub file is convenient for user's online reading.
Fig. 4 is the structural schematic diagram of another electronic document processing unit provided in an embodiment of the present invention, reality shown in Fig. 3
On the basis of applying example, as shown in figure 4, device provided in this embodiment, further includes:
Parsing module 41, for the first receiving module 31 receive terminal send the first read request before, according to pre-
If ePub document convention, to ePub file carry out dissection process, generate parsing after ePub file;
First memory module 42 is stored for the ePub file after parsing into electronic document buffer.
Device provided in this embodiment, further includes:
Second receiving module 43, for receiving the second read request of terminal transmission, wherein include in the second read request
The mark of the chapters and sections to be read of pdf document;
First determining module 44, for according to electronic document buffer, the determining mark with the chapters and sections to be read of pdf document
Corresponding picture path, wherein further include the corresponding pass between the mark of PDF chapters and sections and picture path in electronic document buffer
System;
Second determining module 45, for according to the corresponding relationship between preset picture path and picture, determining and picture
The corresponding picture in path;
Second sending module 46, for will picture corresponding with picture path, terminal is sent to, so that terminal is on webpage
Show picture corresponding with picture path.
Device provided in this embodiment, further includes:
Cutting module 47, for the second receiving module 43 receive terminal send the second read request before, to PDF text
Part carries out picture cutting processing, the pdf document after generating cutting, wherein includes picture, PDF chapters and sections in the pdf document after cutting
Mark, the corresponding relationship between the mark in picture path and PDF chapters and sections and picture path;
Second memory module 48, for by between the mark of picture path and PDF chapters and sections and picture path it is corresponding pass
System stores into electronic document buffer.
It include at least one below in ePub file chapters and sections content: text, picture, video, audio.
Another electronic document processing provided in an embodiment of the present invention can be performed in the electronic document processing unit of the present embodiment
Method, realization principle is similar, and details are not described herein again.
The present embodiment is by carrying out dissection process to ePub file, after generating parsing according to preset ePub document convention
EPub file;The ePub file after parsing is stored into electronic document buffer;And then in server end to ePub file
It is handled and is parsed, do not needed terminal and ePub file is handled and parsed again.First sent by receiving terminal is read
Read request, wherein the mark of the chapters and sections to be read in the first read request including ePub file;From electronic document buffer,
Extract ePub chapters and sections content corresponding with the mark of chapters and sections to be read of ePub file, wherein include in electronic document buffer
EPub file after parsing includes the mark, ePub chapters and sections content and ePub of ePub chapters and sections in the ePub file after parsing
Corresponding relationship between the mark and ePub chapters and sections content of chapters and sections;It will be corresponding with the mark of chapters and sections to be read of ePub file
EPub chapters and sections content, is sent to terminal so that terminal shown on webpage it is corresponding with the mark of chapters and sections to be read of ePub file
EPub chapters and sections content.To which when terminal request ePub file, server is simply sent to the corresponding ePub chapters and sections of terminal
Content.Also, server has carried out dissection process to ePub file, be sent to terminal ePub chapters and sections content be parsing after
EPub chapters and sections content;To which when terminal, which is put into the file of ePub format, to be shown in webpage, terminal no longer needs
The file of ePub format is rendered, the processing such as typesetting, accelerates the speed of terminal Real time displaying ePub file, be convenient for user
Online reading.
In several embodiments provided by the present invention, it should be understood that disclosed device and method can pass through it
Its mode is realized.For example, the apparatus embodiments described above are merely exemplary, for example, the division of unit, only
A kind of logical function partition, there may be another division manner in actual implementation, for example, multiple units or components can combine or
Person is desirably integrated into another system, or some features can be ignored or not executed.Another point, shown or discussed is mutual
Between coupling, direct-coupling or communication connection can be through some interfaces, the INDIRECT COUPLING or communication link of device or unit
It connects, can be electrical property, mechanical or other forms.
Unit may or may not be physically separated as illustrated by the separation member, shown as a unit
Component may or may not be physical unit, it can and it is in one place, or may be distributed over multiple networks
On unit.It can some or all of the units may be selected to achieve the purpose of the solution of this embodiment according to the actual needs.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also realize in the form of hardware adds SFU software functional unit.
The above-mentioned integrated unit being realized in the form of SFU software functional unit can store and computer-readable deposit at one
In storage media.Above-mentioned SFU software functional unit is stored in a storage medium, including some instructions are used so that a computer
It is each that equipment (can be personal computer, server or the network equipment etc.) or processor (processor) execute the present invention
The part steps of the method for embodiment.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory (Read-Only
Memory, ROM), random access memory (Random Access Memory, RAM), magnetic or disk etc. is various to deposit
Store up the medium of program code.
Those skilled in the art after considering the specification and implementing the invention disclosed here, will readily occur to its of the disclosure
Its embodiment.The present invention is directed to cover any variations, uses, or adaptations of the disclosure, these modifications, purposes or
Person's adaptive change follows the general principles of this disclosure and including the undocumented common knowledge in the art of the disclosure
Or conventional techniques.The description and examples are only to be considered as illustrative, and the true scope and spirit of the disclosure are by following
Claims are pointed out.
It should be understood that the present disclosure is not limited to the precise structures that have been described above and shown in the drawings, and
And various modifications and changes may be made without departing from the scope thereof.The scope of the present disclosure is only limited by appended claims
System.