开发者

Break the HTML file into fixed size pages

I would like to display the content of a开发者_StackOverflow社区 HTML file,in the form of book with many pages(not side by side pages, but one after the other, like PDF), when opened in some browser. Say, i define page width=600px and height=800pz, the content should fit into one page and the remaining should overflow to next page and like that. And it should work for any HTML file. How can i break the content into pages ? In any way XSL helps me to achieve it ?


This should be theoretically possible by putting the document into an iframe that is 800 pixels high, and changing the scroll position inside that iframe (Page 1 = 0px; Page 2 = 800px; Page 3 = 1600px ....)

The HTML page in question would have to be on your domain, though.

There is no proper way to actually display those pages side by side, though. You'd have to clone the whole document for as many times as there are pages, and display as many iframe s with the page scrolled to different positions.

Depending on what you want to do, it might be better to use a different technology for this (e.g. having a browser print out a web page to a PDF file, splitting the content into pages in the process.)


If you want PDF style functionality, convert the html on the fly into a pdf and then embed it in the page. You can specify the width and other params when you are generating the pdf.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜