I have a very long article with over 50 pages in length in a single HTML document. I would like to know if there's an algorithm that can spl开发者_JS百科it the HTML document by page (A4 sized page), kind of like the print preview function, into smaller files for each page while maintaining proper formatting.
I use .NET 4.0 C#
This doesn't always work, but sometimes you can print the document to PDF, split the PDF into one PDF per page, and convert those PDFs to HTML files. The result isn't always pretty, though.
You can use HTMLDOC to split HTML into pages:
Here's a blogpost explaining the process
Have you tried using a virtual printer such as CutePDF and print the document to a PDF? Also, according to the website I linked, CutePDF has it's own SDK.
It's not clear why do you want to do so, but, try simply opening your page in Microsoft Word. Microsoft Word has the "Print Layout" where you will see your document by page. Eventually you will be able to edit it to make it fit.
精彩评论