We know that PDF is not Microsoft technology; it is created by Adobe system and widely used for document exchange, and based on post script. The .Net framework does not provide a library to easily handle PDF files in .Net. If we want to show a PDF file in a .Net form then we can use many approaches such as we can use webbrowser or we can use office library, but we can also use the Acrobat Reader control. Adobe provides an ActiveX COM control that you can add to the CSharp Toolbox. It is a free Adobe Acrobat PDF Reader.
Start C# Windows application and add the control to the C# Toolbox.
Right-click on any tab of toolbox and select "Choose Items... Select the "COM Components" tab and click the check "Adobe PDF Reader" and click OK.
You will see the Adobe PDF Reader control icon in the toolbox, then you can drag and drop this control onto your form.
And add a button and add code to its click event for opening PDF files.
private void button1_Click(object sender, EventArgs e)
{
// Create object of Open file dialog class
{
OpenFileDialog dlg = new OpenFileDialog();
// set file filter of dialog
dlg.Filter = "pdf files (*.pdf) |*.pdf;";
dlg.ShowDialog();
if (dlg.FileName!= null)
{
// use the LoadFile(ByVal fileName As String) function for open the pdf in control
axAcroPDF1.LoadFile(dlg.FileName);
}
}
}
To use the Reader control, first make sure that you have downloaded and installed the free Acrobat Reader from Adobe.
You can download it from here
http://get.adobe.com/reader/
If you want to control the Reader, you can use Adobe Acrobat SDK from their developer center (http://www.adobe.com/devnet/acrobat). And need to purchase from Adobe