开发者

opening pdf file in console app

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜