byte[] byteArray = System.IO.File.ReadAllBytes("wwwroot/Data/Hive_Succinctly.pdf");
string base64String = Convert.ToBase64String(byteArray);
Viewer.Load("data:application/pdf;base64," + base64String, null); |
@using Syncfusion.EJ2.Blazor.PdfViewer
@using Syncfusion.EJ2.Blazor.Buttons
<EjsButton @onclick="@clicked">Load Document</EjsButton>
<EjsPdfViewer DocumentPath="@DocumentPath" Height="500px" Width="1060px" @ref="@Viewer"
ServiceUrl="https://ej2services.syncfusion.com/production/web-services/api/pdfviewer"></EjsPdfViewer>
@code{
EjsPdfViewer Viewer;
private string DocumentPath { get; set; } = "PDF_Succinctly.pdf";
public void clicked()
{
// Provide the PDF file path to be loaded here
byte[] byteArray = System.IO.File.ReadAllBytes("Hive_Succinctly.pdf");
string base64String = Convert.ToBase64String(byteArray);
Viewer.Load("data:application/pdf;base64," + base64String, null);
}
}
|