xiimoss
xiimoss

Reputation: 805

Setting pages in a PDF from HTML

I'm converting ePubs into PDF's using iTextSharp and I have it all working fine using xmlWorkerHelper however when generating the pdf it cuts certain stuff across multiple pages. Is there a way to be able to get it to start a new page using xmlWorker? See the image below to see what I mean with a contents table.

As you can see at the top it finishes writing the text and then instantly does the contents table when ideally i'd like the contents table to be started on a new page.

enter image description here

Upvotes: 1

Views: 370

Answers (1)

rhens
rhens

Reputation: 4871

You can use the CSS properties page-break-before and page-break-after. Only the value always is supported.

Assuming your contents table is a <table>, you can do something like this:

<table id="contents" style="page-break-before: always">
    <!-- rest of the contents table -->
</table>

Upvotes: 2

Related Questions