Expanding on this question, I'm struggling to work out how I can specify which PDF I'm reading.
I'm creating my PDF with WkHtmlToPdf
which generates the PDF file. I'm then saving the PDF bytes to my database and I want to read it out again to display it on the View:
public void GetPDF(int id)
{
// get the byte array for the PDF out of the database
var Pdf = db.Invoices.FirstOrDefault(x => x.Id == id).Document;
//FileStream Stream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
//return File(Stream, "application/pdf");
// this code reads from a file but I need to read the byte array
// back out so that it displays as a PDF
}
On my View, I'm doing this as per the answer in the linked question:
<object data='@Url.Action("GetPDF")'></object>
How do I pass in the Invoice ID parameter into the GetPDF
method?
Is there a better way to do this?