0

I'm using Pechkin to convert html content with css to pdf files.

The problem I am facing is that a part of a html block is being cut off because it doesn't fit on the current page anymore.

Now what i would like is that when the content doesn't fit on the current page that it creates it on the next page.

Is this possible with Pechkin?

Code:

var pechkin = new SynchronizedPechkin(new GlobalConfig());
return pechkin.Convert(new ObjectConfig()
                         .SetLoadImages(true).SetZoomFactor(1.5)
                         .SetPrintBackground(true)
                         .SetScreenMediaType(true)
                         .SetPrintBackground(true)
                         .SetCreateExternalLinks(true), html);

Problem

Nic
  • 12,220
  • 20
  • 77
  • 105
Jamie
  • 3,031
  • 5
  • 36
  • 59

2 Answers2

6

A way to add page breaks is by injecting CSS into your HTML.

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

If you want to prevent certain HTML blocks to be cut off you can try wrapping the with this div (or apply the style to your existing code block:

<div style='page-break-inside: avoid;'></div>
Nic
  • 12,220
  • 20
  • 77
  • 105
0

Instead of using float elements I switched to inline-block elements. I gave the inline-block elements the style: page-break-inside: avoid; and it now knows when to start on a new page.

Jamie
  • 3,031
  • 5
  • 36
  • 59