How To Do A Page Break in a PDF Generated Using Pechkin

2.6k 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 I need to it add a page break at certain places and I don't know how.

I thought that using a css page-break-before, but that doesn't seem to work.

An example of the HTML I'm using is:

<table style="border-top: 0px solid black; border-bottom: 2px solid black; height: 30px; width: 800px;" border="0" cellspacing="0" cellpadding="0">
    <tbody>
        <tr>
            <td style="width: 200px;"><strong>Recommendation</strong></td>
            <td style="width: 600px;">[6060:Builder Recommendation]</td>
        </tr>
    </tbody>
</table>
<table style="page-break-before: always;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>Summary of Actions</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

Any ideas?

1

There are 1 answers

0
Nic On BEST ANSWER

Add a div before your table.

<div style='page-break-after:always'></div>