Method and apparatus for paginating electronic documents
First Claim
1. A method of paginating an electronic document comprising:
- receiving, by a processor of a user electronic device comprising a viewport for viewing the electronic document, the electronic document in an unpaginated format;
generating, by the processor, a preliminary layout for the electronic document in the unpaginated format, the preliminary layout having a layout width that is equivalent to a viewport width of the viewport of the user electronic device, the viewport configured to display the electronic document, wherein generating the preliminary layout comprises;
generating a Document Object Model (DOM) tree comprising first byte offset information for a first visual element of the electronic document in the unpaginated format and second byte offset information for a second visual element of the electronic document in the unpaginated format;
determining the second byte offset information for the second visual element indicates an element width that is greater than a width threshold;
reducing the element width of the second visual element to less than or equal to the width threshold; and
generating a second DOM tree with updated second byte offset information in response to the reducing;
computing, by the processor, a final layout for the electronic document in a paginated format based at least in part on;
reviewing the preliminary layout to identify a plurality of horizontal areas to assign one or more page breaks without a visual element spanning multiple pages of the electronic document; and
assigning a page break to one or more of the plurality of horizontal areas;
rendering, by the processor, a current page in the viewport in accordance with the final layout, wherein the current page excludes the first visual element comprising at least a portion excluded by the page break from display within the viewport; and
after changing from the current page to a new page, rendering, by the processor, the new page without re-computing the final layout of the electronic document, wherein the new page includes the first visual element.
1 Assignment
0 Petitions
Accused Products
Abstract
A method and apparatus for paginating documents such as html documents is disclosed. A document viewing engine generates a preliminary layout for the, the preliminary layout having a layout width that is equivalent to a viewport width of a viewport on which the document will be displayed. The document viewing engine computes a final layout for the document based on determining a plurality of horizontal pixel lines where page breaks can be placed without cutting off any element in the document and assigns page breaks to one or more of the plurality of horizontal pixel lines based on a height of the viewport. The document viewing engine identifies, for a current page, one or more visual elements that will not be fully within the viewport if painted. The document viewing engine paints the current page without painting the identified one or more visual elements. After changing from the current page to a new page, the document viewing engine paints the contents of the new page without re-computing the final layout of the document.
-
Citations
22 Claims
-
1. A method of paginating an electronic document comprising:
-
receiving, by a processor of a user electronic device comprising a viewport for viewing the electronic document, the electronic document in an unpaginated format; generating, by the processor, a preliminary layout for the electronic document in the unpaginated format, the preliminary layout having a layout width that is equivalent to a viewport width of the viewport of the user electronic device, the viewport configured to display the electronic document, wherein generating the preliminary layout comprises; generating a Document Object Model (DOM) tree comprising first byte offset information for a first visual element of the electronic document in the unpaginated format and second byte offset information for a second visual element of the electronic document in the unpaginated format; determining the second byte offset information for the second visual element indicates an element width that is greater than a width threshold; reducing the element width of the second visual element to less than or equal to the width threshold; and generating a second DOM tree with updated second byte offset information in response to the reducing; computing, by the processor, a final layout for the electronic document in a paginated format based at least in part on; reviewing the preliminary layout to identify a plurality of horizontal areas to assign one or more page breaks without a visual element spanning multiple pages of the electronic document; and assigning a page break to one or more of the plurality of horizontal areas; rendering, by the processor, a current page in the viewport in accordance with the final layout, wherein the current page excludes the first visual element comprising at least a portion excluded by the page break from display within the viewport; and after changing from the current page to a new page, rendering, by the processor, the new page without re-computing the final layout of the electronic document, wherein the new page includes the first visual element. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. A user device comprising:
-
a memory to store instructions; and a processor of a user electronic device comprising a viewport for viewing the electronic document, the processor to execute the instructions to cause the processor to; receive an electronic document in an unpaginated format; generate a Document Object Model (DOM) tree comprising first byte offset information for a first visual element of the electronic document in the unpaginated format and second byte offset information for a second visual element of the electronic document in the unpaginated format; determine the second byte offset information for the second visual element indicates an element width that is greater than a width threshold; reduce the element width of the second visual element to less than or equal to the width threshold; and generate a second DOM tree with updated second byte offset information in response to the reducing; compute a preliminary layout for the electronic document in the unpaginated format using the DOM tree; identify a plurality of horizontal areas to assign one or more page breaks without a visual element spanning multiple pages of the preliminary layout of the electronic document; compute a final layout comprising a first page break assigned at a first horizontal area of the plurality of horizontal areas; and render a current page in the viewport in accordance with the final layout, wherein the current page excludes the first visual element comprising at least a portion excluded by the first page break from display within the viewport. - View Dependent Claims (11, 12, 13, 14, 15, 16)
-
-
17. A non-transitory computer readable storage medium including instructions that, when executed by a processor, cause the processor to perform a method of paginating an electronic document comprising:
-
receiving, by the processor of a user electronic device comprising a viewport for viewing the electronic document, the electronic document in an unpaginated format; generating, by the processor, a preliminary layout for the electronic document in the unpaginated format, including assigning a layout width, determining sizes and positions of visual elements included in the electronic document, wherein generating the preliminary layout comprises; generating a Document Object Model (DOM) tree comprising first byte offset information for a first visual element of the electronic document in the unpaginated format and second byte offset information for a second visual element of the electronic document in the unpaginated format; determining the second byte offset information for the second visual element indicates an element width that is greater than a width threshold; reducing the element width of the second visual element to less than or equal to the width threshold; and generating a second DOM tree with updated second byte offset information in response to the reducing; computing, by the processor, a final layout for the electronic document in a paginated format based at least in part on; reviewing the preliminary layout to identify a plurality of horizontal areas to assign one or more page breaks without a visual element spanning multiple pages of the electronic document; and assigning a page break to one or more of the plurality of horizontal areas; rendering, by the processor, a current page in the viewport in accordance with the final layout, wherein the current page excludes the first visual element comprising at least a portion excluded by the page break from display within the viewport; and after changing from the current page to a new page, rendering, by the processor, the new page without re-computing the final layout of the electronic document, wherein the new page includes the first visual element. - View Dependent Claims (18, 19, 20, 21, 22)
-
Specification