When trying to load up a document in the PDF Viewer, I keep receiving the following error :
Microsoft.JSInterop.JSException: Could not find 'sfBlazor.methodCall' ('methodCall' was undefined).
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) at Syncfusion.Blazor.PdfViewer.PdfViewerBase.InvokeJS(String moduleName, String methodName, Object[] methodParams) at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__140_0(Object state) at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteSynchronously(TaskCompletionSource`1 completion, SendOrPostCallback d, Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
This was not happening until today. Am I missing something?
|
<SfPdfViewerServer @ref="PdfViewer" 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 Created="created" AnnotationAdded="@AnnotationAdded" DocumentLoaded="@DocumentLoaded" AnnotationRemoved="@AnnotationRemoved" AnnotationSelected="@AnnotationSelected"></PdfViewerEvents>
</SfPdfViewerServer>
public string DocumentPath { get; set; }
public SfPdfViewerServer PdfViewer { get; set; }
public void created()
{
string Url = "http://www.syncfusion.com/downloads/support/directtrac/general/pd/HTTP_Succinctly-1719682472";
System.Net.WebClient webClient = new System.Net.WebClient();
byte[] byteArray = webClient.DownloadData(Url);
DocumentPath = "data:application/pdf;base64," + Convert.ToBase64String(byteArray);
}
|
I'm still getting an error. I've removed essentially everything and have it loading a document from the file system. I am now getting the following in the dev console :
document.getElementById(...).ej2_instances is undefined
I found the issue. I'm not sure why it just became an issue but I did not have the blazor app running in secure (https). Once I made that change things began working again.