Is there a way to have my console app open my PDF file (in my default application for PDFs) given a byte array?
If you want to open the PDF in the default application you will have to save it first to a temporary location:
byte[] buffer = GetPdfData();
// save to temp file
string path = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()+".pdf");
File.WriteAllBytes(path, buffer);
// open in default PDF application
Process process = Process.Start(path);
process.WaitForExit();
// clean up temp file
File.Delete(path);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With