CN112965646B - Method and device for calculating page number of subdirectory of streaming document - Google Patents

Method and device for calculating page number of subdirectory of streaming document Download PDF

Info

Publication number
CN112965646B
CN112965646B CN202110246409.1A CN202110246409A CN112965646B CN 112965646 B CN112965646 B CN 112965646B CN 202110246409 A CN202110246409 A CN 202110246409A CN 112965646 B CN112965646 B CN 112965646B
Authority
CN
China
Prior art keywords
subdirectory
page
current
page number
document
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
CN202110246409.1A
Other languages
Chinese (zh)
Other versions
CN112965646A (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.)
ONYX INTERNATIONAL Inc
Original Assignee
ONYX INTERNATIONAL Inc
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 ONYX INTERNATIONAL Inc filed Critical ONYX INTERNATIONAL Inc
Priority to CN202110246409.1A priority Critical patent/CN112965646B/en
Publication of CN112965646A publication Critical patent/CN112965646A/en
Application granted granted Critical
Publication of CN112965646B publication Critical patent/CN112965646B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • G06F3/0483Interaction with page-structured environments, e.g. book metaphor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/02Digital computers in general; Data processing equipment in general manually operated with input through keyboard and computation using a built-in program, e.g. pocket calculators
    • G06F15/025Digital computers in general; Data processing equipment in general manually operated with input through keyboard and computation using a built-in program, e.g. pocket calculators adapted to a specific application
    • G06F15/0291Digital computers in general; Data processing equipment in general manually operated with input through keyboard and computation using a built-in program, e.g. pocket calculators adapted to a specific application for reading, e.g. e-books

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Human Computer Interaction (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The invention discloses a method and a device for calculating page numbers of subdirectories of streaming documents, wherein the method comprises the following steps: acquiring position ranges of all pages of a streaming document; acquiring directory link positions of all subdirectories of the streaming document; and calculating the page number of each subdirectory according to the position range and the directory link position. The invention obtains the position ranges of all pages of the streaming document; acquiring directory link positions of all subdirectories of the streaming document; and calculating the page number of each subdirectory according to the position range and the directory link position. The method solves the technical problems of slow loading speed and poor user experience caused by long updating time of the existing streaming document directory updating mode.

Description

Method and device for calculating page number of subdirectory of streaming document
Technical Field
The invention relates to the technical field of document processing, in particular to a method and a device for calculating page numbers of a subdirectory of a streaming document.
Background
Along with the continuous popularization and popularity of electronic readers, people who like reading books use the electronic readers with bistable display screens to read, the display screens of the electronic readers adopt an electronic ink technology, only the electric quantity is consumed when a user turns pages and refreshes, the electronic readers have the characteristics of low power consumption and good display effect, and the electronic readers can also read under strong light and are popular with users. In an actual scenario, in order to fit reading habits of different users, the text of the electronic reader may be output in the form of a streaming document.
Streaming documents: for example, an epub document describes a document which is not generated after typesetting and has all data required for layout presentation, related data of the document usually does not have layout information such as fixed position size, and similar pipeline type re-typesetting calculation needs to be performed on the data from beginning to end each time the document is loaded, so that related position information is obtained and then the document can be presented. Therefore, the directory of the streaming document has no fixed page number, and the directory page number needs to be updated after the paging is completed.
In the prior art, for the calculation of directory page numbers, all subdirectories are traversed recursively, and each subdirectory updates the page number independently; every time a page number is updated, a match needs to be looked up in the page table according to the position of the directory link. For a large document, the number of pages is very large under the condition that there are very many subdirectories, and it will take a long time to update all the subdirectory pages, resulting in slow directory loading and affecting the reading experience. For example, taking an epub document with a size of 145MB as an example, the document includes 3362 sub-directories, and after typesetting, 15917 total pages are present, and by the above updating scheme, it takes about 4500ms to update all directories, the directory updating time is long, the directory loading speed is slow, and the user experience is poor.
Disclosure of Invention
The invention provides a method and a device for calculating page numbers of a subdirectory of a streaming document, which are used for solving the technical problems of low loading speed and poor user experience caused by long updating time of the existing updating mode of the directory of the streaming document.
The invention provides a method for calculating the page number of a subdirectory of a streaming document, wherein the streaming document is provided with a plurality of pages and a plurality of subdirectories, and the method comprises the following steps:
acquiring the position ranges of all the pages of the streaming document;
acquiring directory link positions of all the subdirectories of the streaming document;
and calculating the page number of each subdirectory according to the position range and the directory link position.
Optionally, the step of obtaining the position ranges of all the pages of the streaming document includes:
obtaining a document page table of the streaming document;
and acquiring the position ranges of all the pages from the document page table.
Optionally, the step of calculating the page number of each of the subdirectories according to the location range and the directory link location includes:
sorting all the pages in ascending order according to all the position ranges to obtain page position sorting;
sorting all the subdirectories in an ascending order according to the link positions of all the directories to obtain subdirectory sorting;
and comparing the position range with the directory link position according to the page position sequence and the subdirectory sequence, and calculating the page number of each subdirectory.
Optionally, the step of comparing the position range with the directory link position according to the page ranking and the subdirectory ranking, and calculating the page number of each subdirectory includes:
determining a current page according to the page sequence, and acquiring a current position range and a page number of the current page;
determining the current subdirectory in the undetermined subdirectories according to the subdirectory sorting;
acquiring a target directory link position of the current subdirectory;
judging whether the link position of the target directory is within the current position range;
when the link position of the target directory is within the current position range, determining the page number of the page as the page number of the current subdirectory;
determining the next subdirectory as the current subdirectory and returning to the step of obtaining the target directory link position of the current subdirectory;
and when the link position of the target directory is larger than the current position range, determining the next page as the current page, acquiring the current position range and the page number of the current page, and returning to the step of determining the current subdirectory in undetermined subdirectories according to the subdirectory sorting so as to calculate the page number of each subdirectory.
Optionally, the step of determining the next subdirectory as the current subdirectory includes:
and acquiring the index of the current subdirectory, determining a next subdirectory according to the index and the subdirectory ordering, and taking the next subdirectory as the current subdirectory.
The invention also provides a page number calculation device for a subdirectory of a streaming document, wherein the streaming document is provided with a plurality of pages and a plurality of subdirectories, and the device comprises:
a position range obtaining module, configured to obtain position ranges of all the pages of the streaming document;
a directory link position acquisition module, configured to acquire directory link positions of all the subdirectories of the streaming document;
and the page number calculation module is used for calculating the page number of each subdirectory according to the position range and the directory link position.
Optionally, the position range obtaining module includes:
the document page table obtaining sub-module is used for obtaining a document page table of the streaming document;
and the position range acquisition submodule is used for acquiring the position ranges of all the pages from the document page table.
Optionally, the page number calculating module includes:
the page position ordering obtaining sub-module is used for ordering all the pages according to the position ranges in an ascending order to obtain page position ordering;
the subdirectory ordering acquisition sub-module is used for ordering all the subdirectories in an ascending order according to all the directory link positions to obtain subdirectory ordering;
and the page number calculation submodule is used for comparing the position range with the directory link position according to the page position sequence and the subdirectory sequence and calculating the page number of each subdirectory.
The invention also provides an electronic device, characterized in that the device comprises a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is used for executing the method for calculating the page number of the streaming document subdirectory according to the instructions in the program code.
The present invention also provides a computer-readable storage medium for storing a program code for executing the streaming document subdirectory page number calculation method as described in any one of the above.
According to the technical scheme, the invention has the following advantages: the invention obtains the position ranges of all pages of the streaming document; acquiring directory link positions of all subdirectories of the streaming document; and calculating the page number of each subdirectory according to the position range and the directory link position. The method solves the technical problems of slow loading speed and poor user experience caused by long updating time of the existing streaming document directory updating mode.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without inventive exercise.
Fig. 1 is a flowchart illustrating steps of a method for calculating page numbers of subdirectories of a streaming document according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating steps of a method for calculating page numbers of subdirectories of a streaming document according to another embodiment of the present invention;
FIG. 3 is a flowchart of the steps for calculating the page number of each sub-directory according to the location range and the directory link location according to the embodiment of the present invention;
fig. 4 is a block diagram of a structure of a streaming document subdirectory page number calculation apparatus according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a method and a device for calculating page numbers of a subdirectory of a streaming document, which are used for solving the technical problems of low loading speed and poor user experience caused by long updating time of the existing updating mode of the directory of the streaming document.
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the embodiments described below are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating steps of a method for calculating page numbers of a subdirectory of a streaming document according to an embodiment of the present invention.
The invention provides a method for calculating the page number of a subdirectory of a streaming document, wherein the streaming document is provided with a plurality of pages and a plurality of subdirectories, and the method comprises the following steps:
step 101, acquiring position ranges of all pages of a streaming document;
in the embodiment of the invention, the position range refers to the unique coordinate of the characters or pictures in the document, and the position range is a relative coordinate with a coordinate value as a positive integer, and the relative coordinate can be determined according to the byte number of the file.
In a specific implementation, in order to calculate the page number of each subdirectory, the position ranges of all pages of the streaming document need to be acquired first.
For example, taking the NeoReader reader as an example, a 1MB sized epub document, the NeoReader defines a location range of [0, 1048576 ]. Assuming that the document has ten chapters, each chapter can directly determine the position range of each chapter according to the chapter file size, and the position ranges from the first chapter to the tenth chapter are as follows: [0,1000),[1000,5000),[5000,12345),[12345,56789),[56789,67890),[67890,112345),[112345,156789),[156789,167890),[167890,178901),[178901,1048576).
102, acquiring directory link positions of all subdirectories of the streaming document;
the directory link location is the unique coordinate of each sub-directory in the document, is a relative coordinate in the form of a positive integer, and can be determined according to the number of bytes of the file.
In the embodiment of the invention, the position range of all the pages of the streaming document covers the directory link positions of the subdirectories. Therefore, in order to calculate the page number of each subdirectory, it is necessary to acquire the directory link position of each subdirectory.
And 103, calculating the page number of each subdirectory according to the position range and the directory link position.
After the position range of each page of the streaming document and the directory link position of each subdirectory are obtained, the page where each subdirectory is located can be obtained through matching according to the directory link position of each subdirectory and the position range of each page, and the page number of the page is the page number of the corresponding subdirectory. By matching each subdirectory, the page number of each subdirectory can be obtained.
The invention obtains the position ranges of all pages of the streaming document; acquiring directory link positions of all subdirectories of the streaming document; and calculating the page number of each subdirectory according to the position range and the directory link position. The method solves the technical problems of slow loading speed and poor user experience caused by long updating time of the existing streaming document directory updating mode.
Referring to fig. 2, fig. 2 is a flowchart illustrating steps of a method for calculating page numbers of a subdirectory of a streaming document according to another embodiment of the present invention. The method specifically comprises the following steps:
step 201, obtaining a document page table of a streaming document;
in the embodiment of the invention, a document Page table is composed of Page information pages and is an array structure, and one Page comprises the starting position and the ending position of the Page; specifically, in the embodiment of the present invention, the page table is sorted in order of page numbers from small to large.
In one example, taking an epub document of 1MB size as an example, assuming that the document has ten chapters, if the streaming document is not typeset, the page table is a chapter position table, and the start position and the end position of each chapter are recorded in the page table; if the streaming document is typeset, the page table range is the starting and ending positions of each page, and the page table range within each chapter must be between [ chapter starting position, chapter ending position ].
Step 202, extracting the position ranges of all pages from a document page table;
after the document page table of the streaming document is obtained, the position range of each page can be obtained.
Step 203, obtaining directory link positions of all subdirectories of the streaming document;
the directory link location is the unique coordinate of each sub-directory in the document, is a relative coordinate in the form of a positive integer, and can be determined according to the number of bytes of the file.
In the embodiment of the invention, the position range of all the pages of the streaming document covers the directory link positions of the subdirectories. Therefore, in order to calculate the page number of each subdirectory, it is necessary to acquire the directory link position of each subdirectory.
Step 204, sorting all pages according to ascending order according to all position ranges to obtain page position sorting;
in the embodiment of the present invention, after the position ranges of all the pages are obtained, all the position ranges may be sorted in an ascending order to obtain the page position sorting.
Step 205, sorting all the subdirectories in ascending order according to the link positions of all the directories to obtain subdirectory sorting;
in the embodiment of the present invention, after the directory link positions of all the subdirectories are obtained, all the directory link positions may be sorted in an ascending order to obtain the subdirectory sorting of the corresponding subdirectories.
And step 206, comparing the position range with the directory link position according to the page position sorting and the subdirectory sorting, and calculating the page number of each subdirectory.
In the embodiment of the present invention, after the page position sorting and the subdirectory sorting are obtained, the directory link position may be matched with the position range of the page based on the page position sorting and the subdirectory sorting, and the page where each subdirectory is located is obtained through matching, where the page number of the page is the page number of the corresponding subdirectory. By matching each subdirectory, the page number of each subdirectory can be obtained.
In one example, as shown in fig. 3, step 206 may include the following sub-steps:
s61, determining the current page according to the page sequence, and obtaining the current position range and the page number of the current page;
s62, determining the current subdirectory in the undetermined subdirectories according to the subdirectory sorting;
s63, acquiring the target directory link position of the current subdirectory;
s64, judging whether the link position of the target directory is in the current position range;
s65, when the link position of the target directory is within the current position range, determining the page number of the page as the page number of the current subdirectory;
s66, determining the next subdirectory as the current subdirectory, and returning to the step of obtaining the target directory link position of the current subdirectory;
s67, when the link position of the target directory is larger than the current position range, determining the next page as the current page, acquiring the current position range and the page number of the current page, and returning to the step of determining the current subdirectory in the undetermined subdirectories according to the subdirectory sorting so as to calculate the page number of each subdirectory.
In a specific implementation, the current page may be determined according to the page rank, where the current page is a page that is the most ranked of the unmatched pages, and if all the pages are matched, the current page is a page with the smallest page number. Further, the current subdirectory can be determined according to the subdirectory sorting, the current subdirectory is the subdirectory with undetermined page number, the top subdirectory is sorted, and if the page numbers of all the subdirectories are undetermined, the current subdirectory is the first subdirectory in the subdirectory sorting. Taking the first subdirectory as the current subdirectory as an example, after the current subdirectory is determined, sequentially comparing the position range of each page with the target directory link position of the current subdirectory (since the current subdirectory is not compared with any subdirectory, the position ranges of all pages are non-compared position ranges), when the comparison finds that the target directory link position of the current subdirectory is larger than the position range of the current page, indicating that the target directory link position of the current subdirectory is in the following page, and taking down the page according to page position sorting and comparing the target directory link position of the current subdirectory; and when the target position range where the link position of the target directory is located is compared, stopping comparison, and determining the page number of the page corresponding to the target position range as the page number of the current subdirectory. And records the index of the current subdirectory into a predefined variable lastTocIndex and marks it as the last updated index.
And then, acquiring indexes in the variables, determining a next subdirectory by combining with the sorting of the subdirectories, determining the next subdirectory as the current subdirectory, and repeating the comparison with the position range of the current page until the page number of each subdirectory is obtained by calculation.
It should be noted that the index of the subdirectory may be a corner mark of the subdirectory in the directory table, and each index is unique and corresponds to the subdirectory one by one.
The predefined variable lastTocIndex may have an initial value of-1, meaning that no page number for any one of the subdirectories has been determined. For each current subdirectory, the index is obtained from the lastTocIndex, and the first subdirectory under the subdirectory index is taken as the current subdirectory in combination with the subdirectory sorting. For example, when the index obtained from lastTocIndex is-1, the subdirectory with the index of 1- +1 ═ 0 is taken as the current subdirectory, i.e., the first subdirectory is taken as the current subdirectory. By analogy, each time the page number of a subdirectory is determined, the index is saved in lastTocIndex, and the next subdirectory can be traversed in sequence.
According to the above contents, in the process of calculating the page numbers of all the subdirectories, the subdirectories are traversed once, and the position range of the page is compared with the position range of the page which is not compared according to the page position sequence every time the page is compared with the subdirectories, so that the position range of the page is traversed once, which is equivalent to that the page table is traversed once, and compared with the prior art, the traversal times of the page table of the page are greatly reduced. Taking an epub document with a size of 145MB as an example, the document includes 3362 subdirectories, and after typesetting, the total page number is 15917, in the existing scheme, it takes 4500ms probably to update the page numbers of all the subdirectories, but the embodiment of the present invention only takes 15 ms. Compared with the prior art, the method has the advantages that the calculation speed of the page numbers of the subdirectories is optimized, the directory loading speed is increased, and the reading experience of users is improved.
The invention obtains the position ranges of all pages of the streaming document; acquiring directory link positions of all subdirectories of the streaming document; and calculating the page number of each subdirectory according to the position range and the directory link position. The method solves the technical problems of slow loading speed and poor user experience caused by long updating time of the existing streaming document directory updating mode.
Referring to fig. 4, fig. 4 is a block diagram illustrating a structure of a device for calculating page numbers of a sub-directory of a streaming document according to an embodiment of the present invention.
The embodiment of the invention provides a page number calculation device for a subdirectory of a streaming document, wherein the streaming document is provided with a plurality of pages and a plurality of subdirectories, and the device comprises:
a position range obtaining module 401, configured to obtain position ranges of all pages of the streaming document;
a directory link position obtaining module 402, configured to obtain directory link positions of all subdirectories of the streaming document;
and a page number calculating module 403, configured to calculate a page number of each sub-directory according to the location range and the directory link location.
In this embodiment of the present invention, the position range obtaining module 401 includes:
the document page table acquisition submodule is used for acquiring a document page table of the streaming document;
and the position range acquisition submodule is used for acquiring the position ranges of all the pages from the document page table.
In this embodiment of the present invention, the page number calculating module 403 includes:
the page position ordering obtaining sub-module is used for ordering all the pages according to the ascending order according to all the position ranges to obtain page position ordering;
the subdirectory ordering acquisition submodule is used for ordering all subdirectories in an ascending order according to the link positions of all the subdirectories to obtain subdirectory ordering;
and the page number calculation submodule is used for calculating the page number of each subdirectory according to the page position sorting and the subdirectory sorting by comparing the position range with the directory link position.
In an embodiment of the present invention, the page number calculation submodule includes:
the current page determining unit is used for determining a current page according to the page sequence and acquiring the current position range and the page number of the current page;
the current subdirectory determining unit is used for determining the current subdirectory in the undetermined subdirectories according to the subdirectory sorting;
the target directory link position acquisition unit is used for acquiring a target directory link position of the current subdirectory;
the judging unit is used for judging whether the link position of the target directory is within the current position range or not;
the page number determining unit is used for determining the page number of the page as the page number of the current subdirectory when the link position of the target directory is within the current position range;
the first returning unit is used for determining the next subdirectory as the current subdirectory and returning to the step of obtaining the target directory link position of the current subdirectory;
and the second returning unit is used for determining the next page as the current page when the link position of the target directory is larger than the current position range, acquiring the current position range and the page number of the current page, and returning to the step of determining the current subdirectory in the undetermined subdirectories according to the subdirectory sorting so as to calculate the page number of each subdirectory.
In an embodiment of the present invention, the first returning unit includes:
and the current subdirectory determining subunit is used for acquiring the index of the current subdirectory, determining the next subdirectory according to the index and the subdirectory sorting, taking the next subdirectory as the current subdirectory, and returning to the execution target directory link position determining unit.
An embodiment of the present invention further provides an electronic device, where the device includes a processor and a memory:
the memory is used for storing the program codes and transmitting the program codes to the processor;
the processor is used for executing the method for calculating the page number of the subdirectory of the streaming document according to the instructions in the program codes.
The embodiment of the invention also provides a computer-readable storage medium, which is used for storing a program code, and the program code is used for executing the method for calculating the page number of the streaming document subdirectory.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for calculating the page number of a subdirectory of a streaming document, wherein the streaming document has a plurality of pages and a plurality of subdirectories, the method comprising:
acquiring the position ranges of all the pages of the streaming document;
acquiring directory link positions of all the subdirectories of the streaming document;
and calculating the page number of each subdirectory according to the position range and the directory link position.
2. The method of claim 1, wherein the step of obtaining the position ranges of all the pages of the streaming document comprises:
obtaining a document page table of the streaming document;
and acquiring the position ranges of all the pages from the document page table.
3. The method of claim 2, wherein the step of calculating the page number of each of the subdirectories according to the location range and the directory link location comprises:
sorting all the pages in ascending order according to all the position ranges to obtain page position sorting;
sorting all the subdirectories in an ascending order according to the link positions of all the directories to obtain subdirectory sorting;
and comparing the position range with the directory link position according to the page position sequence and the subdirectory sequence, and calculating the page number of each subdirectory.
4. The method of claim 3, wherein the step of comparing the location range to the directory link location according to the page rank and the subdirectory rank to calculate the page number of each subdirectory comprises:
determining a current page according to the page sequence, and acquiring a current position range and a page number of the current page;
determining the current subdirectory in the undetermined subdirectories according to the subdirectory sorting;
acquiring a target directory link position of the current subdirectory;
judging whether the link position of the target directory is within the current position range;
when the link position of the target directory is within the current position range, determining the page number of the page as the page number of the current subdirectory;
determining the next subdirectory as the current subdirectory and returning to the step of obtaining the target directory link position of the current subdirectory;
and when the link position of the target directory is larger than the current position range, determining the next page as the current page, acquiring the current position range and the page number of the current page, and returning to the step of determining the current subdirectory in undetermined subdirectories according to the subdirectory sorting so as to calculate the page number of each subdirectory.
5. The method of claim 4, wherein the step of determining the next subdirectory as the current subdirectory comprises:
and acquiring the index of the current subdirectory, determining a next subdirectory according to the index and the subdirectory ordering, and taking the next subdirectory as the current subdirectory.
6. A streaming document subdirectory page number computing apparatus, wherein the streaming document has a plurality of pages and a plurality of subdirectories, the apparatus comprising:
a position range obtaining module, configured to obtain position ranges of all the pages of the streaming document;
a directory link position acquisition module, configured to acquire directory link positions of all the subdirectories of the streaming document;
and the page number calculation module is used for calculating the page number of each subdirectory according to the position range and the directory link position.
7. The apparatus of claim 6, wherein the location range obtaining module comprises:
the document page table obtaining sub-module is used for obtaining a document page table of the streaming document;
and the position range acquisition submodule is used for acquiring the position ranges of all the pages from the document page table.
8. The apparatus of claim 7, wherein the page number calculation module comprises:
the page position ordering obtaining sub-module is used for ordering all the pages according to the position ranges in an ascending order to obtain page position ordering;
the subdirectory ordering acquisition sub-module is used for ordering all the subdirectories in an ascending order according to all the directory link positions to obtain subdirectory ordering;
and the page number calculation submodule is used for comparing the position range with the directory link position according to the page position sequence and the subdirectory sequence and calculating the page number of each subdirectory.
9. An electronic device, comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is used for executing the method for calculating the page number of the subdirectory of the streaming document according to the instructions in the program code, wherein the method is as defined in any one of claims 1 to 5.
10. A computer-readable storage medium for storing a program code for executing the streaming document subdirectory page number calculation method according to any one of claims 1 to 5.
CN202110246409.1A 2021-03-05 2021-03-05 Method and device for calculating page number of subdirectory of streaming document Active CN112965646B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110246409.1A CN112965646B (en) 2021-03-05 2021-03-05 Method and device for calculating page number of subdirectory of streaming document

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110246409.1A CN112965646B (en) 2021-03-05 2021-03-05 Method and device for calculating page number of subdirectory of streaming document

Publications (2)

Publication Number Publication Date
CN112965646A CN112965646A (en) 2021-06-15
CN112965646B true CN112965646B (en) 2021-09-14

Family

ID=76276606

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110246409.1A Active CN112965646B (en) 2021-03-05 2021-03-05 Method and device for calculating page number of subdirectory of streaming document

Country Status (1)

Country Link
CN (1) CN112965646B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102332023A (en) * 2011-09-27 2012-01-25 北京中科希望软件股份有限公司 Method and system for fast semantic annotation of e-book
CN104111922A (en) * 2013-04-16 2014-10-22 北大方正集团有限公司 Processing method and device of streaming document
CN105095166A (en) * 2014-05-07 2015-11-25 金舷国际文创事业有限公司 Method for generating stream-type electronic book and website system
CN105279254A (en) * 2015-10-12 2016-01-27 江苏中威科技软件系统有限公司 Layout data stream file system, operation apparatus for system and realization method for apparatus
CN106445952A (en) * 2015-08-07 2017-02-22 阿里巴巴集团控股有限公司 Page switching control method and apparatus in webpage

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130339830A1 (en) * 2012-06-15 2013-12-19 Microsoft Corporation Optimized document views for mobile device interfaces

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102332023A (en) * 2011-09-27 2012-01-25 北京中科希望软件股份有限公司 Method and system for fast semantic annotation of e-book
CN104111922A (en) * 2013-04-16 2014-10-22 北大方正集团有限公司 Processing method and device of streaming document
CN105095166A (en) * 2014-05-07 2015-11-25 金舷国际文创事业有限公司 Method for generating stream-type electronic book and website system
CN106445952A (en) * 2015-08-07 2017-02-22 阿里巴巴集团控股有限公司 Page switching control method and apparatus in webpage
CN105279254A (en) * 2015-10-12 2016-01-27 江苏中威科技软件系统有限公司 Layout data stream file system, operation apparatus for system and realization method for apparatus

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
流式文档分页模式探究;熊雨前 等;《计算机光盘软件与应用》;20101231;全文 *
流式文档到固定版式文档的可逆转换方法研究;李宁 等;《北京大学学报(自然科学版)》;20150331;第51卷(第2期);全文 *

Also Published As

Publication number Publication date
CN112965646A (en) 2021-06-15

Similar Documents

Publication Publication Date Title
CN103488766A (en) Application program searching method and device
CN108171267A (en) User group partitioning method and device, information push method and device
CN101154224A (en) Websites navigation method and system thereof
CN103729356B (en) Web page address reminding method and device
US20140229601A1 (en) URL Navigation Page Generation Method, Device and Program
CN113778295A (en) Book recommendation method and device, computer equipment and storage medium
CN113961794A (en) Book recommendation method and device, computer equipment and storage medium
CN102016782B (en) Operation assistance system and operation assistance method
CN110688009A (en) Application program access method and device of folding screen terminal
CN106371706A (en) Method and device for site selection of application shortcuts
CN114817726A (en) Topic recommendation method and device, computer equipment and storage medium
CN105893438A (en) Search prompting method and apparatus
CN114328983A (en) Document fragmenting method, data retrieval device and electronic equipment
CN112965646B (en) Method and device for calculating page number of subdirectory of streaming document
CN113641894A (en) Information recommendation method and device
CN110909247B (en) Text information pushing method, electronic equipment and computer storage medium
CN110688460B (en) Risk identification method and device, readable storage medium and electronic equipment
CN110209904B (en) Information classification method and device and storage medium
JP6991255B2 (en) Media search method and equipment
CN107305552A (en) Aid reading method and apparatus
CN110334267A (en) A kind of content search method based on block chain, device and electronic equipment
CN108256064A (en) A kind of data search method and device
KR20110112116A (en) Searching method and system based on topic
CN112698866A (en) Code line life cycle tracing method based on Git and electronic device
CN111694928A (en) Data index recommendation method and device, computer equipment and readable 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