C#HTML到PDF $ C $下在服务的使用(在服务器上) [英] C# HTML to PDF code for use in a service (on a server)

查看:233
本文介绍了C#HTML到PDF $ C $下在服务的使用(在服务器上)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找一些C#code,从所呈现的HTML页面的服务器上创建一个.PDF文件。我想转换为pdf格式的HTML的结构和内容是pretty的简单(DIV,表,图像等),所以我需要code表示将:

I'm looking for some C# code to create a .PDF document on a server from an HTML page that is rendered. The structure and content of the HTML that I want to convert to .PDF is pretty simple (DIV, TABLE, IMAGE, etc.) so I need code that will:

  1. 创建一个文档,该文档可保存由客户端的浏览(在他们点击另存为.PDF)
  2. 在处理HTML流,并把它转换成.PDF
  3. 在手柄将图像添加到文档
  4. 指定文档的分辨率(?) - 这将是东西,我会想打印质量(高DPI和我嵌入将高分辨率图像)

我看到的这么多问题,但寻找一个小时左右后,我无法找到一个很好的起点,构建关中。任何指针将是巨大的......最好我正在寻找一些源$ C ​​$ C,我可以使用,而不是购买的组件或它所有Web服务。

I have seen many questions on this but after searching for an hour or so I was unable to find a good starting point to build off of. Any pointers would be great... ideally I'm looking for some source code that I can use and not a purchasable component or a web service that does it all.

推荐答案

你看着wkhtmltopdf?它是开源的,虽然LGPL,但确实是我​​能找到的最好的转换。这是命令行,所以要在服务器上运行正常。 HTTP://$c$c.google.com/p/wkhtmltopdf/

Have you looked at wkhtmltopdf? It is open source, though LGPL, but does the best conversion that I can find. It is command line, so should run fine on a server. http://code.google.com/p/wkhtmltopdf/

另请参见:<一href="http://stackoverflow.com/questions/1331926/calling-wkhtmltopdf-to-generate-pdf-from-html/1698839#1698839">Calling wkhtmltopdf生成与HTML 的PDF文件在C#中的说明

Also see: Calling wkhtmltopdf to generate PDF from HTML for instructions in c#

这篇关于C#HTML到PDF $ C $下在服务的使用(在服务器上)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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