Raj Yadav Raj Yadav -4 years ago 116
C# Question

open Pdf document in C# in Window application

I am creating a pdf in

C#
. it is successful created and store in my drive but now I open that created pdf using on button click on my window form.

How can I do this.

I am using
AcropdfLib
but in that there is no
show()
method found.

Answer Source

How you want to open the created PDF ? Just open the PDF file separately or open within windows form ?

Just to Open PDF file

Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
process.StartInfo = startInfo;

startInfo.FileName = @"C:\Users\user\Desktop\eBook.pdf";
process.Start();

Load PDF within windows form

You can use WebBrowser control to load PDF by passing file path to Navigate()

private void OpenPdf(string filePath)
{
    if (!string.IsNullOrWhiteSpace(filePath))
    {
        webBrowser1.Navigate(@filePath);
    }
}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download