groupdocs-free-consulting / projects

0 stars 0 forks source link

DotNet Core 3.1 App that includes downloading files from Azure Storage to be viewed within the application #6

Closed daniel-desjardins closed 3 years ago

daniel-desjardins commented 4 years ago

Please check if it satisfies the following requirements:

If your requirement is actually a bug in our APIs or a feature request for our APIs then please use our forum to report it and get quick help: https://forum.groupdocs.com/

If all the above requirements are satisfied then please move on:

Insurance App that needs to view Documents related to claims. The Docs are stored on Azure Blob. They can be pdf, docx, richtext or email files.

DotNet Core 3.1

The files are small -- One or Two Pages. They are WORM documents and will never be modified. I have tried the demo code and I'm able to download the documents to a memory stream and then use the following code to render them. Everything seems to work except I don't see anything so clearly I'm missing something. Or to put it another way. I can do everything except the improtant part: View Them. I tried the same thing with a document off the local disk with the same result. I could do everything except view it. What I need to know is what is the best way that I can display these as seamlessly as possible within the application to the user. Here is the code from a simple view test I did from local disk. The code is run from a controller and returns a View(). The process seems to run fine but at the end it returns me back to my Razor view and I see nothing.

< public void DisplayDocument()
        {

            using (Viewer viewer = new Viewer(@"E:\temp\ODLAZURE-JAN-2020.pdf"))
            {
                PdfViewOptions viewOptions = new PdfViewOptions();
                var test = viewOptions.GetType();
                viewer.View(viewOptions);
            }
        }
>

I 
atirtahirgroupdocs commented 4 years ago

@daniel-desjardins ,

This is how API works:

Once the output (in your case PDF) is saved, it could be displayed in the browser. It depends on your business logic that how you want to display the output PDF in browser (e.g. pass output path to view and then display, fetch PDF from disk in Razor view and then display it).

Below is the code to process input file, convert and save it:

string outputDirectory = "output directory";
string outputFilePath = Path.Combine(outputDirectory, "output.pdf");
using (Viewer viewer = new Viewer("input file"))
{
      PdfViewOptions options = new PdfViewOptions(outputFilePath);
      viewer.View(options);
}

We'd recommend you to download and run this DotNet Core Web Application in order to see how API works. It simply takes a source file input, render/converts it and displays output PDF in browser. Let us know if this work-flow/process meet your requirement.