set new page in HTML using iTextSharp HTMLWorker (html to pdf)

女生的网名这么多〃 提交于 2019-12-08 16:49:13

问题


I using iTextSharp (V 5.4.2.0) to convert a html page to pdf. But I would like to be able to set a new page.

I've tried this:

<div style="page-break-before:always">&nbsp;</div>

and the tag <newpage />

But it doesn't work. What is the best way, to create a html page, including new page tags (or something) to be able to convert it correctly using iTextSharp?

Kind regards,

Matthijs


回答1:


Use the iTextSharp XML Worker library and then use this HTML:

<div style="page-break-before:always">&nbsp;</div>



回答2:


A <np /> tag in your HTML inserts a page break in the Document/PDF.




回答3:


Use this in C# document.NewPage();



来源:https://stackoverflow.com/questions/17043029/set-new-page-in-html-using-itextsharp-htmlworker-html-to-pdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!