C# HTML转PDF 页面内容太大怎么分页?
public void writeLog(string sMessage)
{
//FileStream fs = new FileStream(Server.MapPath("pagetohtml.htm"), FileMode.Append);
try
{
StreamWriter swriter = File.CreateText(Server.MapPath("pagetohtml.htm"));
swriter.WriteLine(sMessage);
swriter.Close();
}
catch
{ }
}
private System.Drawing.Bitmap bitmap;
private string url;
private int w = 760, h = 900;
public void setBitmap()
{
using (WebBrowser wb = new WebBrowser())
{
wb.Width = w;
wb.Height = h;
wb.ScrollBarsEnabled = false;
wb.Navigate(url);
//确保页面被解析完全
while (wb.ReadyState != WebBrowserReadyState.Complete)
{
System.Windows.Forms.Application.DoEvents();
}
bitmap = new System.Drawing.Bitmap(w, h);
wb.DrawToBitmap(bitmap, new System.Drawing.Rectangle(0, 0, w, h));
wb.Dispose();
}
}
private void CreatPdf()
{
Document doc = new Document(PageSize.A4