locked
Visual Basic open PDF block Acrobat Reader RRS feed

  • Question

  • Hello,

    I have a Little problem with a program and a system that used to work. I am preaty sure is something about the system, but cant get it work.

    I made a program that generates a PDF in a net directory and then opens it. It Works in all pc but in one. In the one with the problem it creates de PDF, but when it trys to open the file, is like the Adobe Reader starts but doesn't shows the PDF. Furthermore, from this moment in that PC you can't open any PDF couse the Adobe Reader is started but not shown. If you want to open  PDF you have to kill the 2 process of Adobe Reader Opened.

    I copy here the PDF open code

    Have someone had this tipe of problem?

        Private Sub OpenPDF(FilePath As String)
    
            If My.Computer.FileSystem.FileExists(FilePath) Then
                Try
                    Process.Start(FilePath)
                Catch ex As Exception
                    MsgBox("Instal Acrobat Reader")
                End Try
            Else
                MsgBox("File Not found.")
            End If
    
        End Sub


    • Edited by wuibo Tuesday, May 8, 2018 8:23 AM
    Tuesday, May 8, 2018 8:11 AM

Answers

  • Sorry if it seems that, i am the programmer as i have said. I was looking if someone have had the same problem as i dont see it anywhere and it seems a System problem, not program.

    Anyway, we found that the problem is at the app tha launch the actual program, not a code or System problem, so i close the isue.

    • Marked as answer by wuibo Tuesday, May 8, 2018 11:27 AM
    Tuesday, May 8, 2018 11:25 AM

All replies

  • In the one with the problem it creates de PDF, but when it trys to open the file, is like the Adobe Reader starts but doesn't shows the PDF.

    It appears from your code that you are passing only the path of the PDF file to the Start method.  That means that you are relying on the default OS handling for the .PDF filename extension.  If the default for a PDF file has not been set correctly then it will not open the PDF reader.

    What happens on that machine if you double-click a file with a PDF extension in an Explorer window?  If you get the same response then there is an issue with the installation of the PDF reader.  You could try re-installing it.

    The other option would be to use the Filename property of a StartInfo object to nominate the application, and the Arguments property for the filename, instead of relying on the default handling of a PDF filename extension.  However that means your application will only work if Adobe is installed.

    Tuesday, May 8, 2018 9:05 AM
  • Hello,

    As you say, i only use de path, before this I checked for acrobat and AcroRd32, but thought it was the problem.

    Whe i double-click a PDF file in this PC it opens it with with no problem.

    If My.Computer.FileSystem.FileExists(FilePath) Then
            Try
            Process.Start("acrobat", FilePath)
            Catch ex As Exception
            Try
            Process.Start("AcroRd32", FilePath)
            Catch ex2 As Exception
            Try
            Process.Start(FilePath)
            Catch ex3 As Exception
            MsgBox("Instal Acrobat Reader")
            End Try
            End Try
            End Try
            Else
            MsgBox("File Not found.")
            End If

    Tuesday, May 8, 2018 10:06 AM
  • Wuibo,

    Maybe can you take some minutes more on your code. This forum is not to let the job done for you. In that case hire a programmer. 


    Success
    Cor

    Tuesday, May 8, 2018 11:05 AM
  • Sorry if it seems that, i am the programmer as i have said. I was looking if someone have had the same problem as i dont see it anywhere and it seems a System problem, not program.

    Anyway, we found that the problem is at the app tha launch the actual program, not a code or System problem, so i close the isue.

    • Marked as answer by wuibo Tuesday, May 8, 2018 11:27 AM
    Tuesday, May 8, 2018 11:25 AM