Hi, I've got an javascript exception , when page is loading, after upgrading version from
18.3.0.* => 18.4.0.35 The type 'SfPdfViewer' does not contain a public invokable method with [JSInvokableAttribute("GetPDFInfo")].
Uncaught (in promise) Error: System.ArgumentException: The type 'SfPdfViewer' does not contain a public invokable method with [JSInvokableAttribute("GetPDFInfo")].
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.GetCachedMethodInfo(IDotNetObjectReference objectReference, String methodIdentifier)
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.InvokeSynchronously(JSRuntime jsRuntime, DotNetInvocationInfo& callInfo, IDotNetObjectReference objectReference, String argsJson)
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.BeginInvokeDotNet(JSRuntime jsRuntime, DotNetInvocationInfo invocationInfo, String argsJson)
at Object.endInvokeDotNetFromJS (blazor.server.js:1)
at e.
(blazor.server.js:8) at blazor.server.js:1
at e.invokeClientMethod (blazor.server.js:1)
at e.processIncomingData (blazor.server.js:1)
at e.connection.onreceive (blazor.server.js:1)
at WebSocket.i.onmessage (blazor.server.js:1)
Can you help me?
My source code is:
@using Syncfusion.Blazor.PdfViewer
@inject NavigationManager NavigationManager
< div class="d-flex flex-fill" style="min-width:347px;">
< SfPdfViewer @ref="pdfv" Height="80vh" Width="100%" EnableDownload="false" EnableHyperlink="true"
EnableTextSelection="false" EnableToolbar="true" DocumentPath="@DocumentPath">
< PdfViewerToolbarSettings ToolbarItems="@ToolbarItems">
< /PdfViewerToolbarSettings>
< PdfViewerEvents DocumentLoaded="dl">< / PdfViewerEvents>
SfPdfViewer>
< /div>
@code {
[Parameter]
public string CurrFileId { get; set; }
private SfPdfViewer pdfv;
private string DocumentPath { get; set; }
protected void dl(LoadEventArgs args)
{
int i = 0;
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
await Reload();
await base.OnAfterRenderAsync(firstRender);
}
protected override async Task OnInitializedAsync()
{
//await Reload();
await base.OnInitializedAsync();
}
public async Task Reload()
{
if (!String.IsNullOrEmpty(CurrFileId))
{
string Url = String.Format("{0}api/download/{1}", NavigationManager.BaseUri, CurrFileId);
using (System.Net.WebClient webClient = new System.Net.WebClient())
{
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
byte[] byteArray = await Task.Run(() => webClient.DownloadData(Url));
DocumentPath = "data:application/pdf;base64," + Convert.ToBase64String(byteArray);
//await pdfv.Load(DocumentPath, null);
}
}
await InvokeAsync(StateHasChanged);
}
List ToolbarItems = new List() {
ToolbarItem.MagnificationTool,
ToolbarItem.PanTool,
};
}