从html页面渲染pdf
Render a pdf from a html page
你好,我有以下代码,我正在尝试将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();
在以下行:
ID=文档添加图像URL("http://www.templateworld.com/free_templates.html/");
它抛出一个错误,说"HTML呈现为空白"。我在Firefox和chrome上也试过同样的操作。我试着用其他url也是如此。我也犯了同样的错误。
有人知道这个问题的解决方案吗?
查看另一篇Stack Overflow文章。也许它会帮助你。
ABCPDF6问题:;HTML呈现为空白";但是网页输出很好
trueamerican420和McAden的回答都很有帮助。
我在InternetExplorer10上使用ABCPDF版本7。我删除了更新并降级为互联网浏览器9。现在一切都很完美
相关文章:
- 如何使用javascript或html下载PDF格式的填写表单
- 在提交时打开thankyou.html+下载PDF
- 生成pdf或其他非html文件时的错误处理
- how to convert html <div> to pdf
- 如何在使用jsPDF将html转换为pdf的同时,在pdf中的某个点进行分页
- 如何将带有大量svg图表的html转换为pdf
- 将php页面的一个部分渲染为HTML和CSS后生成PDF,并考虑PDF分页符
- 如何使用javascript或jquery将整个html页面转换为pdf
- 如果iframe在src(pdf或text)中有非html文档,则iframe中的onload不起作用
- HTML表格导出为具有适当列宽和字体的pdf
- 具有可拖动元素的HTML到PDF
- c# mvc nreco HtmlToPdfConverter 问题将 html 文档转换为 pdf
- 来自HTML图像的jsPDF 会导致 pdf 为空
- 使用 php 将 pdf 文件转换为 html 文件
- HTML到PDF的转换仅在客户端使用JavaScript
- 从横向格式的HTML页面制作PDF
- 使用TableExport.js将HTML表格导出为PDF、WORD、PNG
- HTML和CSS转换为JavaScript中的PDF
- JQuery-HTML到PDF没有'无法在IE中工作(来自C#asmx Web服务)
- 保存样式'导出到pdf'html表