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
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();
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.
精彩评论