Does anyone know how pagination of a large file works? The actual logic, programmatically, of it? For instance, if you have a very 'long' website, does anyon开发者_高级运维e know the logic behind how the site is paginated when the user asks to view a print preview? I'm hoping to do some basic pagination myself, but I'm at a loss at how that actually happens.
Thanks!
These are some papers about pagination algorithms.
- https://www.tug.org/docs/plass/plass-thesis.pdf
- http://www.pi6.fernuni-hagen.de/publ/tr234.pdf
- http://www.pi6.fernuni-hagen.de/publ/tr205.pdf
HTML was not designed with print in mind. There is some CSS support for page breaks... look for the following CSS properties: page-break-after and page-break-before. But I wouldn't count on it working in all browsers.
it's thoughts of Some engineers from Yahoo on how to optimize pagination for large datasets:
http://www.percona.com/ppc2009/PPC2009_mysql_pagination.pdf
You just need to define a style sheet for your print view. The browser will handle the swapping of the style sheet, and it will know because in your html you have defined it as media="print" opposed to "screen"
<link href="printer.css" rel="stylesheet" media="print" type="text/css">
This is how a lot of people do it opposed to supplying a whole "switch to print view"
This link will help you understand the logic the browser uses to layout your page for printing.
How to optimize pages for printing - http://msdn.microsoft.com/en-us/library/dd433064(v=vs.85).aspx
精彩评论