我正在使用 pechkin dll 基于某些 HTML 生成 PDF 文件。
除了背景颜色没有渲染之外,一切都运行良好。
我正在使用的 HTML 示例是:
<table style="border-top: 0px solid black; border-bottom: 2px solid black; background-color: #99ccff; height: 30px; width: 800px;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><strong>Insured Details</strong></td>
</tr>
</tbody>
</table>
我用来生成 PDF 的代码如下:
Dim buf As Byte() = Pechkin.Factory.Create(New GlobalConfig().SetMargins(New Margins(20, 20, 20, 20)) _
.SetDocumentTitle("").SetCopyCount(1).SetImageQuality(100) _
.SetLosslessCompression(True).SetMaxImageDpi(300).SetOutlineGeneration(True).SetOutputDpi(1200).SetPaperOrientation(True) _
.SetPaperSize(PaperKind.A4) _
.SetImageQuality(100) _
.SetPaperOrientation(False)).Convert(New ObjectConfig().SetPrintBackground(True).SetAllowLocalContent(True), strHTML)
Return buf
我在网上看到一些文章似乎表明我的代码应该可以正常工作,但事实并非如此。
最佳答案
根据内存,我必须添加这个才能看到背景:
.SetPrintBackground(true)
.SetScreenMediaType(true)
关于c# - 背景颜色未在 Pechkin 生成的 PDF 中呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25477608/