Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
146253 | Jul 28,2019 11:55 PM UTC | Jul 31,2019 07:13 AM UTC | Blazor | 3 |
![]() |
Tags: PDF Viewer |
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);
}
}
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.