如何使用Pechkin生成的PDF中的分页符

时间:2014-08-25 00:37:00

标签: c# .net pdf-generation pechkin tuespechkin

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

这一切都很好用,除了我需要在某些地方添加分页符并且我不知道如何。

我认为使用css page-break-before,但这似乎不起作用。

我正在使用的HTML的一个例子是:

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

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

有什么想法吗?

1 个答案:

答案 0 :(得分:9)

在桌子前添加div。

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