Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 4 years ago.
Is there any way to view PDF files in a Winforms tool? I've seen solutions such as converting the pdf file into images and showing them in an picture box. However, I am asking whether i can view the file as PDF. Is there any tool from adobe or from Microsoft that supports this?
you can use System.Diagnostics.Process.Start as well as WIN32 ShellExecute function by means of interop, for opening PDF files using the default viewer:
System.Diagnostics.Process.Start("SOMEAPP.EXE","Path/SomeFile.Ext");
[System.Runtime.InteropServices.DllImport("shell32. dll")]
private static extern long ShellExecute(Int32 hWnd, string lpOperation,
string lpFile, string lpParameters,
string lpDirectory, long nShowCmd);
Another approach is to place a WebBrowser Control into your Form and then use the Navigate method for opening the PDF file:
ThewebBrowserControl.Navigate(@"c:\the_file.pdf");
i think the easiest way is to use the Adobe PDF reader COM Component
- right click on your toolbox & select "Choose Items"
- Select the "COM Components" tab
- Select "Adobe PDF Reader" then click ok
- Drag & Drop the control on your form & modify the "src" Property to the PDF files you want to read
i hope this helps
display PDF file into WinForms
Displaying a pdf file from Winform.
displaying a pdf on a windows form?
How to display PDF or Word's DOC/DOCX inside WinForms window?
Reading/Writing PDF Files in Visual C# Windows Forms
Web Browser control might work. http://ryanfarley.com/blog/archive/2004/12/23/1330.aspx
Also a bunch of pdf open source c# projects here
http://csharp-source.net/open-source/pdf-libraries
http://www.youtube.com/watch?v=a59LvC6BOuk
Use the above link
private void btnopen_Click(object sender, EventArgs e){
OpenFileDialog openFileDialog1 = new OpenFileDialog();
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK){
axAcroPDF1.src = openFileDialog1.FileName;
}
}