有没有.NET库,将一个HTML输出转换为PDF格式---在一个asp.net应用程序。
Is there any .net library which would convert a HTML output to PDF --- in an asp.net application.
不要紧,如果它是免费的或不
Doesn't matter if it is free or not
根据我自己的经验,我建议的 ABCpdf 库(它不是免费的,但你可以得到一个试用许可证)。看看他们文档部分。
Based on my own experience I'd suggest ABCpdf library (it's not free, but you can get a trial license). Check out their documentation section for how to add HTML output to the PDF document.
简单的例子:
string html = "<html>....</html>";
WebSupergoo.ABCpdf7.Doc doc = new WebSupergoo.ABCpdf7.Doc();
doc.Rect.Left = 10;
doc.Rect.Bottom = 50;
doc.Rect.Top = 750;
doc.Rect.Right = 600;
doc.SetInfo(0, "License", "[your license code || trial license"]);
doc.Page = doc.AddPage();
int pageID = doc.AddImageHtml(html, true, 1024, true);
while (doc.Chainable(pageID))
{
doc.Page = doc.AddPage();
pageID = doc.AddImageToChain(pageID);
}
for(int i = 1; i < doc.PageCount; i++)
{
doc.PageNumber = i;
doc.Flatten();
}
doc.Save("myfile.pdf");
希望这会帮助你。
Hope this will help you.