用于C#控制台应用程序的HTML到PDF转换器? [英] HTML to PDF converter for a C# console application?

查看:100
本文介绍了用于C#控制台应用程序的HTML到PDF转换器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个用于C#控制台应用程序的PDF转换器,它将HTML作为输入。请建议您使用的转换器,如果您知道它有任何问题。

I need a PDF converter for a C# console application, which takes HTML as input. Please suggest a converter you have used and if you know of any problems with it.

推荐答案

要获得您的输入,您可能需要也可能不需要解析HTML(也许,您从数据生成HTML,然后,您需要生成HTML和PDF,而不是解析。理想情况下,HTML应该是格式良好的XML,然后您可以使用.NET XML解析器之一解析它。不幸的是,并非所有网页都是这样的,因此您可能需要HTML解析器,它不需要格式良好的XML兼容性。试试这个: http://www.majestic12.co.uk/projects/html_parser.php [ ^ ]。



要使用PDF,请使用iText或其.NET端口,iTextSharp:

http://en.wikipedia.org/wiki/IText [ ^ ],

http://itextpdf.com/ [ ^ ],

http://sourceforge.net/projects/itextsharp/ [ ^ ]。



包括对Java iText网站的引用,因为大多数文档都在那里。如果您了解C#,那么理解基于Java的API文档并不困难。



-SA
To get your input, you may or may not need to parse HTML (maybe, you generate HTML from data, then, instead of parsing, you would need to generate both HTML and PDF). Ideally, you HTML should be well-formed as XML, then you could parse it using one of .NET XML parsers. Not all Web pages are like that, unfortunately, so you may need HTML parser which does not require well-formed XML compliance. Try this one: http://www.majestic12.co.uk/projects/html_parser.php[^].

To work with PDF, use iText, or its .NET port, iTextSharp:
http://en.wikipedia.org/wiki/IText[^],
http://itextpdf.com/[^],
http://sourceforge.net/projects/itextsharp/[^].

In included the reference to Java iText site as well, because most documentation is there. If you understand C#, it would not be difficult to understand Java-bases API documentation.

—SA

这篇关于用于C#控制台应用程序的HTML到PDF转换器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆