Clear Bookmark Selection?

Is there any way to clear the currently selected bookmark when viewing PDFs?

Currently, when a user selects a bookmark they will be brought to the appropriate page for that bookmark. After navigating with either the page controls or scrolling the previously selected bookmark remains selected (red text). The users would like to see the bookmark selection clear after navigating to a different page from the bookmark location.


3 Replies 1 reply marked as answer

AC ArunKumar Chandrakesan Syncfusion Team September 1, 2022 04:01 PM UTC

Hi David,


We can reproduce the reported issue "Highlighting of bookmarks is not removed after scrolling to another page" and we will validate it and provide more details on September 06, 2022


Regard,

Arun kumar


Marked as answer

AC ArunKumar Chandrakesan Syncfusion Team September 6, 2022 08:33 AM UTC

Hi David,


Kindly refer to the below sample and Code snippet provided to remove the highlight from the bookmark after scrolling to the other pages and let us know if the solution provided is helpful to you


Code snippet:


 

let currentBookmarclickedPageno: number = 0;

//Bookmar click event

viewer.bookmarkClick = (args) => {

  //set the currnet bookmark clicked page number

  currentBookmarclickedPageno = args.pageNumber;

};

//Page change event

viewer.pageChange = (args) => {

  // check whether the page changed current page number not equal to bookmark page then clear the selection color using the below code.

  if (currentBookmarclickedPageno != args.currentPageNumber) {

    if (

      document

        .getElementById(viewer.element.id + '_bookmark_view_active')

        .classList.contains('e-active')

    )

      document

        .getElementById(viewer.element.id + '_bookmark_view_active')

        .classList.remove('e-active');

  }

};


Sample:  https://stackblitz.com/edit/826hbd?file=index.ts,index.html



Regard,

Arun kumar



DH David Hyer replied to ArunKumar Chandrakesan September 8, 2022 07:03 PM UTC

This worked for me, thank you!


Loader.
Up arrow icon