Search code examples
blazorsyncfusionsyncfusion-blazor

Blazor w/Syncfusion - Microsoft.JSInterop.JSException: Could not find 'sfBlazor.methodCall' ('methodCall' was undefined)


Attempting to use the PDF Viewer (server) and keep getting the above error in the browser console. It was working up until today and there is not a lot of code that goes with it. Has anyone encountered this before?

<SfPdfViewerServer @ref="pdfViewer" ToolbarSettings="@ToolbarSettings" EnableFormFields="false" DocumentPath="@DocumentPath" EnableNavigationToolbar="false" EnableAnnotationToolbar="false" EnableToolbar="true" Height="100%" Width="100%">
     <PdfViewerCustomStampSettings EnableCustomStamp="true" IsAddToMenu="true" Width="194" Height="75" MaxHeight="75" MaxWidth="194" MinHeight="75" MinWidth="194" CustomStamps="@CustomStamps"></PdfViewerCustomStampSettings>
     <PdfViewerContextMenuSettings EnableContextMenu="false" />
     <PdfViewerAnnotationSettings IsLock="false" />
     <PdfViewerEvents AnnotationAdded="@AnnotationAdded" DocumentLoaded="@DocumentLoaded" AnnotationRemoved="@AnnotationRemoved" AnnotationSelected="@AnnotationSelected" />
</SfPdfViewerServer>

The above code is the simple code to load the viewer. The following code is what loads the document.

byte[] byteArray = await webClient.DownloadDataTaskAsync(new Uri(docpath));
DocumentPath = "data:application/pdf;base64," + Convert.ToBase64String(byteArray);

Solution

  • The site needed to be running in https. Once I altered it to run secure it began working.