shlomi
shlomi

Reputation: 3

OpenFileDialog to view pdf file c#

I just want to open a pdf file and not to use it. If the user wants to be able to print via a glider. I want to just pressing a button will open the file if Acrobat Reader to view

Upvotes: 0

Views: 4607

Answers (2)

Fabio Maurizio Mirone
Fabio Maurizio Mirone

Reputation: 91

Visual Basic CODE:

  Dim FilePath As String = "<YourFilePath>" & "<YourFileName>" & ".pdf"
  Dim Process As System.Diagnostics.Process = New System.Diagnostics.Process
  Process.StartInfo.FileName = FilePath
  Process.Start()

Every time the relative pdf file will show on a separate window

Obviously you MUST HAVE Adobe Reader INSTALLED on the CLIENT PC

It works pefectly. Used in Visual Studio 2010.

Upvotes: 2

Eugenio De Hoyos
Eugenio De Hoyos

Reputation: 1775

To open the PDF, try using the following code with the PDF's filename as the command.

string command=@"c:\Users\User\Desktop\hello.pdf";

var process = new System.Diagnostics.Process
            {
                StartInfo =
                    new System.Diagnostics.ProcessStartInfo(command)
            };

process.Start();

Upvotes: 3

Related Questions