Results 1 to 2 of 2

Thread: Compare Pdf...

  1. #1

    Thread Starter
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    Thumbs up Compare Pdf...

    hi..
    I want to execute the menu item "Documents " in adobe proffession 7.0,
    i tried like this but its not working...
    Like this
    Code:
     ok = AcrobatApp.MenuItemExecute("DigSig:ToolsDiff")
    My problem is i cant able to fire the event.. this ok always returning False..
    I don know how to proceed next.. is there any other way to do this,,,
    Here is the code

    Code:
    Function CompareTwoPdfFiles( _
            ByVal OldFileName As String, _
            ByVal NewFileName As String _
            ) As Boolean
        Screen.MousePointer = vbHourglass
    
        ' Initialize Acrobat by creating AcrobatApp object.
        ' If Acrobat is already running,
        ' it will get the existing acrobat object.
        Dim AcrobatApp As Acrobat.CAcroApp
        Set AcrobatApp = CreateObject("AcroExch.App")
    
        ' Show Acrobat (skip this for a background server).
        AcrobatApp.Show
    
        ' Is a PDF already open?
        Dim OpenPdfCount As Integer
        OpenPdfCount = AcrobatApp.GetNumAVDocs
    
        Dim DocumentWasOpen As Boolean
        DocumentWasOpen = (OpenPdfCount > 0)
    
        Dim ok As Boolean
        ok = True
    
        ' Open the "New" file first,
        ' so it appears on the right side in the comparison output.
        Dim NewPd As Acrobat.CAcroPDDoc
        Dim NewAv As Acrobat.CAcroAVDoc
        If ok Then
            Set NewPd = CreateObject("AcroExch.PDDoc")
            ok = NewPd.Open(NewFileName)
            If ok Then
                Set NewAv = NewPd.OpenAVDoc(NewFileName)
            Else
                Screen.MousePointer = vbNormal
                MsgBox "Could not open PDF file: " & NewFileName
            End If
        End If
    
        ' Open the "Old" file second,
        ' so it appears on the left side in the comparison output.
        Dim OldPd As Acrobat.CAcroPDDoc
        Dim OldAv As Acrobat.CAcroAVDoc
        If ok Then
            Set OldPd = CreateObject("AcroExch.PDDoc")
            ok = OldPd.Open(OldFileName)
            If ok Then
                Set OldAv = OldPd.OpenAVDoc(OldFileName)
            Else
                Screen.MousePointer = vbNormal
                MsgBox "Could not open PDF file: " & OldFileName
            End If
        End If
    
        If ok Then
            ok = AcrobatApp.MenuItemExecute("DigSig:ToolsDiff")
            
            If Not ok Then
                Screen.MousePointer = vbNormal
                MsgBox "Could not compare files"
            End If
        End If
    
        Dim NoSave As Boolean
        NoSave = True
    
        If ok Then
            Dim DiffAv As Acrobat.CAcroAVDoc
            Set DiffAv = AcrobatApp.GetActiveDoc
    
            Dim DiffPd As Acrobat.CAcroPDDoc
            Set DiffPd = DiffAv.GetPDDoc
    
            ok = DiffPd.Save(PDSaveFull, "c:\sample\Comparison.pdf")
            If Not ok Then
                Screen.MousePointer = vbNormal
                MsgBox "Could not save comparison output file"
            End If
    
            If Not (DiffAv Is Nothing) Then
                DiffAv.Close (NoSave)
                Set DiffAv = Nothing
            End If
    
            If Not (DiffPd Is Nothing) Then
                DiffPd.Close
                Set DiffPd = Nothing
            End If
        End If
    
        If Not (OldAv Is Nothing) Then
            OldAv.Close (NoSave)
            Set OldAv = Nothing
        End If
    
        If Not (OldPd Is Nothing) Then
            OldPd.Close
            Set OldPd = Nothing
        End If
    
        If Not (NewAv Is Nothing) Then
            NewAv.Close (NoSave)
            Set NewAv = Nothing
        End If
    
        If Not (NewPd Is Nothing) Then
            NewPd.Close
            Set NewPd = Nothing
        End If
    
        ' End Acrobat only if it was not existing before,
        ' or it was existing but no PDF file was open.
        If Not (AcrobatApp Is Nothing) Then
            If Not DocumentWasOpen Then
                AcrobatApp.CloseAllDocs
                AcrobatApp.Exit
    
                Set AcrobatApp = Nothing
            End If
        End If
        Screen.MousePointer = vbNormal
        CompareTwoPdfFiles = ok
    End Function
    Last edited by vijy; Oct 19th, 2007 at 05:24 AM.
    Visual Studio.net 2010
    If this post is useful, rate it


  2. #2
    New Member
    Join Date
    Mar 2009
    Posts
    1

    Re: Compare Pdf...

    Try using:
    MenuitemExecute(DIGSIG:CompareDocuments )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width