pdfmake icon indicating copy to clipboard operation
pdfmake copied to clipboard

Page break not detected in empty rows that are not headers

Open fe-cj opened this issue 7 months ago • 0 comments

When rows are empty and they are not headers, it does not detect if they should break page and table rows overlap footer, ignoring its height.

Example where it does not respect the footer height and is not breaking page:

var dd = {
	pageSize: "A4",
	pageOrientation: "portrait",
	pageMargins: [29, 59, 29, 67],
	content: [
		{
      margin: [0, 694, 0, 0],
      table: {
        headerRows: 1,
        widths: ["33.333%", "33.333%", "33.333%"],
        heights: [15, 15, 15],
        body: [
          [
            {
              stack: [],
            },
            {
              stack: [],
            },
            {
              stack: [],
            },
          ],
          [
            {
              stack: [],
            },
            {
              stack: [],
            },
            {
              stack: [],
            },
          ],
          [
            {
              stack: [],
            },
            {
              stack: [],
            },
            {
              stack: [],
            },
          ],
        ],
      },
    },
	],
};

In the below example, the table doesn't have a header row and footer height is 167 points, which are not respected. It seems that it respects the default footer height, which is 40:

var dd = {
	pageSize: "A4",
	pageOrientation: "portrait",
	pageMargins: [29, 59, 29, 167],
	content: [
		{
      margin: [0, 694, 0, 0],
      table: {
        headerRows: 0,
        widths: ["33.333%", "33.333%", "33.333%"],
        heights: [15, 15, 15],
        body: [
          [
            {
              stack: [],
            },
            {
              stack: [],
            },
            {
              stack: [],
            },
          ],
          [
            {
              stack: [],
            },
            {
              stack: [],
            },
            {
              stack: [],
            },
          ],
          [
            {
              stack: [],
            },
            {
              stack: [],
            },
            {
              stack: [],
            },
          ],
        ],
      },
    },
	],
};

fe-cj avatar Jul 06 '24 15:07 fe-cj