Hi I got some pdf files in Byte[] and I'm looking for a way to view them inside a WPF application.
I have already looked at http://hugeonion.com/2009/04/06/displaying-a-pdf-file-within-a-wpf-application/ But ran into problems with visual studio not being able to ref the correct dll's, just like in the comments.
But anyway, that method only allows LoadFile(string filename) and I would really like a way to use the Byte[] directly instead of wasting time saving it开发者_运维知识库 to a temp location.
Edit
According to Jerry Nixon Answer
I added a WebBrowser to test it, but it just shows the Open file dialog instead of displaying the file in the browser.
<Grid>
<WebBrowser Name="myBrowser" Source="file://C:\mypdffile.pdf" />
</Grid>
Edit 2
Was running Win 7 64 and changing my app's Platform Target from AnyCpu to x86 made it work.
The absolute best and easiest is to embed a web browser, write your byte[] to a temp location and point your browser to that location. The Adobe reader will render the PDF inside the browser and thus inside your application. I've done it. It works fine.
Write byte[] to a file: How to convert Binary to Byte and write as a file in c#
Find Temp folder: Creating a temporary directory in Windows?
精彩评论