Alignment of column for PDFMake to sit at bottom of page

Viewed 538

I am having some issues with figuring out how to set a column with content to the bottom of my PDF. This is not on every page, just the last page of the PDF, so using the footer is not an option. I have tried a few styling methods, but nothing seems to work.

Here is my Code:

            {
            columns: [
                {
                    type: "none",
                    fontSize: 8,
                    margin: [0, 15, 5, 0],
                    ol: [
                        {
                            style: "bankingTable",
                            table: {
                                widths: ["*", "*"],
                                body: [
                                    [
                                        {
                                            paddingLeft: 0,
                                            text: "BANKING DETAILS",
                                            bold: true,
                                            fontSize: 8,
                                        },
                                        "",
                                    ],
                                    [{ text: "Bank Name: FIRST NATIONAL BANK" }, { text: "Account Holder: SOME COMPANY" }],
                                    [{ text: "Account Number: 123456789" }, { text: "Account Type: CURRENT" }],
                                    [{ text: "Branch Code: 254005" }, { text: "Branch Name: BELLVILLE" }],
                                    [{ text: `Payment Reference: 12345- ${dummyUser.lastName.toUpperCase()}`, color: "red" }, ""],
                                    [
                                        {
                                            colSpan: 2,
                                            fontSize: 6,
                                            text: "Email proof of payment to: test@test.co.za. For our ABSA, Standard Bank or Nedbank Banking Details, please refer to the Order Email in your Inbox.",
                                        },
                                    ],
                                ],
                            },
                            layout: {
                                hLineWidth: function (i, node) {
                                    return i === 0 || i === node.table.body.length ? 1 : 0;
                                },
                                vLineWidth: function (i, node) {
                                    return i === 0 || i === node.table.widths.length ? 1 : 0;
                                },
                            },
                        },
                    ],
                },
                {
                    type: "none",
                    fontSize: 8,
                    margin: [0, 15, 5, 0],
                    ol: [
                        {
                            style: "totalsTable",
                            table: {
                                heights: 10,
                                widths: [100, 50],
                                body: [
                                    [{ text: "Sub-Total (Incl. VAT)", alignment: "left" }, { text: `R ${serviceTotal.toFixed(2)}` }],
                                    [{ text: "Discount", alignment: "left" }, { text: `R ${discountTotal.toFixed(2)}` }],
                                    [{ text: "Sub-Total(After Disc.)", alignment: "left" }, { text: `R ${grossTotal.toFixed(2)}` }],
                                    [{ text: "VAT(@ 15.00%)", alignment: "left" }, { text: "R90.00" }],
                                    [
                                        { text: "TOTAL", fontSize: 10, alignment: "left" },
                                        { text: `${finalTotal.toFixed(2)}`, fontSize: 10 },
                                    ],
                                ],
                            },
                        },
                    ],
                },
            ],
        },

As I mentioned, this section needs to sit on the bottom of the last page of the PDF or bottom of the first page if there is only one. I would appreciate any help with this.

Please see picture below for how it is sitting atm:

enter image description here

I can't seem to get the styling applied to the column itself. I really need to get the column to sit at the bottom of the last page, but so far nothing seems to work and PDFMake offers very little in terms of help or information on how to achieve this.

0 Answers
Related