Search code examples
c#htmlabcpdf

ABCPDF Spliting / Page Breaking a table header from table data rows


As the title suggests I have a header and data appearing on a separate page. The data rows span more than a page and thus I think it is automatically appearing on a new page.

The pdf has been transformed to landscape but I don't think that matters.

Col1 Col2 COl3
New York
** Rest of the page empty **

** New Page **
1 2 3
4 5 6
1 2 4
1 2 5
....

Is there anything I can add to allow the data to start immediately after the heading? Col1 Col2 COl3
New York
1 2 3
4 5 6
1 2 4
1 2 5
....

Code: The table uses table header rows and header cells for headings and then table rows and table cells for data.

I use abcPdfDocument.AddImageHtml(pdfDocumentProperties.ContentHtml, true, 0, true); for adding the first page and abcPdfDocument.Page = abcPdfDocument.AddPage(); documentId = abcPdfDocument.AddImageToChain(documentId); for adding the rest.


Solution

  • I eventually solved the issue via the help of ABCPDF support. This issue was specific to my reports due to the complexity, there answer below:

    There are too many vertical lines/borders that forces ABCpdf to try keeping the tables in a single page because you are using cumulative cohesion. You need to use maximum cohesion. theDoc.HtmlOptions.BreakMethod = HtmlBreakMethodType.MaximumCohesion;

    After making this change I did not encounter any weird page splitting issues.