ASP.NET中的HTML转换为PDF时保持CSS样式 [英] Maintain CSS styling when converting HTML to PDF in ASP.NET
问题描述
我使用iTextSharp的一个HTML页面转换为PDF。
I am using ITextSharp to convert a HTML page to PDF.
不过,iTextSharp的打印在风格声明的CSS直出,编程添加即使忽略样式表和只听一些内联样式(如字体大小和颜色而不是背景色)。
However, ITextSharp prints the CSS in the STYLE declaration straight out, ignores stylesheets even when added programatically and only listens to some inline styles (e.g. font-size and color but not background-color).
时有什么我用iTextSharp的缺失,或者是有这样的转换更好的(免费)的方式?
Is there something I am missing with ITextSharp, or is there a better (and free) way of doing this conversion?
由于提前,
推荐答案
看一看WKHTMLTOPDF。它是开源的,基于WebKit和自由。
Have a look at WKHTMLTOPDF. It is open source, based on webkit and free.
我们写了一个小教程<一个href=\"http://beebole.com/en/blog/general/convert-html-to-pdf-with-full-css-support-an-opensource-alternative-based-on-webkit/\">here.
这篇关于ASP.NET中的HTML转换为PDF时保持CSS样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!