Split HTML file into fixed-size pages

I would like to display the contents of the HTML file in the form of a book with many pages (not side by side pages, but one after the other, for example, PDF), when I open it in some browser. Let's say I define page width = 600px and height = 800pz, the content should fit on one page, and the rest should overflow on the next page, and so on. And it should work for any HTML file. How can I paginate content? Anyway, does XSL help me achieve this?

+3
source share
2 answers

This should be theoretically possible by placing the document in iframewith a height of 800 pixels and changing the scroll position inside this iframe (Page 1 = 0px; Page 2 = 800px; Page 3 = 1600px ....)

However, the HTML page must be in your domain.

There is no right way to actually display these pages side by side. You will have to clone the entire document as many times as there are pages, and display so much iframethat the page scrolls to different positions.

Depending on what you want to do, it would be better to use a different technology for this (for example, if the browser prints a web page in a PDF file, breaking the content into pages in the process.)

0
source

PDF, html pdf . pdf.

0

Source: https://habr.com/ru/post/1783219/


All Articles