Need to display this code as fixed header in all PDFmake pages

69 views Asked by At
{ text: 'RECEIPT/DELIVERY LIST', fontSize: 16, colSpan: 2, bold: true, alignment: 'right' },
            {
              columns: [
                {
                  text: [
                    { text: 'Shipped From:\n', bold: true, decoration: 'underline', fontSize: 12 },
                    { text: "SE-Hardeeville" + '\n', style: 'topAddresses' },
                    { text: "132 Red Oaks Lane" + '\n', style: 'topAddresses' },
                    { text: "Ridgeland,  29936" + ', ', style: 'topAddresses' },
                    { text: "SC" + ' ', style: 'topAddresses' },
                    { text:  "29936" + '\n', style: 'topAddresses' }
                  ],
                  alignment: 'left'
                },
                {
                  image: await this.getBase64ImageFromURL('assets/img/Mingledorff_logo.png'),
                  fit: [150, 150],
                  style: 'centerMe'
                },
                {
                  table: {
                    widths: [75, 75],
                    body: [
                      [
                        { text: [{ text: 'Pick Date:\n', bold: true, fontSize: 10 }, '12-09-2023'], alignment: 'center', fontSize: 10 },
                        { text: [{ text: "Sales Order:" +':\n', bold: true, fontSize: 10 }, '202912323'], alignment: 'center', fontSize: 10 }
                      ]
                    ]
                  }
                }
              ]
            },

Below is my current using code

async printDelivery() { 
    let docDefinition = {
          footer: function (currentPage, pageCount) {
            return {
              margin: 10,
              columns: [
                {
                  fontSize: 9,
                  text: [
                    {
                      text: 'Pages: ' + currentPage.toString() + ' of ' + pageCount,
                    }
                  ],
                  alignment: 'center'
                }
              ]
            };
    
          },
          watermark:{text: this.order.customer.termsType == 'COD' ? '*COD*' : '', angle:0,  fontSize: 90, bold: true, color: 'gray'},
          content: [
            { text: 'RECEIPT/DELIVERY LIST', fontSize: 16, colSpan: 2, bold: true, alignment: 'right' },
            {
              columns: [
                {
                  text: [
                    { text: 'Shipped From:\n', bold: true, decoration: 'underline', fontSize: 12 },
                    { text: "SE-Hardeeville" + '\n', style: 'topAddresses' },
                    { text: "132 Red Oaks Lane" + '\n', style: 'topAddresses' },
                    { text: "Ridgeland,  29936" + ', ', style: 'topAddresses' },
                    { text: "SC" + ' ', style: 'topAddresses' },
                    { text:  "29936" + '\n', style: 'topAddresses' }
                  ],
                  alignment: 'left'
                },
                {
                  image: await this.getBase64ImageFromURL('assets/img/Mingledorff_logo.png'),
                  fit: [150, 150],
                  style: 'centerMe'
                },
                {
                  table: {
                    widths: [75, 75],
                    body: [
                      [
                        { text: [{ text: 'Pick Date:\n', bold: true, fontSize: 10 }, '12-09-2023'], alignment: 'center', fontSize: 10 },
                        { text: [{ text: "Sales Order:" +':\n', bold: true, fontSize: 10 }, '202912323'], alignment: 'center', fontSize: 10 }
                      ]
                    ]
                  }
                }
              ]
            },
            '\n',
            {
              columns: [
                {
                  text: [
                    { text: 'Sold To:\n', bold: true, decoration: 'underline', fontSize: 10 },
                    { text: "Davis Heating & Air" + '\n' + '' + '\n', style: 'topAddresses' },
                    { text: "1060 East Hiawatha Street" + '\n'  + '\n', style: 'topAddresses' },
                    { text:  "Metter" , style: 'topAddresses' },
                    { text: "GA", style: 'topAddresses' },
                    { text: "30339"  + '\n', style: 'topAddresses' },
                    { text: "9126857576", style: 'topAddresses' }
                  ],
                  alignment: 'left'
                },
                {
                  text: [
                    { text: 'Ship To:\n', bold: true, decoration: 'underline', fontSize: 10 },
                    { text: "Davis Heat/Air", style: 'topAddresses' },
                    { text: "1060 East Hiawatha Street", style: 'topAddresses' },
                    { text: "Metter", style: 'topAddresses'},
                    { text: "GA", style: 'topAddresses' },
                    { text: "30349", style: 'topAddresses' },
                    { text: "9126857576", style: 'topAddresses' }
                  ],
                  alignment: 'left'
                },
                

              ]
            },
            '\n\n\n',
            {
              table: {
                widths: [70, 150, 80, 100, 80],
                body: [
                  [
                    { text: 'DeliveryDocument', bold: true, alignment: 'center', style: "topTable" },
                    { text: 'CreatedByUser', bold: true, alignment: 'center', style: "topTable" },
                    { text: 'CreationDate', bold: true, alignment: 'center', style: "topTable" },
                    { text: 'OverallPickingStatus', bold: true, alignment: 'center', style: "topTable" },
                    { text: 'ShippingPoint', bold: true, alignment: 'center', style: "topTable" },
                  ],
                  [
                    { text: '80545362', alignment: 'center', style: "topTable" },
                    { text: "PS4_TO_OEA", alignment: 'center', style: "topTable" },
                    { text: "12-09-2023", alignment: 'center', style: "topTable" },
                    { text: "Completed", alignment: 'center', style: "topTable" },
                    { text: "1057", alignment: 'center', style: "topTable" }
                  ]
                ]
              }
    
            },
            '\n',
            {
              table: {
                widths: [40, 40, 80, 50, 100, 40, 40, 60],
                body: [
                  [
                    { text: 'OrderItem', bold: true, style: "middleTable", alignment: 'center' },
                    { text: 'Delivery QTY', bold: true, style: "middleTable", alignment: 'center' },
                    { text: 'Product', bold: true, style: "middleTable", alignment: 'center' },
                    { text: 'Description', bold: true, style: "middleTable", alignment: 'center' },
                    { text: 'Serial Number', bold: true, style: "middleTable", alignment: 'center'},
                    { text: 'Unit Price', bold: true, style: "middleTable", alignment: 'center' },
                    { text: 'Unit Tax', bold: true, style: "middleTable", alignment: 'center' },
                    { text: 'Total', bold: true, style: "middleTable", alignment: 'center' },
                  ],
                  [
                    { text: "10", alignment: 'center', style: "topTable" },
                    { text: "2", alignment: 'center', style: "topTable" },
                    { text: "TH8321WF1001 Weight: 0lb", alignment: 'center', style: "topTable" },
                    { text: "WI-FI VISIONPRO 8000 3H/2C RES/COMM THER ", alignment: 'center', style: "topTable" },
                    { text: "", alignment: 'center', style: "topTable" },
                    { text: "$303.55", alignment: 'center', style: "topTable" },
                    { text: "$30.29", alignment: 'center', style: "topTable" },
                    { text: "$607.10", alignment: 'center', style: "topTable" },
                  ]
                ]
              }
            },
            '\n',
            { canvas: [{ type: 'line', x1: 0, y1: 0, x2: 515, y2: 0, lineWidth: 2 }] },
            '\n',
            {
              columns: [
                {
                  width: 150,
                  text:
                    [
                      { text: 'Total Items:   ', bold: true },
                      { text: '2' },
                    ]
                },
                {
                  width: 200,
                  text:
                    [
                      { text: 'Total Pieces: ', bold: true },
                      { text: "2" }
                    ]
                },
                {
                  width: 'auto',
                  table: {
                    body: [
                       [{ text: 'SUB-TOTAL: ', bold: true, alignment: 'right' }, { text:  "$607.10", alignment: 'left' }],
                       [{ text: 'TAX: ', bold: true, alignment: 'right' }, { text: "$60.57", alignment: 'left' }],
                       [{ text: 'GRAND TOTAL: ', bold: true, alignment: 'right' }, { text: "$667.67", alignment: 'left' }],
                    ]
                  },
                  layout: 'noBorders',
                  alignment: 'right'
                }
              ]
            },
            '\n',
            { canvas: [{ type: 'line', x1: 0, y1: 0, x2: 515, y2: 0, lineWidth: 2 }] },
            '\n',
  
            {
              columns: [
                {
                  text: 'Order Fulfilled by: __________________________', bold: false
                }
              ]
            },
            '\n',
            { canvas: [{ type: 'line', x1: 0, y1: 0, x2: 515, y2: 0, lineWidth: 2 }] },
            '\n',
            {
              columns: [
                { text: "Recipient hereby certifies the delivery and receipt of the item(s) listed herein. Recipient further certifies that it has inspected the item(s) and confirms the item(s) are in good order, except as noted.", bold: 'true', alignment: 'left', style: 'bottomSection', margin: [12, 0] }
              ]
            },
            '\n\n\n',
            {
              columns: [
                {
                  width: 175,
                  style: 'bottomSection',
                  text: [
                    { text: '_______________________________________ \n ' },
                    { text: 'Recipient Signature' }
                  ],
                  alignment: 'left'
                },
                {
                  width: 175,
                  style: 'bottomSection',
                  text: [
                    { text: '_______________________________________  \n ' },
                    { text: 'Print Name' }
                  ],
                  alignment: 'left'
                },
                {
                  width: 175,
                  style: 'bottomSection',
                  text: [
                    { text: '_______________________________________  \n ' },
                    { text: 'Date' }
                  ],
                  alignment: 'left'
                }
              ]
            },
            '\n\n\n',
            {
              columns: [
                { text: "This is not your Invoice. Your Invoice will include freight and tax. The item(s) may be subject to Regional Efficiency Standards.Please refer to the Energy Guide label or http://www.energy.gov/ge/regional-standards-enforcement to ensure compliance.", bold: 'true', alignment: 'center', style: 'bottomSection', margin: [10, 0] },
                {
                  width: 150,
                  style: 'bottomSection',
                  table: {
                    body: [
                      [{ text: [{ text: 'Print Date & Time \n ' }, { text: '12-09-2023', margin: 5 }], alignment: 'center' }],
                    ]
                  },
                  alignment: 'right'
                }
              ]
            },
            '\n',
            { canvas: [{ type: 'line', x1: 0, y1: 0, x2: 515, y2: 0, lineWidth: 2 }] },
            '\n',
            {
              columns: [
                { text: "terms", bold: 'true', alignment: 'center', style: 'bottomSection', margin: [10, 0] }
              ]
            }
          ],
          styles: {
            topAddresses: {
              fontSize: 10
            },
            topTable: {
              fontSize: 8
            },
            middleTable: {
              fontSize: 8
            },
            bottomSection: {
              fontSize: 8
            }
          }
        };
        pdfMake.createPdf(docDefinition).open();
  }
0

There are 0 answers