使用CSS支持转换XHTML标记的最佳ASP.NET PDF解决方案是什么?

时间:2021-10-09 21:08:39

I have looked for a good solution for rendering a PDF based on a web page / HTML string, that can also keep the CSS styling.

我已经找到了一个很好的解决方案,用于基于网页/ HTML字符串呈现PDF,这也可以保持CSS样式。

Does anyone know of any good solutions for this?

有谁知道这个有什么好的解决方案吗?

Thanks in advance.

提前致谢。

2 个解决方案

#1


TRY ABCPDF

I have successffully used in the past.

我过去成功地使用过。

#2


I've used the free and open source iTextSharp before with some success. I don't think it supports the case where you have a separate .css file, however it does apply inline css you use (the style attribute).

我之前使用过免费和开源的iTextSharp取得了一些成功。我不认为它支持你有一个单独的.css文件的情况,但它确实应用你使用的内联css(样式属性)。

Typically you end up having to create a separate XHTML page for PDF generation with inline styles (and sometimes tables) in order to get the PDF to look right.

通常,您最终必须使用内联样式(有时是表格)为PDF生成创建单独的XHTML页面,以使PDF看起来正确。

#1


TRY ABCPDF

I have successffully used in the past.

我过去成功地使用过。

#2


I've used the free and open source iTextSharp before with some success. I don't think it supports the case where you have a separate .css file, however it does apply inline css you use (the style attribute).

我之前使用过免费和开源的iTextSharp取得了一些成功。我不认为它支持你有一个单独的.css文件的情况,但它确实应用你使用的内联css(样式属性)。

Typically you end up having to create a separate XHTML page for PDF generation with inline styles (and sometimes tables) in order to get the PDF to look right.

通常,您最终必须使用内联样式(有时是表格)为PDF生成创建单独的XHTML页面,以使PDF看起来正确。