Background colors not rendering in Pechkin generated PDF

1.7k Views Asked by At

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

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

An example of the HTML I'm using is:

<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:

 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

There are 1 best solutions below

0
On BEST ANSWER

From memory I had to add this to see backgrounds:

.SetPrintBackground(true)
.SetScreenMediaType(true)