Click here to Skip to main content
14,328,292 members
Rate this:
Please Sign up or sign in to vote.
How can we display a PDF file using WinForms in C# language.
Thanks
Posted
Comments
Sergey Alexandrovich Kryukov 27-Nov-11 13:29pm
   
You mentioned in your comments that you need to show PDF in the form. You should write this in your question instead. Also, please don't post non-solutions using "Add your solution here" -- such posts will be removed, no one gets e-mail confirmation.

Instead, use "Improve quesion", add a comment using "Have a Question or Comment", reply to existing comment.
--SA
Rate this:
Please Sign up or sign in to vote.

Solution 5

If you just want to display a pdf-file on a form you can use the Acrobat-Reader ActiveX Control.

1. If you have acrobat reader installed just add a reference to the Pdf control via the VS toolbox (choose elements/COM/Adobe PDF Reader).
2. Place the Control on a Form (references to AcroPDFLib and AxAcroPDFLib are added to you project)
3. Set the src property to a pdf-file path:
axAcroPDF1.src = @"C:\mypdf.pdf";


But think about the dependency to acrobat reader (target system). And this only works if you dont have to edit the pdf (afaik)
   
Rate this:
Please Sign up or sign in to vote.

Solution 6

Thanks for your help,but i got the solution myself for exactly what I want.


private void Form1_Load(object sender, EventArgs e)
{
axAcroPDF1.LoadFile(@"C:\Users\ATOMIC\Documents\code_chap_1.pdf");

}
   
Rate this:
Please Sign up or sign in to vote.

Solution 7

Thanks for your help,but I got the solution myself for exactly what I want.

private void Form1_Load(object sender, EventArgs e)
{
axAcroPDF1.LoadFile(@"C:\Users\ATOMIC\Documents\code_chap_1.pdf");

}
Don't forget to chek the load form event in the event tab properties which I forgot in the first place.
Thanks again.
   
Rate this:
Please Sign up or sign in to vote.

Solution 1

Assuming you have a PDF reader installed:
Process.Start(@"D:\Temp\myPDFFile.pdf");
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100