Click here to Skip to main content
15,887,477 members
Please Sign up or sign in to vote.
2.67/5 (3 votes)
See more:
Good afternoon to all.

I have developed a windows application in vb.net which is used edit pdfs. I have used web browser control to get and display a pdf file by means of ACROBAT 9 Pro. After I populate it, when I press CTRL+R the pdf will be opened in foxit pdf edit software. When I save there modifications will be updated in my browser.

Now my problem was with Acrobat 6 it was working fine. But in Acrobat 9, it will shows the error when I edit and try to save the pdf.

Error: Failed to save the document. Please check if the file is opened by another application

Refer the below code:
VB
     Private Sub EditPDFToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EditPDFToolStripMenuItem.Click

    Dim objProcess As System.Diagnostics.Process
    Dim ProcessPath As String = "C:\Program Files\Foxit Software\PDF Editor\PDFEdit.exe "
    Try

        Dim procList() As Process = System.Diagnostics.Process.GetProcessesByName("AcroRd32")
        If procList.GetUpperBound(0) >= 0 Then
            For prc As Integer = 0 To procList.GetUpperBound(0)
                If procList(prc).ProcessName = "AcroRd32" Or procList(prc).ProcessName = "Acrobat.exe" Then 'Kill Arcobat Reader Application
                    procList(prc).Kill()
                    procList(prc).Close()
                End If
            Next prc
        End If
        objProcess = New System.Diagnostics.Process()
        objProcess.StartInfo.FileName = ProcessPath
        objProcess.StartInfo.Arguments = sFilePath & "\" & sFileName
        objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
        objProcess.Start()
        objProcess.WaitForExit()
        objProcess.Close()
        MyWebBrowser.Refresh()
    Catch err As System.Exception
        MessageBox.Show(err.Message)
        MessageBox.Show("Could not start process " & ProcessPath, "Error")
    End Try

End Sub
Posted
Updated 30-Oct-12 8:34am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900