Link to home
Start Free TrialLog in
Avatar of Joseph Jones
Joseph JonesFlag for Australia

asked on

Opening of Pdf file with specific page number doesn't work on production environment.

Hi,

The following code works fine to open a pdf file with a specific page number in developer environment but when I install the web application on my local iis machine, the pdf file doesn't open. There is no error message either to trouble shoot. Can you please help on this issue?

Thanks
Joe

Private Sub ShowPDF(intRecID As Integer, intBkRecID As Integer, _
                       intImageID As Integer, intPdfPageNo As Integer, strFileCode As String)


        Dim strJoePath As String = LoadWebImagePath(intImageID)
        Dim myProcess As New System.Diagnostics.Process()


        myProcess.StartInfo.FileName = "Acrobat.exe"
        myProcess.StartInfo.Arguments = String.Format(" /A ""page=" & intPdfPageNo & "=OpenActions"" ""{0}""", strJoePath & "\" & strFileCode & ".PDF")
        Try
            myProcess.Start()
        Catch ex As Exception
            If ex.Message <> "" Then
                Try
                    If File.Exists(strJoePath & "\" & strFileCode & ".PDF") = True Then
                        Me.RadWindowManager1.RadAlert("FILE EXISTS..!!!", 300, 100, "Image Loading", "alertCallBackFn", "/images/Alert.gif")
                    End If
                    myProcess.StartInfo.FileName = "AcroRd32.exe"
                    myProcess.StartInfo.Arguments = String.Format(" /A ""page=" & intPdfPageNo & "=OpenActions"" ""{0}""", strJoePath & "\" & strGRRFileCode & ".PDF")
                    myProcess.Start()
                Catch ex2 As Exception                
                    Me.RadWindowManager1.RadAlert("FATAL ERROR : " & ex2.Message.ToString & ". ..!!!", 300, 100, "Image Loading", "alertCallBackFn", "/images/Alert.gif")
                    Exit Sub
                End Try
            End If
        End Try
        myProcess.Close()
        myProcess = Nothing    
    End Sub
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

If you are trying to load this thru a web browser, I think you will find that you can't launch an EXE on a user machine thru a web browser.  That is considered a serious security problem and is blocked by all browsers.
Avatar of Joseph Jones

ASKER

Hi Dave,

Is there any way you can suggest to a open pdf file with a specific page?

Thanks

Joe
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial