Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
@page "/"
@using System.Web;


<SfPdfViewer2 @ref="viewer" DocumentPath="@DocumentPath" Height="100%" Width="100%"></SfPdfViewer2>

@code {
SfPdfViewer2 viewer;
private string DocumentPath { get; set; } = "https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf";
private string DocumentPath { get; set; } = "";

protected override void OnInitialized()
{
string basePath = "MauiBlazorAndroid.wwwroot.data.pdf_succinctly.pdf";
Stream DocumentStream = this.GetType().Assembly.GetManifestResourceStream(basePath);
DocumentStream.Position = 0;
using (MemoryStream memoryStream = new MemoryStream())
{
DocumentStream.CopyTo(memoryStream);
byte[] bytes = memoryStream.ToArray();
string base64String = Convert.ToBase64String(bytes);
string base64prefix = "data:application/pdf;base64,";
//Assigned the base64 path to the PDF document path.
DocumentPath = $"{base64prefix}{base64String}";
}
base.OnInitialized();
}
}
Loading