Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open or launch PDF Files in C#.Net? [closed]

How do I launch a PDF Programmatically from a C# application in it's own process?

Originally: I want to open PDF file when i click button in C#.Net?

like image 926
Happy boy Avatar asked Jul 19 '11 05:07

Happy boy


People also ask

How do I open a PDF file in C?

in Windows, i just use this code: ShellExecute(GetDesktopWindow(), "open", "D:\\Folder\\File. pdf", NULL, NULL, SW_SHOWNORMAL);

How do I open a PDF program?

Right-click on the PDF file and select "Open With". Select "Adobe Reader" from the list of programs.

How do I open a PDF file in Linux?

Suppose we have a PDF file “file. pdf” in the Downloads directory. Or directly provide the file name and path to the evince command to open a PDF file from anywhere in a Linux terminal. After providing a PDF file and executing the evince command, the PDF file will open up.


2 Answers

I assume you just want to open the file. Try the following

System.Diagnostics.Process.Start(@"c:\file.pdf"); 
like image 116
Razack Avatar answered Sep 28 '22 02:09

Razack


What do you mean for "open PDF file"? If you need to read all byties more simple method is:

byte[] byteArray = System.IO.File.ReadAllBytes(@"c:\file.pdf"); 

If you want display its on WinForm - look that

like image 39
Sergey Shulik Avatar answered Sep 28 '22 01:09

Sergey Shulik