pdfjs icon indicating copy to clipboard operation
pdfjs copied to clipboard

Show header on all pages except page 1

Open psalaets opened this issue 3 years ago • 1 comments

This is a feature request for a future version.

I am trying to generate a header that is conditional on page number, but doesn't contain the page number. My use case is: show a header on all pages except for the first page.

header.pageNumber(fn) is very close to what I need but it requires the header to be different when the total pages is different. Otherwise you get an automatically generated header containing the page number.

I found a way to make it work but I am depending on private APIs:

const header = doc.header();
header.pageNumber((current, total) => {
  if (doc._currentPage) {
    return String(total);
  } else {
    return current === 1 ? '' : 'header content here'
  }
});

Thanks

psalaets avatar Sep 19 '20 17:09 psalaets

Thanks for the feature request! That is actually something I have somewhere in my backlog, too. 😌

rkusa avatar Oct 01 '20 13:10 rkusa