Re: Convert btye[] to pdf
Sébastien Lorion <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Message-ID | <[email protected]> |
As Greg pointed out, it would be better not to hardcode which application opens the PDF file. I hate when a program does that to me. Sébastien On Wed, Jan 21, 2009 at 11:19 AM, Peter Ritchie < [email protected]> wrote: > You'll likely not be able to avoid writing the data to a file in a Windows > application. Unless you can find a control that will accept a byte array as > a parameter (which will likely then write that data to a file on your > behalf) that you can host in your application. > > Assuming acroread is installed in the standard directory, you can do this: > String filePath = Path.GetTempFileName(); > System.IO.File.WriteAllBytes(filePath, Data); > System.Diagnostics.Process.Start(@"C:\Program Files\Adobe\Reader > 8.0\Reader\AcroRd32.exe", FilePath); > > When the user cleans their temporary directory the file being written will > be erases. Otherwise, you can subscribe to the Process.Exited event (after > storing the return value of the Start method) and delete the file then. > > =================================== > View archives and manage your subscription(s) at > http://peach.ease.lsoft.com/archives > =================================== View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives