Search code examples
pdf.js

PDFjs and page enumeration


I have the following problem. I would like to open PDFs like this on a certain cited page: https://slub.qucosa.de/api/qucosa%3A89546/attachment/ATT-0/

As you can see, the page enumeration and page number are different. example of difference between page number and enumeration. For jumping to the right page, I would need the page enumeration. Is there any way, to access the enumeration-information? So that I know, that page 15 is on page 39?

Thanks in advance,

Erik


Solution

  • For everyone facing the same problem, I leave the answer here. You can access custom page enumeration via:

      pdf.pdfDocument.getPageLabels().then((pageNumbers) => {
        console.log("pageNumbers", pageNumbers);
      })
    

    where pdf is your pdfjs-object.

    Cheers,

    Erik