Bookmark.isValid() is False

  • Trying to navigate bookmark using displayPageLoaction(bookmark.getPagenumber(), 0, 0), but throwing error (cannot be reading properties of (rotation) which is happening for some pdf’s, some pdf’s works fine. I have checked bookmark is not valid and getPageNumebr() is null, What could be the reason? how we can sort out this issue?. Is there any work around when getPageNumber() is Null. I can’t provide pdf.

Any body help on this and any work around please.

Hi there,

How are you getting the bookmark object?

You can get the bookmarks in the PDF like this:

const bookmark = await documentViewer.getDocument().getBookmarks()

Please see this guide for more details:

best regards,
Kevin

Hey, Thanks for the reply, I’m getting bookmarks, but I see bookmark metadata details, there is Lb is which hold the pagenumber value, when i iterate the bookmarks, all bookmark.Lb attribute is null, I have compared with working bookmark pdf, there bookmark.Lb is having value(Page Number). This is where, I have observed, some pdfs works, other pdf not work when Lb is null.when this Lb becomes null, Any idea?

I have tried with exportBookmarks from UI, still {} object.

Even I have tried passing bookmark object displayBookmark(bookmark), No error but still not navigation happening.

Is there any where else i can get the PageNumber from Core or UI, which can match with bookmark name because i am getting bookmark.getName(), so I can get Pagenumber by matching it title/name.

Hi there,

Do you have a sample pdf where getPageNumber returns null?

You may also want to check if the document actually has a specified action via Adobe, i.e. jump to a page:

For reference, this is the Bookmark class with available methods:

best regards,
Kevin

I can’t give sample pdf as well as per company policy and I will check the bookmark properties in acrobat and come back.

Hi, I have checked the bookmark Properties. it has action and its like Page:50, Zoom Level: Fit Width,.

Working pdf I have found as Page: 1, Zoom Level: Inherit Zoom.

So I have changed Zoom Level: Fit Width to Zoom Level: Inherit Zoom for bookmark naviagtion not working pdf file.

Then I took that modified pdf file and added in Webviewer, Bookmark Naviagtion Started Working fine.

Looks like If pdf has, Zoom Level: Inherit Zoom, then bookmark navigation is working smoothly.

So now i can’t modify each pdf like this, What is the solution for this or Any wok around for this?.
Really Need help on this.

Hi there,

Once those particular bookmarks are created, and the bookmark navigation works, are you able to retrieve its pageNumber via the getPageNumber API? If so, then you can use the displayPageLocation from the returned value.

Otherwise, can you share a sample PDF?

best regards,
Kevin

I’m getting getPageNumber is Null and I dont have sample pdf file and working with pdf data which can’t share it. Can i add zoom : Z(0) for each page ondocumentLoad?.

If you want to set a specific zoom level for page being loaded, please use the following API:
setZoomLevel: PDFJS Express WebViewer Namespace: UI
pageComplete event: PDFJS Express WebViewer Namespace: UI

best regards,
Kevin

Hey, I have an pdf which 3 levels of bookmark but webviewer loads only 2 level (parent and child) and I have used autoExpandOutlines: true in webviewer instantiation, but still 2 nodes of bookmark in webviewer, Can you tell me why this happens? This might causing above issue as well.

When you examine the bookmark object for the PDF, is there a nested children property for the bookmark object?

could you please share an input file for reference?

best regards,
Kevin

Yes, its has nested children for bookmark object and here is the dummy file with 3 pages, page1, page2 & page 3 content and bookmark of nodes 3.
bookmarked_example.pdf (2.4 KB)

It looks like autoExpandOutlines is not an option within pdf.js express.
To use that option, you will need to use Apryse WebViewer:

However, loading that document on the pdf.js express demo, I can see the level 3 within the outlines panel:

best regards,
Kevin