Angular FitMode

Hello. I’m using this dependecy ("@pdftron/webviewer": “^8.6.1”) on an angular project and i’am trying to set the FitMode of the viewer to FitWidth like this:

this.wvInstance?.Core.documentViewer.setFitMode(this.wvInstance?.Core.DocumentViewer.FitMode.FitWidth);

but i’m getting the this error:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘FitWidth’)

Hi Felipe,

Can you show me how your WebViewer is instantiated? Here is a reference guide on Angular integration with WebViewer:

Also, does it work when using instance as is?
const { documentViewer } = instance.Core;
documentViewer.setFitMode(documentViewer.FitMode.FitWidth);

Best Regards,
Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.
www.pdftron.com