Click here to Skip to main content
15,917,875 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hiii Guys,
I wanted to launch a File(Pdf format)using C#. Has any one worked on this kind of excercise previously??
pls give some suggestions..

THanks
Sandy
Posted

it is easy in C#

System.Diagnostics.Process.Start(path);

in managed C++
System::Diagnostics::Process::Start(path);
 
Share this answer
 
http://www.codeproject.com/Articles/37458/PDF-Viewer-Control-Without-Acrobat-Reader-Installe
 
Share this answer
 
 
Share this answer
 
Comments
[no name] 18-Apr-11 14:41pm    
Why would this be helpful to the OP? The question was how to open, not how to create a PDF. This link is also related to ASP.NET where the user need a Windows solution.
Nischal Bhatt 18-Apr-11 15:50pm    
Apologies, it was not clear to me in the beginning whether it's a windows or asp.net question, My Bad....
You didn't specify whether this was for Windows or Web.

For Web, create a URL to the document

For Windows

Process p = new Process();
p.StartInfo.FileName = "myPDF.pdf";
p.Start();



http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx[^]
 
Share this answer
 
Comments
Sandy058 19-Apr-11 0:36am    
Thank you Mark
Sergey Alexandrovich Kryukov 19-Apr-11 1:40am    
Sure, a 5.
--SA
Try:
Process p = new Process();
ProcessStartInfo s = new ProcessStartInfo(@"F:\Temp\MyPDFFile.pdf");
p.StartInfo = s;
p.Start();
 
Share this answer
 
Comments
Tarun.K.S 18-Apr-11 9:13am    
Good answer! 5+
Manfred Rudolf Bihy 18-Apr-11 9:34am    
I'm not quite sure about it, but I thought for that to work one had to set ProcessStartInfo.UseShellExecute to true and also set the Verb property to "open", but alas I might be mistaken once again. :)
Manfred Rudolf Bihy 18-Apr-11 9:35am    
Doh!
UseShellExecute defaults to true. Y'all ignore my incoherent rambling. :)
OriginalGriff 18-Apr-11 9:40am    
I saw no ramblings! :TunelessWhistleSmiley:
Nothing to see here, move along!
Use Process.Start :

Process.Start(@"C:\ThisIsA.pdf");
 
Share this answer
 
v2
Comments
Sandy058 19-Apr-11 0:35am    
thank u Tarun... :)
Tarun.K.S 19-Apr-11 1:58am    
You're welcome!
Use the types Process and ProcessStartInfo setting ProcessStartInfo.UseShellExecute[^] to true. Then if you set ProcessStartInfo.FileName to the PDF (full path) and the ProcessStartInfo.Verb to something like "open". Create a Process and invoke the Start method with th ProcessStartInfo as a parameter.

If the PDF reader is still associated with the extension PDF this will open the PDF reader with said document.

Best Regars,

-MRB
 
Share this answer
 
Comments
Tarun.K.S 18-Apr-11 9:13am    
Perfect answer! 5+
Manfred Rudolf Bihy 18-Apr-11 9:31am    
Thanks Tarun!
Sandy058 19-Apr-11 0:34am    
thank you Manfred...
5+ :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900