BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Afternoon everyone,
public async Task Open() { using (MemoryStream memoryStream = new MemoryStream()) { await CloudStorageAccount.Parse(ConfigurationService.GetValue .CreateCloudBlobClient() .GetContainerReference("templates") .GetBlockBlobReference("PDF Form.pdf") .DownloadToStreamAsync(memoryStream); Path = "data:application/pdf;base64," + Convert.ToBase64String(memoryStream.ToArray()); } } |
We are loading the document as base URL, loading as path and byte array and we were able to load.
Kindly find the code snippet and sample below.
Code Snippet:
@code { private string DocumentPath { get; set; } = https://www.syncfusion.com/downloads/support/directtrac/general/pd/a4-328485742.pdf; public SfPdfViewerServer viewer { get; set; }
public void OnClickopen(MouseEventArgs args) { //Reads the contents of the file into a byte array, and then closes the file. byte[] byteArray = System.IO.File.ReadAllBytes("wwwroot/data/PDF_Succinctly.pdf"); //Converts the byte array in to base64 string. string base64String = Convert.ToBase64String(byteArray); //PDF document will get loaded from the base64 string. viewer.Load("data:application/pdf;base64," + base64String, null); }
public async Task Load() { string base64String = ="; viewer.Load("data: application / pdf; base64," + base64String, null); } } |
Sample:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/LO1B3B~11350954712.zip
Server sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ControllerPractice_load_using_URL-1061536387.zip
Steps to run the client and server:
Step 1) Run the server project and copy the hosting URL like " https://localhost:44309/pdfviewer ".
Step 2) Paste the copied URL in the client URL and then run the client.
Try this sample and revert to us with the following details, if you have any concerns about this.
This will be helpful for us to analyze further and provide the details.
It turned out I was missing the max file size in the application CS..
Thanks for the update. If the reported issue has been resolved on your end, Please close this forum.