Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to programatically open PDFs in default PDF reader?

Tags:

c#

i've got an PDF file and want to open it on clients desktop (so i don't know the directory of his default PDF reader)...

...
File.WriteAllBytes(pdfByteArray, path);
File.Open(path, FileMode.Open);
...

seems not to work here...

like image 407
kyjan Avatar asked Dec 19 '11 08:12

kyjan


People also ask

How do I set Adobe Reader to open PDF directly by default?

Right-click the PDF, choose Open With > Choose default program or another app in. 2. Choose Adobe Acrobat Reader DC or Adobe Acrobat DC in the list of programs, and then do one of the following: (Windows 10) Select Always use this app to open .

How do I make PDF open automatically?

Right-click on the thumbnail of any PDF file. On the menu, click Get Info. Navigate to the Open With: section and select Adobe Acrobat DC or Reader from the drop-down list. Tap Change All to apply this change to all future PDF documents.

How do I get a PDF to open at 100% by default?

You can set aLL PDF's to open in 100% view by going to Edit>Preferences>Page Display>Default layout and zoom. If the creator has set a file to open at a different size, those settings will be ignored.

How do I get pdfs to open in PDF instead of Chrome?

Open Acrobat Reader and select Edit > Preferences. Click Internet in the left panel of the Preferences menu and then select Internet Settings. Select the Programs tab. Click Manage Add-Ons and choose Acrobat Reader in the list of add-ons.


1 Answers

Try opening it like this:

File.WriteAllBytes(pdfByteArray, path);
Process.Start(path);

If path ends with some extension (like .PDF) that has an associated program with it will be opened with this program.

like image 54
Darin Dimitrov Avatar answered Oct 12 '22 23:10

Darin Dimitrov