Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

912651: updated index.razor #82

Merged
merged 1 commit into from
Nov 22, 2024
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