Search code examples
node.jspdfmake

how to get pagecount in background object in pdfmake?


how to get pageCount in background object, here is my code.

background: (currentPage, pageCount) => {
  if (currentPage === 1) {
    return [
        {
            image: img.coverbg,
            height: 521,
            width: 756
        }
    ]
  }
  else if(currentPage == pageCount) {
    return [
        {
            image: img.headbg,
            width: 755,
            height: 30,
        },
    ]
  }
},

i want pageCount in background, but i didnt get that, i only get currentPage,

so how to get pageCount in background object.


Solution

  • can't get pageCount in the background object,

    we have to find another way for that.