Did you find this guide helpful?
Some test text!
Web / Guides / Add outline
Make sure you have Full API enabled in WebViewer.
To add a new outline item in an existing document.
Webviewer(...).then(async instance => {
const { docViewer, PDFNet } = instance;
await PDFNet.initialize();
docViewer.on('documentLoaded', () => {
const doc = docViewer.getDocument();
const pdfDoc = await doc.getPDFDoc();
// create outline and add it to the first page
const myitem = await PDFNet.Bookmark.create(pdfDoc, 'My outline');
await myitem.setAction(await PDFNet.Action.createGoto(await PDFNet.Destination.createFit(await pdfDoc.getPage(1))));
await pdfDoc.addRootBookmark(myitem);
// refresh document outline
const bookmarks = await doc.getBookmarks();
instance.updateOutlines(bookmarks);
});
});
Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales