Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 18-Apr-11 3:59am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Comments
Tarun.K.S at 18-Apr-11 9:13am
   
Perfect answer! 5+
Manfred R. Bihy at 18-Apr-11 9:31am
   
Thanks Tarun!
Sandy058 at 19-Apr-11 0:34am
   
thank you Manfred...
5+ :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Use Process.Start :
 
Process.Start(@"C:\ThisIsA.pdf");
  Permalink  
v2
Comments
Sandy058 at 19-Apr-11 0:35am
   
thank u Tarun... :)
Tarun.K.S at 19-Apr-11 1:58am
   
You're welcome!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

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[^]
  Permalink  
Comments
Sandy058 at 19-Apr-11 0:36am
   
Thank you Mark
SAKryukov at 19-Apr-11 1:40am
   
Sure, a 5.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Try:
            Process p = new Process();
            ProcessStartInfo s = new ProcessStartInfo(@"F:\Temp\MyPDFFile.pdf");
            p.StartInfo = s;
            p.Start();
  Permalink  
Comments
Tarun.K.S at 18-Apr-11 9:13am
   
Good answer! 5+
Manfred R. Bihy at 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 R. Bihy at 18-Apr-11 9:35am
   
Doh!
UseShellExecute defaults to true. Y'all ignore my incoherent rambling. :)
OriginalGriff at 18-Apr-11 9:40am
   
I saw no ramblings! :TunelessWhistleSmiley:
Nothing to see here, move along!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

http://www.codeproject.com/Articles/37458/PDF-Viewer-Control-Without-Acrobat-Reader-Installe
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

  Permalink  
Comments
Mark Nischalke at 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 at 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....

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

  Print Answers RSS
0 OriginalGriff 304
1 Sergey Alexandrovich Kryukov 255
2 Shweta N Mishra 216
3 Maciej Los 210
4 PIEBALDconsult 184
0 OriginalGriff 7,630
1 Sergey Alexandrovich Kryukov 7,022
2 DamithSL 5,586
3 Manas Bhardwaj 4,946
4 Maciej Los 4,525


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 20 Mar 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100