Will Manis
Will Manis

Reputation: 1

Angular PDFViewer outline navigation

I display my PDF using the ng2-pdf-viewer.

I then get the outline.

 pdfViewer.getOutline().then((outline: any[]) => {
      topics = outline;
 });

I display the topics

 <ul *ngFor="let item of topics" class="outline-list">
  <li>
    <a (click)="navigateTo(item)">{{ item.title }}</a>
    <ul *ngFor="let child of item.items">
      <li>
        <a (click)="navigateTo(child)">{{ child.title }}</a>
      </li>
    </ul>
  </li>
 </ul>

All good up to this point.

Now I get the click event.

The click event yields the data below:

{
  action : null,
  dest : "G5.1006989",
  url : null,
  title : "Safety Alert Symbol",
  color : {"0":0,"1":0,"2":0},
  bold : false,
  italic : false,
  items : []
}
 navigateTo(destination: any) {
    pdfViewer.eventBus.dispatch(verb?, data?);
 }

I have tried many iterations of verbs, focusing on "find" and various forms of data. The destination has text in it (title property), which I can use to find an occurrence of the text, unfortunately that is not destination/bookmark location.

What verb should I be using, and what should the data look like.

Should I be using something other than eventBus.dispatch?

Upvotes: 0

Views: 17

Answers (0)

Related Questions