0

I'm using Guriddo jqGrid JS-v5.8.2 with pdfmake 0.2.7

I can print the jqGrid to PDF, but I want the print out to show page numbers in the footer for example. Here's what I have

   $("#serialNumbersGrid").jqGrid("exportToPdf", {
     title: 'Property Serial Numbers',
     orientation: 'landscape',
     pageSize: 'A3',
     description: "Date: " + todaysDate,
     customSettings: null,
     download: 'download',
     includeLabels: true,
     includeGroupHeader: true,
     includeFooter: true,
     fileName: "SerialNumbers.pdf",   
 });

I've googled this extensively but can't find any reference to printing page numbers

1 Answer 1

0

Use onBeforeExport event to put in footer the page numbers. Actually you will need to learn pdfmake options.

   $("#serialNumbersGrid").jqGrid("exportToPdf", {
     title: 'Property Serial Numbers',
     orientation: 'landscape',
     pageSize: 'A3',
     description: "Date: " + todaysDate,
     customSettings: null,
     download: 'download',
     includeLabels: true,
     includeGroupHeader: true,
     includeFooter: true,
     fileName: "SerialNumbers.pdf",   
     onBeforeExport : function( doc) {
         doc.footer= function(currentPage, pageCount) { return currentPage.toString() + ' of ' + pageCount; 
     };
  }
 });
1
  • That worked! Thanks
    – Beachdog
    Commented Jul 12 at 16:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.