Click here to Skip to main content
15,921,295 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello i am working in windows application in this i have successfully save pdf in database now i want to display that in adobe reader which i have been added from toolbox
what should i need to do thats why i can able to view pdf in adobe reader

What I have tried:

C#
byte[] DisplayImage = (byte[])(dt.Rows[0][1]);
           MemoryStream mem = new MemoryStream(DisplayImage);

           axAcroPDF1.LoadFile(DisplayImage);


i have use this code but here i cannot convert dt rows to adobe reader
Posted
Updated 1-Nov-16 3:13am
v2
Comments
[no name] 31-Oct-16 9:27am    
Are we supposed to guess what the error is that you see on your screen that we can't see?
AZHAR SAYYAD 31-Oct-16 9:30am    
here in my code i am not able to convert the dt.rows in pdf reader
[no name] 31-Oct-16 10:07am    
I am positively, absolutely sure that is not the error message that is being displayed on your screen. It's really not that difficult to copy and paste some text.
Richard MacCutchan 31-Oct-16 10:55am    
Does LoadFile accept a memory stream?
Richard Deeming 31-Oct-16 14:49pm    
More to the point, does LoadFile accept a byte array?

(Based on the code posted, the MemoryStream is created but never used.)

You could load the default web browser (most modern browsers can display PDF files) on the system with the path to the pdf file as your URL.
 
Share this answer
 
v2
Rather than relying on an ActiveX control, which may not be present on your users' computers, you might have better luck using a native .NET solution.

PdfiumViewer[^] is an open-source .NET library based on Google's "PDFium" project. You can install it via NuGet[^], and it seems to be actively maintained.

If you want to stick with the ActiveX control, you'll need to check what the LoadFile method expects as its parameter. Everything I've seen suggests it wants a path to a PDF file on disk, not an array of bytes or a stream.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900