|
<SfButton @onclick="clicked">Load Document</SfButton>
public void clicked()
{
byte[] byteArray = System.IO.File.ReadAllBytes("wwwroot/Data/2.pdf");
string base64String = Convert.ToBase64String(byteArray);
Viewer.Load("data:application/pdf;base64," + base64String, null);
}
|
|
<SfPdfViewerServer @ref="Viewer" DownloadFileName="@DownloadFileName">
<PdfViewerEvents Created="LoadDocument"></PdfViewerEvents>
</SfPdfViewerServer>
public void LoadDocument()
{
byte[] byteArray = System.IO.File.ReadAllBytes("wwwroot/Data/2.pdf");
string base64String = Convert.ToBase64String(byteArray);
Viewer.Load("data:application/pdf;base64," + base64String, null);
DownloadFileName = "Syncfusion.pdf";
} |
Hi G Dora,
We have breaking changes in the latest version V20.1.0.47. So, we suggest you enable JavaScript isolation by setting IgnoreScriptIsolation as false while adding the Syncfusion Blazor service using AddSyncfusionBlazor().
Code Snippet in a startup.cs file.
|
services.AddSyncfusionBlazor(options => { options.IgnoreScriptIsolation = false; });
|
Modified Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorSample2100238880
For more information, please refer to the below UG link.
https://blazor.syncfusion.com/documentation/release-notes/20.1.47?type=all#breaking-changes
Kindly try this and let us know if this helps you.
Regards,
Vasugi.