你好,我有以下代码并尝试将一个html页面转换为pdf。我正在使用abcpdf。
我的代码如下:
Doc theDoc = new Doc();
theDoc.Rect.Inset(72, 144);
theDoc.Page = theDoc.AddPage();
int theID;
**theID = theDoc.AddImageUrl("http://www.templateworld.com/free_templates.html/");**
while (true)
{
theDoc.FrameRect(); // add a black border
if (!theDoc.Chainable(theID))
break;
theDoc.Page = theDoc.AddPage();
theID = theDoc.AddImageToChain(theID);
}
for (int i = 1; i <= theDoc.PageCount; i++)
{
theDoc.PageNumber = i;
theDoc.Flatten();
}
theDoc.Save(Server.MapPath("pagedhtml.pdf"));
theDoc.Clear();
在以下代码行:
theID = theDoc.AddImageUrl("http://www.templateworld.com/free_templates.html/");
出现了“HTML渲染为空”的错误。我也在Firefox和Chrome上尝试过,使用了其他网址,但仍然出现相同的错误。
有人知道如何解决这个问题吗?