File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Server Deployment/Maui/MauiBlazorAndroid/MauiBlazorAndroid/Pages Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 11@page " /"
2- @using System .Web ;
3-
42
53<SfPdfViewer2 @ref =" viewer" DocumentPath =" @DocumentPath" Height =" 100%" Width =" 100%" ></SfPdfViewer2 >
64
75@code {
86 SfPdfViewer2 viewer ;
9- private string DocumentPath { get ; set ; } = " https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf " ;
7+ private string DocumentPath { get ; set ; } = " " ;
108
9+ protected override void OnInitialized ()
10+ {
11+ string basePath = " MauiBlazorAndroid.wwwroot.data.pdf_succinctly.pdf" ;
12+ Stream DocumentStream = this .GetType ().Assembly .GetManifestResourceStream (basePath );
13+ DocumentStream .Position = 0 ;
14+ using (MemoryStream memoryStream = new MemoryStream ())
15+ {
16+ DocumentStream .CopyTo (memoryStream );
17+ byte [] bytes = memoryStream .ToArray ();
18+ string base64String = Convert .ToBase64String (bytes );
19+ string base64prefix = " data:application/pdf;base64," ;
20+ // Assigned the base64 path to the PDF document path.
21+ DocumentPath = $" {base64prefix }{base64String }" ;
22+ }
23+ base .OnInitialized ();
24+ }
1125}
You can’t perform that action at this time.
0 commit comments