This is a migrated thread and some comments may be shown as answers.

Get PDF from Azure Container

4 Answers 149 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 2
Iron
Iron
Iron
Joel asked on 04 Nov 2019, 09:55 PM

I want to pull a PDF file from a Private/Protected container in Azure.  If it was a public container I could just use a Url.  But, I can't do that so I believe this needs to be pulled following this type of method:

CloudStorageAccount storageAccount = CloudStorageAccount.Parse(storageName);
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
 
CloudBlobContainer sourceContainer =
    blobClient.GetContainerReference(
        sourceContainerName);
 
CloudBlockBlob sourceBlob =
    sourceContainer.GetBlockBlobReference(fileName);
 
if (await sourceBlob.ExistsAsync())
{
    // pull the file into memory
    using (MemoryStream stream = new MemoryStream())
    {
        // load the stream from the blob
        await sourceBlob.DownloadToStreamAsync(stream);
        await sourceBlob.FlushAsync();
        stream.Position = 0;
        ...

 

So, this turns the BLOB into a Memory Stream.  Do you have a best-practices example on how I should do this?  If not, do you have an example of how I can load a stream directly into the control.  Better yet, I pull this through a REST service.  Do you have an example on how to request a stream from an API that then loads it into the control?

Thanks for your help,

Joel

 

4 Answers, 1 is accepted

Sort by
0
Joel
Top achievements
Rank 2
Iron
Iron
Iron
answered on 04 Nov 2019, 10:23 PM
Also, I'm looking for an example of how I would bind the PDF control to a model if I pull the file in from azure when loading the view.
0
Martin
Telerik team
answered on 07 Nov 2019, 04:37 PM

Hello Joel,

Unfortunately we do not have such examples.

A workaround would be to store the file you wish to load from Azure locally. You can then refer to our DPL Processing demo to load the file.

About how to store the files from Azure, you can refer to these two articles:

I hope the above will help you. Feel free to contact us if you have further Kendo related questions.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Joel
Top achievements
Rank 2
Iron
Iron
Iron
answered on 07 Nov 2019, 05:04 PM

This is unacceptable.  These are medical related pdf files that must be kept secure and by bringing them into the website so a link can be used to load your control is unacceptable.  There isn't an auditor in the world that would consider this a secure solution.

Is what I'm attempting... which seems pretty straight forward to me... possible through your control?  If not, I question the value of my Telerik relationship.

0
Martin
Telerik team
answered on 12 Nov 2019, 03:22 PM

Hello Joel,

You will find my answer in the support thread you opened. I shall share my reply here as well in case other users encounter the same problem. A possible approach is demonstrated in this How-To article, which demonstrates how to convert the PDF file to stream and pass it to the PDF Viewer using the fromFile method.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
PDFViewer
Asked by
Joel
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Joel
Top achievements
Rank 2
Iron
Iron
Iron
Martin
Telerik team
Share this question
or