使用.net将html转换为pdf [英] html to pdf conversion using .net

查看:103
本文介绍了使用.net将html转换为pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在寻找一种将MHTML文件转换为PDF类型的方法.是否可以使用.Net编码来做到这一点?

谢谢

问候
Swahit

Hi,
I am looking for a way of Converting MHTML file to PDF type . Is there any way to do this using .Net coding?

thanks

regards
Swahit

推荐答案

是的.不过,您必须付费才能这样做. .NET中没有PDF功能. HTML造成了另一个问题.假设浏览器不完全相同,则由哪种浏览器呈现的HTML?到什么尺寸?但是,我敢肯定,您至少可以编写代码通过网络浏览器控件将HTML转换为位图,而且我知道您可以购买将图像转换为PDF的库.
yes, there is. You have to pay for a library to do it, though. There''s no PDF functionality in .NET. HTML creates another issue. HTML rendered by what browser, given that they are not all the same ? To what dimensions ? But, I''m sure that at a minimum, you can write code to turn HTML in to a bitmap through a web browser control, and I know you can buy libraries to turn images in to PDFs.


代码项目中有很多文章

Pdfizer,C#中的哑HTML到PDF转换器 [使用ASP.NET从HTML页面生成PDF文档 [将ASP.NET网页转换为PDF [ ^ ]

在PDF中显示HTML [如何创建PDF HTML页面中的文件asp.net C# [
There are many articles in codeproject

Pdfizer, a dumb HTML to PDF converter, in C#[^]

Generate PDF documents from a HTML page using ASP.NET[^]

Convert ASP.NET web page to PDF[^]

Show HTML In PDF[^]

How to create PDF file from a HTML page asp.net C#[^]

And many more... Just google it.

Thanks.


您可以看看CodeProject的有关PDF操作的文章 [ ^ ].
但是,如果您的HTML文档非常简单,则可以尝试开发自己的转换算法:您必须解析HTML,然后根据PDF规范创建PDF文件(请参见 ^ ](这并非不可能,有人完成了反向任务,请参见 [
You may have a look at CodeProject''s articles about PDF manipulation[^].
However, if your HTML document is very simple then you may try to develop yourself the conversion algorithm: you have to parse the HTML and then create the PDF file according to PDF specifications ( see here[^] (it is not impossible, someone did it for the reverse task, see the "Code to extract plain text from a PDF file"[^] article).


这篇关于使用.net将html转换为pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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