Home view a PDF without downloading it
Reply: 0

view a PDF without downloading it

user648
1#
user648 Published in June 22, 2018, 11:30 am

Now my controller returns the file in this way:

[HttpGet]
public IActionResult document(int id)
{
      var byteArray = db.instances.Where(c => c.id == id).FirstOrDefault().document;    
      if (byteArray == null)
      {
            return null;
      }
      Stream stream = new MemoryStream(byteArray);

      return File(stream, "application/pdf", "document.pdf");
}

Client:

<a href="@Url.Action("document", "Catalog", new { id = Model.id })" target="_blank">Open pdf</a>

I would like to view the PDF without downloading it, how can I do it?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.313254 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO