在asp.net中从html生成pdf [英] generate pdf from html in asp.net
本文介绍了在asp.net中从html生成pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
我有以下代码
hello guys
i have following code
ArrayList htmlelement = HTMLWorker.ParseToList(new StringReader(content), null);
foreach (ArrayList htmlElement in htmlelement)
Document.Add(htmlElement as IElement);
该内容中的是html文件
有一些文字和一张桌子.
前言添加了所有文本
但是当他阅读表格时,出现以下错误
in this content is html file
having some text and 1 table.
the foreeach added all text
but when he read the table it give the following error
Unable to cast object of type 'iTextSharp.text.pdf.PdfPTable' to type 'System.Collections.ArrayList'.
谢谢
@ ChetanV @
thank you
@ChetanV@
推荐答案
var htmlelement = HTMLWorker.ParseToList(new StringReader(content), null);
foreach (var htmlElement in htmlelement)
Document.Add(htmlElement as IElement);
如错误提示所示,类型不正确.
PdfPTable无法转换为ArrayList.
您可能需要查看iTextSharp文档以获取帮助.
As the error suggests, the types are incorrect.
PdfPTable cannot be converted to an ArrayList.
You might need to check the iTextSharp documentation for help.
这篇关于在asp.net中从html生成pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文