Is there a way to have my con开发者_JAVA技巧sole 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);
精彩评论