在Pechkin中不渲染的背景颜色生成PDF

时间:2021-12-02 19:33:08

I'm generating a PDF file based on some HTML, using the pechkin dll.

我正在使用pechkin dll基于某些HTML生成PDF文件。

This is all working nicely except the background colors are not being rendered.

除了没有渲染背景颜色之外,这一切都很好用。

An example of the HTML I'm using is:

我正在使用的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>

The code I'm using to generate the PDF is as below:

我用来生成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

I've seen articles around the net that seem to indicate that my code should work fine, but it's not.

我在网上看到的文章似乎表明我的代码应该可以正常工作,但事实并非如此。

1 个解决方案

#1


4  

From memory I had to add this to see backgrounds:

从内存中我不得不添加它来查看背景:

.SetPrintBackground(true)
.SetScreenMediaType(true)

#1


4  

From memory I had to add this to see backgrounds:

从内存中我不得不添加它来查看背景:

.SetPrintBackground(true)
.SetScreenMediaType(true)