farling42 / fvtt-pdf-pager

PDF Pager for Foundry
MIT License
6 stars 4 forks source link

Read navigation pane from PDF and present as Journal TOC for the page #33

Closed farling42 closed 1 year ago

farling42 commented 1 year ago

Read the Document Outline from the PDF and present as the TOC for the page. This will involve loading the PDF first (which probably occurs anyway when they select the page).

farling42 commented 1 year ago

pdfviewerapp.pdfOutlineViewer._outline is an array.

{
   title : string;
   items: Array (sub-menu)
   dest: Array - probably points to location in PDF
}
farling42 commented 1 year ago

Maybe https://www.grapecity.com/documents-api-pdf/docs/online/GrapeCity.Documents.Pdf~GrapeCity.Documents.Pdf.OutlineNode.html

farling42 commented 1 year ago

JournalSheet.getData() sets data.toc = this._pages = this._getPageData(); JournalEntryPage.toc() JournalEntryPage.buildTOC()

farling42 commented 1 year ago

Copying the link from the Outline gives: https://foundry10.amusingtime.uk/scripts/pdfjs/web/viewer.html?file=%2Fuserdata%2Fstar-trek-adventures%2FStar_Trek_Adventures_Quickstart.pdf#%5B%7B%22num%22%3A394%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22FitV%22%7D%2C-274%5D Although the href in the outline link only contains the stuff after "#"

Links within PDF seem to generate

<doclink>#[{"num":363,"gen":0},{"name":"FitV"},-274]

The bit after # is JSON.stringify(toc.dest)

farling42 commented 1 year ago

Implemented in 0.28.0