Skip to content

Instantly share code, notes, and snippets.

@Krummelz
Created August 11, 2017 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Krummelz/ba0f9711b78c96e3511a1bb5b1938090 to your computer and use it in GitHub Desktop.
Save Krummelz/ba0f9711b78c96e3511a1bb5b1938090 to your computer and use it in GitHub Desktop.
Sample iTextSharp code that can be used to prevent content cutting over to the next page and being cut in half.
// The problem is when you have a table,
// which gets cut in half at the botto of one page,
// and the other half shows up at the top of the next page.
// To prevent this, you can wrap your table in a container table (with a single cell)
PdfPTable containerTable = new PdfPTable(1);
containerTable .WidthPercentage = 100;
PdfPCell containerTableCell = new PdfPCell();
// Add your stuff to the ContainerTableCell.
containerTableCell.AddElement(yourOtherTable);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment