Pdf is not viewable, showing only loading/activity indicator

I'm retrieving files using azure blob storage and the following is the code, pdf is not viewable only showing loading indicator, other files are viewable but not pdf.

   

protected string DocumentPath { get; set; }

        private async Task GetDocumentDetails(string filename)
        {
            try
            {
                if (containerClient is null)
                    return;

                IsLoading = true;
                if (!string.IsNullOrEmpty(filename))
                {
                    // Get a reference to a blob
                    BlobClient blobClient = containerClient.GetBlobClient(filename);

                    if (blobClient is null)
                        return;

                    // Download the blob's contents and save it to a file
                    BlobDownloadInfo downloadInfo = await blobClient.DownloadAsync();

                    using MemoryStream memoryStream = new MemoryStream();
                    await downloadInfo.Content.CopyToAsync(memoryStream);
                    memoryStream.Position = 0;

                    if(downloadInfo?.ContentType == "application/pdf")
                    {
                        DocumentType = "pdf";
                        DocumentPath = "data:application/pdf;base64," + Convert.ToBase64String(memoryStream.ToArray());
                    }
                     else if (downloadInfo?.ContentType == "application/msword")
                    {
                        DocumentType = "doc";
                        WordDocument document = WordDocument.Load(memoryStream, ImportFormatType.Docx);
                        DocxString = JsonConvert.SerializeObject(document);
                        document.Dispose();

                        DocumentEditorModule editor = docContainer.GetDocumentEditor();
                        await editor.Open(DocxString);
                    }
                    else if (downloadInfo?.ContentType == "image/jpeg")
                    {
                        DocumentType = "image";
                        DocumentPath = "data:image/jpeg;base64," + Convert.ToBase64String(memoryStream.ToArray());
                    }

                    memoryStream.Dispose();
                }
                StateHasChanged();
            }


using Azure.Storage.Blobs as this is currently recommended by Microsoft, and older nugets (Microsoft.Azure.Storage.Blob)are deprecated.



3 Replies

AA Akshaya Arivoli Syncfusion Team November 26, 2020 05:54 PM UTC


Hi Richy, 

We were unable to reproduce the reported issue with the provided details.  Please find the sample which we have tried from the below link 

Kindly try it and revert to the modified sample and the PDF document, if you have any concern about this 

Regards,  
Akshaya   



RI Richy replied to Akshaya Arivoli December 1, 2020 09:19 AM UTC


Hi Richy, 

We were unable to reproduce the reported issue with the provided details.  Please find the sample which we have tried from the below link 

Kindly try it and revert to the modified sample and the PDF document, if you have any concern about this 

Regards,  
Akshaya   


Actually, its loading documents while in localhost but after it published to azure getting this issue.


AA Akshaya Arivoli Syncfusion Team December 2, 2020 02:26 PM UTC

Hi Richy, 


Thank you for your update. 


The provided information was not clear to reproduce the issue from our side. Can you please provide more details about your issue, error details, console errors if any, network tab response details. Also, ensure whether the document is obtained properly from the Azure blob and ensure the format of the base64 string. These details will be helpful for us to investigate further and assist you better. 


Regards, 
Akshaya  


Loader.
Up arrow icon