Click here to Skip to main content
15,905,325 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am creating windows application in which i want to open and read PDF file through coding.On browse button click i select the pdf file to open,so which control is used for this? reply please.
Posted
Comments
joshrduncan2012 22-Oct-13 13:11pm    
Which control is used for what? Browsing for a file?

Check this article :
How to Show pdf file in C#[^]
Also can see :
about opening a pdf file in c#[^]
 
Share this answer
 
v3
Comments
ErrCode 22-Oct-13 23:41pm    
From going to the link, the suggested solution will make your application depend on having Adobe Acrobat Reader installed for that code to work. If you are ok with making your application require Acrobat Reader be installed, then this is ok.
A non-embedded solution (i.e. not a control put into your own UI) is get Windows to "run" the PDF file, which will open the PDF file with the user's default PDF application handler (similar to what would happen had the user "double-clicked" on the PDF file to open it).

The benefit of doing it this way is that the user can choose what application to use for PDFs (by setting their preferred PDF-capable application as the default for opening a PDF file) and also means that your application will no longer depend directly on Adobe Acrobat Reader.

C#
// Code snippet...
string pdfFilePath= "C:\MyLocation\My.pdf";

var start = System.Diagnostics.Process.Start(pdfFilePath);
start.EnableRaisingEvents = true;
start.Exited += delegate (object sender, EventArgs e)
{
    // You can even do something when the PDF application closes
}


Of course this depends on whether you can change your requirements to not require embedding a PDF viewing control within your application.
 
Share this answer
 
v3

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