如何在Asp.net中将外部CssStyles的Html导出为pdf [英] How to export Html with External CssStyles into pdf in Asp.net

查看:83
本文介绍了如何在Asp.net中将外部CssStyles的Html导出为pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨everey one,可以将外部CssStyles(如背景颜色,图像)的Html导出到Asp.net的pdf中吗?如果有可能请尽快给我建议....

Hi everey one,is possible export Html with External CssStyles( like background color,image) into pdf in Asp.net ? if it possible please give suggestion to me as soon possible....

推荐答案

看看 wkhtmltopdf [ ^ ] project,这是使用webkit渲染引擎将 html转换为pdf 的简单shell实用程序,以及qt。我在我的项目中使用它大约两年,它运行得很好。 />
用法:
Look at the wkhtmltopdf[^] project, which is "simple shell utility to convert html to pdf using the webkit rendering engine, and qt." I''m using this in my project about two years and it works just fine.
Usage:
wkhtmltopdf www.myhomepage.com myhomepage.pdf


本地文件的


for local file:

wkhtmltopdf c:\path\to\file.html file.pdf



.html扩展名是强制性的,以防您想使用临时文件!



要从代码执行其他程序,请使用流程类 [ ^ ], ProcessStartInfo Class [ ^ ] 。


您好!

您可以使用某些第三方库将HTML转换为PDF。例如,您可能希望查看Elerium HTML to PDF组件。它允许将html string / file / url转换为PDF,包括样式,但它不是免费的。您只需要HTML文件或字符串,其中包含对外部css文件的引用。



您也可以尝试iTextSharp。它是免费的,但我不知道它是否正确使用外部样式。
Hello!
You can use some 3rd party libraries to convert HTML to PDF. For examle you may want to look at Elerium HTML to PDF component. It allows to convert html string/file/url to PDF including styles, but it is not free. All you need is HTML file or string that contains a reference to an external css file.

You can also try iTextSharp. It is free but i don''t know does it work with external styles correctly.


这篇关于如何在Asp.net中将外部CssStyles的Html导出为pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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