When i upload a word file having 4 pages, in the viewer it it showing 4 pages. But getPageCount() returning 1

WebViewer Version:12.0.0

When i upload a word file having 4 pages, in the viewer it it showing 4 pages. But getPageCount() returning 1.
my code as below:

this.viewerInstance.UI.loadDocument(fileAsBlob, { filename: file.name, extension: ext,cacheKey: `1234-${new Date().getTime()}`, officeOptions:{formatOptions:{applyPageBreaksToSheet: true}} });

this.viewerInstance.Core.documentViewer.addEventListener(‘documentLoaded’, async () => {

    const doc = this.viewerInstance.Core.documentViewer.getDocument();

    const processDocument = async () => {

      const pageCount = doc.getPageCount();

})})

1 Like

Hello Lokesh,

Thank you for contacting WebViewer Forums.

Please make sure the document and its pages are fully loaded before calling getPageCount() by listening for the documentLoaded event. For more information, please see our documentation here: Working with documents using the Document Viewer | Web SDK | Apryse

Regards,
Luke

In the reference code I provided above, I followed the documentation exactly. However, the documentLoaded event is firing before all pages have finished loading. While this setup works perfectly for PDF files, it fails to wait for the complete loading of Word and Excel files

1 Like