Wpf open PDF file in Adobe Reader with a click on a button

I need a button to open a PDF file with Adobe Reader. I have the following code but it does not work. The file is inside Books folder
on my application.
private void openPDF(object sender, RoutedEventArgs e)
try
System.Diagnostics.Process process = new System.Diagnostics.Process();
bookPDF = "Books/" + dataRow.ItemArray[6].ToString();
Uri pdf = new Uri(bookPDF, UriKind.Relative);
process.StartInfo.FileName = pdf.LocalPath;
process.Start();
process.WaitForExit();
catch(Exception error)
MessageBox.Show("Could not open the file.", "Error", MessageBoxButton.OK, MessageBoxImage.Warning);
I tested a simple string with a test pdf file to open and it opens.
String file = "C:\pdf\Windows_Server_2008_R2_Unleashed.pdf";
process.StartInfo.FileName = file;
process.Start(); process.WaitForExit();

Hi Carlos Sota,
In my experience, I suggest that you could set Copy to Output Directory property of the PDF file to “Copy always”.
Below are my code snippet and screenshot.
private void Button_Click(object sender, RoutedEventArgs e)
try
System.Diagnostics.Process process = new System.Diagnostics.Process();
string path = AppDomain.CurrentDomain.BaseDirectory+@"/abc.pdf";
Uri pdf = new Uri(path, UriKind.RelativeOrAbsolute);
process.StartInfo.FileName = pdf.LocalPath;
process.Start();
process.WaitForExit();
catch (Exception error)
MessageBox.Show("Could not open the file.", "Error", MessageBoxButton.OK, MessageBoxImage.Warning);
Best Regards,
Xavier Eoro
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • I'm not able to open PDF files in Adobe Reader XI.

    I recently updated to Adobe Reader XI and now I can't open any of my PDF documents or PDF e-mail attachments.  When I click on a document I now get a window that asks if I want to allow this file to open.  I click yes and get a monstrousity the likes I've never seen.  It blacks out my screen for a couple seconds and then I get a mixture of my desktop, task bar, and a window wanting to know if I want to open this with Protected Mode disabled.  It only fills 3/4 of the screen, the items all all blown-up in size, and are distorted.  In playing with this I have gotten notes that I have an "Incompatable Application" and "Acrobat failed to connect to a DDS Server".  On occasion I will get an Adobe Reader screen that is completely greyed out with no content in it and after a couple of seconds it goes off.  Other times I got the window about Protected Mode and I've clicked on to disable it but that doesn't work either.  I removed Adobe Reader XI and re-installed Adobe Reader X and I still have the same problem which I did not have before.  I 'm running Windows 7 Professional and have McAfee anti-virus, which I have disbled on one occasion during download and that I still had the same problem.  I went to program files to find the End User License Agreement and try to see if I needed to click on 'Accept" but it tells me the file does not exist.  I even tried using System Restore to take me back to before I did the upgrade to Adobe Reader XI and I still have this problem.  I'm at the end of my knowledge level and because these files are needed in my business I'm only able to operate at about 50%. 

    From: Test Screen Name [email protected]
    Sent: Sunday, August 04, 2013 11:32 AM
    To: gunner0490
    Subject: I'm not able to open PDF files in Adobe Reader XI.
    Re: I'm not able to open PDF files in Adobe Reader XI.
    created by Test Screen Name <http://forums.adobe.com/people/TestScreenName>  in Adobe Reader - View the full discussion <http://forums.adobe.com/message/5565198#5565198

  • Slow to open PDF files in Adobe Reader

    Hello,
    after upgrading to Mac OS 8.5.3 and 10.9 Maverick'm slow to open PDF files from a Windows 2003 Server share.
    In the terminal I get the following errors Print Screen below.
    PING to the IP of the share is less than 1 ms.
    I'm working with adobe reader for Mac.
    How can I fix this?
    Thanks

    From: Test Screen Name [email protected]
    Sent: Sunday, August 04, 2013 11:32 AM
    To: gunner0490
    Subject: I'm not able to open PDF files in Adobe Reader XI.
    Re: I'm not able to open PDF files in Adobe Reader XI.
    created by Test Screen Name <http://forums.adobe.com/people/TestScreenName>  in Adobe Reader - View the full discussion <http://forums.adobe.com/message/5565198#5565198

  • Opening PDF Files in Adobe Reader XI directly from SharePoint 2013 Site

    I am trying to open PDF files in Adobe Reader XI directly from a SharePoint 2013 document library using Internet Explorer 11. When I click the file name it immediately opens the file in Adobe Reader, however it is downloading and opening the file locally
    from the Temporary Internet Files location. If I add a comment to the PDF file, and save it will perform a Save As and the location will default to the temporary folder.
    If instead of clicking the file name, I click the ellipses in SharePoint, copy the file URL, and go to Adobe Reader, click File > Open and paste the link into the file name, Adobe Reader will correctly open the file directly from the SharePoint site and
    prompt for "Open and Checkout, Open, or Cancel".
    Is there a way to get it so that when I click the file in IE, I get the same functionality as a File > Open in Adobe Reader?
    Thanks in advance!

    Hi,
    According to your description, you want to open pdf file in the Adobe Reader directly from document library.
    I suggest you do as the followings:
    1. In SharePoint Central Administration site, click Application Management->Manage Web Applications, select the web application for the site. Click Authentication
    Providers, select default zone, and select Yes for "Enable Client Integration?".
    2. click Site Settings-> Site collection features->"Open Documents in Client Applications by Default" click Activate
    3. set the default open behavior for a document library by using the document library settings page.
    4. Enable the “Adobe Arcobat SharePoint OpenDocuments Component”add-on in the IE11.
    5. Add your current site URL to the trusted web sites in IE11.
    There is a similar threads for your reference:
    http://blog.mikehacker.net/2010/05/03/unable-to-open-pdf-directly-from-sharepoint-2010/
    Thanks,
    Wendy Li
    TechNet Community Support

  • Problem opening PDF files for Adobe Reader

    Problem opening PDF files for Adobe Reader.
    I installed the latest adobe reader for my Mac. Everything is set up. Every time i go to open a pdf file, this shows up...
    "Before viewing PDF documents in this browser you must launch adobe reader and accept the End User Licence Agreement, then quit and relaunch the browser."
    I installed it through the adobe reader website for free. And even though it says 'by clicking "install now" you are agreeing to accept the user licence agreement terms and conditions' it still says i need to accept the T&C's.
    I've tried uninstalling and reinstalling it and same thing over and over again.
    Can someone help!?!?!
    Please contact me via email direct ASAP at....
    [email protected]
    Thank you
    Message was edited by: nick khzouz

    Adobe Reader PDF problems wrote:
    "Before viewing PDF documents in this browser you must launch adobe reader and accept the End User Licence Agreement, then quit and relaunch the browser."
    Did you actually try doing what the message suggests?  Open Adobe Reader and accept the EULA?

  • Unable to open PDF files or Adobe Reader

    I am unable to opern adobe reader or download a ner version of adobe reader.

    Apparently the original software download was corrupt.  I tried to 
    "change" it through the add and delete software area of Windows, and  re-installed
    the software.  That seemed to work.  Debating on whether  to upgrade to one
    of their other products.  I could certainly use  fillable forms, signature,
    and modifiable documents. 
    Thank you for responding.
    In a message dated 3/4/2014 5:34:53 P.M. Pacific Standard Time, 
    [email protected] writes:
    Re:  Unable to open PDF files or Adobe Reader
    created by Claudio  González
    (http://forums.adobe.com/people/Claudio+González)  in Adobe Reader - View the full  discussion
    (http://forums.adobe.com/message/6179300#6179300)

  • Functionality missing - excel opening pdf file launches adobe reader

    When i opened a PDF file in excel or word it used to launch adobe reader instead and show me the file. Yesterday i installed internet explorer 8 and now this functionality has disappeard.
    Anybody knows how to get it back?

    Hi and thanks for replying.
    Well, there used to be something running on the background that opens pdf files in adobe, even if you tried opening them in office applications. And i dont know how it works but now it's gone.
    Problem for me is not the opening thru another program itself, but the functionality being there and now being gone with the installation of internet explorer 8. Also, for some people, like my father, opening something thru adobe reader is very different then opening something thru excel.
    I hope this helps and some1 can point me to the background process to see if i can update/implenent something in ie8.

  • Why can I not open PDF files using adobe reader in firefox?

    When I try to read a PDF file with adobe reader the file looks like it starts to load, I see in the tool bar the page count but the file never opens.

    You can change the action for Portable Document Format (PDF) from Preview in Firefox to use another application like the Adobe Reader or set to Always Ask in "Firefox > Options/Preferences > Applications".
    You can set the pdfjs.disabled pref to true on the <b>about:config</b> page to disable the build-in PDF viewer.
    You can check the value of the plugin.disable_full_page_plugin_for_types pref on the about:config page and remove the application/pdf part if present or reset the pref to the default via the right-click context menu.
    See also:
    *https://support.mozilla.org/kb/view-pdf-files-firefox-without-downloading-them
    Note that your System Details List shows that you have a user.js file in the profile folder to initialize some prefs on each start of Firefox.
    *http://kb.mozillazine.org/Preferences_not_saved
    The user.js file is only present if you or other software has created it, so normally it wouldn't be there.
    You may want to check its content with a plain text editor if you didn't create this file yourself.
    The user.js file is read each time you start Firefox and initializes preferences to the value specified in this file, so involved preferences can only be changed temporarily for the current session.

  • I can't open PDF file in Adobe Reader. How to fix it?

    How to repair PDF file what I can not open in Adobe Reader?

    You're not giving us enough information to be able to help you... Start with:
    - The exact nature of the problem, including any error messages
    - Which version of Reader you're using
    - Which OS you're using
    - Does it happen with just a certain file, or all of them

  • Help opening PDF files using Adobe Reader

    I just downloaded the latest version of Adobe Reader on my Mac, and now whenever I try and open a PDF file, a message pops up saying "Before viewing PDF documents in this browser, you must launch Adobe Reader and accept the End User License Agreement, the Quit and relaunch the browser."  How do I launch Adobe Reader and accept this End User License Agreement??

    Just open the Adobe Reader application (not in the browser!) and accept the EULA.

  • When open pdf file using Adobe Reader 11.0.09 Show message "Adobe Reader has Stopped working".Why?

    Need suggestion to solve this problem..tq

    Hi ra az,
    Which OS are you using?
    Try installing the latest update v11.0.10 and check.
    Have you tried repairing Reader from the 'Help' menu already?
    Also try disabling the protected mode in Reader and launch and check.
    Regards,
    Rave

  • Set firefox to open pdf documents in adobe reader via script or GPO

    I am trying to change the settings of 400+ Windows 7 PCs with 2-10 users per PC. They all use Firefox and Adobe Reader XI. I would like to know how to use the Mozilla Administrative Template or how to create a GPO to change the default pdf viewer in Firefox to Reader XI. i need a way to be able to configure it so when a user logs into the PC via our domain login Firefox will be automatically configured to open PDF's from Firefox in an Adobe Reader window, otherwise we have to manually configure it and that gets very frustrating after the 2nd PC

    From: Test Screen Name [email protected]
    Sent: Sunday, August 04, 2013 11:32 AM
    To: gunner0490
    Subject: I'm not able to open PDF files in Adobe Reader XI.
    Re: I'm not able to open PDF files in Adobe Reader XI.
    created by Test Screen Name <http://forums.adobe.com/people/TestScreenName>  in Adobe Reader - View the full discussion <http://forums.adobe.com/message/5565198#5565198

  • When I try open a .pdf file my Adobe Reader 11 only allows the download / save opening the related window and don't show me both options 1) open with ... and 2) save as.... probably someone flagged the choise... always perform this way ....

    When I try open a .pdf file my Adobe Reader 11 only allows the download / save opening the related window and don't show me both options 1) open with ... and 2) save as.... probably someone flagged the choise... always perform this way ....
    Could some one give help and let me know where I can probably find the settings option that allows me to change and switch to previous situation where it was possible to decide time to time how to proceed either opening the file or saving it ??
    Thanks in advance
    David

    What is your operating system?
    Open a PDF from where?  If online, in what browser?

  • Adobe Reader Splash--I have a PDF file that whenever I try to open it suggests using Adobe Reader with a link to download Adobe Reader...

    Adobe Reader Splash--I have a PDF file that whenever I try to open it suggests using Adobe Reader with a link to download Adobe Reader. I can't get beyond this. I have made Preview the default for all PDF's and yet this persists. I have also deleted Adobe Reader. This particular file is a portfolio, btw.

    I have similar issue. Did u find an answer?

  • How to open a pdf file in Adobe Reader using URL scheme on iOS devices

    To open a pdf files in Adobe Reader on iOS devices,
    I created url links as follows:
    com.adobe.Adobe-Reader://mysite.com/myfile.pdf
    com.adobe.reader.request://mysite.com/myfile.pdf
    But none of these does work.
    Adobe Reader starts up but never opens pdf files.
    Does anyone know how to write URL scheme?
    Thanks in advance.

    Sorry. Wrong category.

Maybe you are looking for