none
Opening PDF files RRS feed

  • Question

  • I am using an Open File Directory to open a PDF file.  It works just fine, but not the way I want to do it.

    The way it works now is that I am taken to the location of the PDF file I want to open.  I then select the file and right click the mouse and select to open the file with Adobe Acrobat.

    What I want to do is not have to right click and the file be opened by Acrobat automatically.  Can I do that?


    gwboolean

    Tuesday, June 5, 2018 11:25 PM

All replies

  •  Process.Start("c:\\your_pdf_file.pdf");

    Tuesday, June 5, 2018 11:47 PM
  • Thanks.  However, I was hoping for one more step.  This method does put me in a good place, but it still requires that I double click to open the PDF file.  Is there a method that just goes ahead and opens it without any input from the user?

    gwboolean

    Wednesday, June 6, 2018 3:48 PM
  • Why double-click ?

    You get the path+pdf name then you call Process.Start

    and the Shell opens the pdf file with the associated executable, usually AcroRd32.exe


    • Edited by Castorix31 Wednesday, June 6, 2018 4:42 PM
    Wednesday, June 6, 2018 4:40 PM
  • You're using open file dialog so I suppose that is why you have to double click the file name then open. If you know the path and filename you want to open already then don't bother using open file dialog.

    La vida loca

    Wednesday, June 6, 2018 4:43 PM
  • It did not do that.  The browser window opened and the PDF that I wanted opened was highlighted.

    I had taken the OFD out of the code, so was not calling that, although it still exists as I use it for a few other things.

    I did have the name property of the OFD set, which did cause the highlighting when I did the Process call.  This suggests to me that I might not be able to have and OFD on the form to get this to work as intended?


    gwboolean

    Wednesday, June 6, 2018 5:01 PM