我已经在包括Chrome在内的所有主要浏览器中成功使用了以下方法:
<!DOCTYPE html><html> <head> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> <title>Paginated HTML</title> <style type="text/css" media="print"> div.page { page-break-after: always; page-break-inside: avoid; } </style> </head> <body> <div > <h1>This is Page 1</h1> </div> <div > <h1>This is Page 2</h1> </div> <div > <h1>This is Page 3</h1> </div> </body></html>这是一个简化的示例。在实际代码中,每个页面div包含更多元素。



