pdfjs
pdfjs copied to clipboard
Show header on all pages except page 1
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
Thanks for the feature request! That is actually something I have somewhere in my backlog, too. 😌