28

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?

CCondron
  • 1,926
  • 17
  • 27
Happy boy
  • 309
  • 1
  • 4
  • 4
  • do you need to open it for reading? editing? image extraction? PDFToolkit is what I normally use for all that stuff, dunno if you can use it in c# tho – Jason Jul 19 '11 at 05:55

3 Answers3

129

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

System.Diagnostics.Process.Start(@"c:\file.pdf");
albertjan
  • 7,739
  • 6
  • 44
  • 74
Razack
  • 1,826
  • 2
  • 16
  • 37
3

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

Community
  • 1
  • 1
Sergey Shulik
  • 950
  • 1
  • 9
  • 24
1

to give the third possible answer to your question:

if you want to edit the PDF-file you can use a library like iTextSharp or PDFSharp

fixagon
  • 5,506
  • 22
  • 26