• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

AccessViolationException fatal error, Acrobat 9, AxAcroPDFLib, .NET, Win7

New Here ,
Nov 25, 2009 Nov 25, 2009

Copy link to clipboard

Copied

How do I work around the following fatal error:  AccessViolationException

Steps to reproduce the error:

1.  In MS VisualStudio 2008, Create a Windows Form Application, add a Panel and a Button components to the form.

2.  Add a Reference to the Acrobat COM component for AxAcroPDFLib

3.  Add the following code to the main form:

    private AxAcroPDFLib.AxAcroPDF ax = new AxAcroPDFLib.AxAcroPDF();

    private void button1_Click(object sender, EventArgs e)
    {
      panel1.Controls.Add(ax);

      ax.LoadFile(@"c:\temp\myfile.pdf");
      ax.setView("Fit");     
    }

4.  Run the application

5.  Click the Button

6.  Press the TAB key on the keyboard.

Result:  The application crashes with an AccessViolationException:  Memory Corrupted error.

Note:  I had been working on an application for about a month now, but had Never pressed the Tab key while the application was running until today!!

Although I did not yet test EVERY key, all other keys and activities inside and outside of the Acrobat component, application, and OS seem to work ok.  I can't deploy an application to production if it will crash on Tab keypress.

Platform:

Windows 7, 32bit, all current updates

Acrobat 9 Standard, all current updates

Microsoft Visual Studio 2008 Professional, all current updates

I'm not an Acrobat SDK developer expert, so this may be some simple configuration setting.

Any assistance is greatly appreciated.

Arnold

TOPICS
Acrobat SDK and JavaScript

Views

39.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 17, 2011 Feb 17, 2011

Copy link to clipboard

Copied

In this case you can try the MFC71.dll approach (see my previous post). You can then tell us all, if it worked (I myself personally did not test it, as I do not have time at the moment)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 18, 2011 Feb 18, 2011

Copy link to clipboard

Copied

The version of MFC71.DLL on my machines is 7.10.3077.0 - from 2003 which as far as I can find is the most recent one, and I can't find any legacy versions.

Even the oldest box left in the office which is running XP has ver7.10.3077.0

-- Edited to remove my email sig that was included inadvertently.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 26, 2012 Jan 26, 2012

Copy link to clipboard

Copied

As a workaround in VBA, I used the Microsoft Web Browser control instead of the Adobe Read Control.  It loaded the exact same interface, but didn't crash when you press TAB.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 26, 2012 Jan 26, 2012

Copy link to clipboard

Copied

Hey Brian,

I have tried this in the past, but cannot figure out how to access the control's routines through the web browser component to configure the viewer's options.

Any help is appreciated.

Thank you,

- Dustin Buschow

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 26, 2012 Jan 26, 2012

Copy link to clipboard

Copied

Dustin,

I am only opening the PDF for viewing and possibly printing, so I'm not using any of the other specific PDF control routines you are probably interested in.

Sorry I couldn't be of more help.

-Brian

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 30, 2012 Jan 30, 2012

Copy link to clipboard

Copied

Hi Dustin,

You could probably use Parameters for openning PDF Files in your case. On the last page of the document they describe how to encode the parameters into the URL

aucha

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 20, 2012 Mar 20, 2012

Copy link to clipboard

Copied

The parameters work great.  The thing is that I still need to have an easier way for the user to print the document from GUI in the parent application.  Is there a way to reference the PDF and have it open the print dialog using something like javascript?  Or even better, an undocumented parameter to open the print diaglog prompt?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 20, 2012 Mar 20, 2012

Copy link to clipboard

Copied

DBuschow wrote:

The parameters work great.  The thing is that I still need to have an easier way for the user to print the document from GUI in the parent application.  Is there a way to reference the PDF and have it open the print dialog using something like javascript?  Or even better, an undocumented parameter to open the print diaglog prompt?

Yes you can. See this document. However, next time please start a new thread rather than asking off-topic questions.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 12, 2011 Apr 12, 2011

Copy link to clipboard

Copied

Hi,

I have the same problem with my VB-Dot.Net-Application. If someone has a workaround or an official hint to solve the Tab-Problem please let me know

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 12, 2011 Apr 12, 2011

Copy link to clipboard

Copied

VMBLaOs wrote:

Hi,

I have the same problem with my VB-Dot.Net-Application. If someone has a workaround or an official hint to solve the Tab-Problem please let me know

With VB .Net it will be not difficult to intercept message 0x1450. See for example the comments to this post

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 18, 2011 Apr 18, 2011

Copy link to clipboard

Copied

Can please give my another hint how to do this in VB.Net.

I don't know howto override the WnsProc-Sub and google only helps with C++/C# and not with Visual Basic.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 27, 2011 Jun 27, 2011

Copy link to clipboard

Copied

I'm following up to determine if Adobe or anyone else developed a fix for this AccessViolationException fatal condition when pressing the TAB key in Acrobat.

I have confirmed that the fatal bug exists in Acrobat 10.1.0, Microsoft Visual Studio 2010, and Microsoft .NET 4, on Windows Server 2008 R2 all current updates for all products.

Up until now, my applications with  Acrobat Reader in .NET have been Touch Screen oriented, so the users were unlikely to press the TAB key.

This fatal bug is now a show stopper for moving my application to the desktop where there is a TAB key on the keyboard.

Let's please fix this fatal bug in Acrobat Reader or develop a solid work around that permits the TAB key to co-exist with Acrobat Reader and Microsoft .NET Framework.

Arnold

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 06, 2011 Jul 06, 2011

Copy link to clipboard

Copied

Hi,

can anybody explain how to do this in this code-snippets I got from the page vb-power.net?

Imports System.ComponentModel

Public Enum PDFLayoutMode
   DontCare             ' Layout laut Dokumentvorgabe
   SinglePage           ' einzelne Seite
   OneColumn            ' fortlaufende Seite
   TwoColumnLeft        ' fortlaufende Doppelseiten , ungerade Seiten links
   TwoColumnRight       ' fortlaufende Doppelseiten , ungerade Seiten rechts
End Enum

Public Enum PDFPageMode
   none                 ' Default-Ansicht
   bookmarks            ' Ansicht Lesezeichen
   thumbs               ' Ansicht Miniaturansicht
End Enum

Public Enum PDFViewMode
   Fit                  ' Komplette Seite passt vollständig ins bereitgestellte Objekt
   FitV                 ' Seitenhöhe (Vertikale) passt vollständig ins Objekt
   FitH                 ' Seitenbreite (Horizontale) passt vollständig ins Objekt
   FitB                 ' Dokumentrahmen ("Bounding Box") passt vollständig ins Objekt
   FitBV                ' Dokumentrahmenhöhe (Vertikale) passt vollständig ins Objekt
   FITBH                ' Dokumentrahmenbreite (Horizontale) passt vollständig ins Objekt
End Enum



Public Class PDFView
   Inherits UserControl

   Private m_PDFHost As PDFHost
   Private m_isInitialized As Boolean = False
   Private m_ShowToolBar As Boolean = True
   Private m_ShowScrollBars As Boolean = True
   Private m_LayoutMode As PDFLayoutMode = PDFLayoutMode.DontCare
   Private m_PageMode As PDFPageMode = PDFPageMode.none
   Private m_ViewMode As PDFViewMode = PDFViewMode.Fit


#Region "Host Helper Class"
   ''' <summary>
   ''' Helper Class
   ''' </summary>
   ''' <remarks>
   ''' Diese private Klasse hostet das Acrobat ActiveX Control,
   ''' so dass es in das UserControl eingefügt werden kann.
   ''' </remarks>
   Private Class PDFHost
      Inherits AxHost

      ''' <summary>
      ''' Initialisiert den Host
      ''' </summary>
      Public Sub New(ByVal sCLSID As String)
         MyBase.New(sCLSID)
      End Sub

      ''' <summary>
      ''' Gibt ein Objekt-Verweis auf das ActiveX Control zurück
      ''' </summary>
      Public ReadOnly Property Viewer() As Object
         Get
            Try
               Return Me.GetOcx
            Catch ex As Exception
               Return Nothing
            End Try
         End Get
      End Property

      ''' <summary>
      ''' Gibt sämtliche von der Componente verwendeten Ressourcen frei.
      ''' </summary>
      Protected Overrides Sub Dispose(ByVal disposing As Boolean)
         If Me.Viewer IsNot Nothing Then
            Me.Viewer.Dipose()
         End If
         MyBase.Dispose(disposing)
      End Sub
   End Class
#End Region


#Region "Initialisierungen"
   ''' <summary>
   ''' Initialisiert das UserControl
   ''' </summary>
   Public Sub New()
      MyBase.New()
      Me.InitializeComponent()
   End Sub

   Protected Overrides Sub Dispose(ByVal disposing As Boolean)
      If m_isInitialized Then
         m_PDFHost.Dispose()
      End If
      MyBase.Dispose(disposing)
   End Sub

   ''' <summary>
   ''' Initialisiert die Komponente.
   ''' </summary>
   ''' <remarks>
   ''' Ãœber Late Binding wird versucht, eine Instanz des Acrobat Readers
   ''' zu erzeugen. Auf dem Zielsystem muss der Reader in der Version 7
   ''' oder höher installiert sein. Ist dies nicht der Fall, wird eine
   ''' Fehlermeldung ausgegeben.
   ''' </remarks>
   Private Sub InitializeComponent()
      Dim t As Type = Type.GetTypeFromProgID("AcroPDF.PDF")
      If t IsNot Nothing Then
         m_PDFHost = New PDFHost(t.GUID.ToString)
         DirectCast((m_PDFHost), ISupportInitialize).BeginInit()
         SuspendLayout()
         m_PDFHost.TabIndex = 0
         m_PDFHost.Visible = True
         m_PDFHost.Name = "PDFHost"
         m_PDFHost.Dock = DockStyle.Fill
         Controls.Add(m_PDFHost)
         DirectCast((m_PDFHost), ISupportInitialize).EndInit()
         ResumeLayout(False)
         PerformLayout()
         m_isInitialized = True
      Else
         m_isInitialized = False
         MessageBox.Show("Der Acrobat Reader Version 7 oder höher konnte nicht initialisiert werden." _
            & vbCrLf & "Bitte installieren Sie den Acrobat Reader in der Version 7 oder höher." _
            , "Ãœberprüfung Acrobat Reader", MessageBoxButtons.OK, MessageBoxIcon.Error)
      End If
   End Sub
#End Region


#Region "Properties"
   ''' <summary>
   ''' Die Eigenschaft liefert True zurück, wenn der Acrobat Reader
   ''' initialisiert wurde, anderenfalls False.
   ''' </summary>
   <Browsable(False)> _
   Public ReadOnly Property isInitialized() As Boolean
      Get
         Return m_isInitialized
      End Get
   End Property

   ''' <summary>
   ''' Legt den Layout Modus für das PDF-Dokument fest, oder liest diese aus.
   ''' </summary>
   <Description("Legt den Layout Modus für das PDF-Dokument fest, oder liest diese aus."), _
   Category("Darstellung"), _
   DefaultValue(GetType(PDFLayoutMode), "DontCare")> _
   Public Property LayoutMode() As PDFLayoutMode
      Get
         Return m_LayoutMode
      End Get
      Set(ByVal value As PDFLayoutMode)
         m_LayoutMode = value
         Try
            m_PDFHost.Viewer.setLayoutMode(m_LayoutMode.ToString)
         Catch ex As Exception
            Throw ex
         End Try
      End Set
   End Property

   ''' <summary>
   ''' Legt den Modus für die Seitendarstellung fest,oder liest diese aus.
   ''' </summary>
   <Description("Legt den Modus für die Seitendarstellung fest,oder liest diese aus."), _
   Category("Darstellung"), _
   DefaultValue(GetType(PDFPageMode), "none")> _
   Public Property PageMode() As PDFPageMode
      Get
         Return m_PageMode
      End Get
      Set(ByVal value As PDFPageMode)
         m_PageMode = value
         Try
            m_PDFHost.Viewer.setPageMode(m_PageMode.ToString)
         Catch ex As Exception
            Throw ex
         End Try
      End Set
   End Property

   ''' <summary>
   ''' Bestimmt, ob die ToolBar angezeigt werden soll.
   ''' </summary>
   <Description("Bestimmt, ob die ToolBar angezeigt werden soll."), _
   Category("Layout"), _
   DefaultValue(True)> _
   Public Property ShowToolBar() As Boolean
      Get
         Return m_ShowToolBar
      End Get
      Set(ByVal value As Boolean)
         m_ShowToolBar = value
         Try
            m_PDFHost.Viewer.setShowToolbar(value)
         Catch ex As Exception
            Throw ex
         End Try
      End Set
   End Property

   ''' <summary>
   ''' Bestimmt, ob die ScrollBars angezeigt werden sollen.
   ''' </summary>
   <Description("Bestimmt, ob die ScrollBars angezeigt werden sollen."), _
   Category("Layout"), _
   DefaultValue(True)> _
   Public Property ShowScrollBars() As Boolean
      Get
         Return m_ShowScrollBars
      End Get
      Set(ByVal value As Boolean)
         m_ShowScrollBars = value
         Try
            m_PDFHost.Viewer.setShowScrollbars(value)
         Catch ex As Exception
            Throw ex
         End Try
      End Set
   End Property

   ''' <summary>
   ''' Legt den Modus für die Seiteneinpassung fest, oder liest diese aus.
   ''' </summary>
   <Description("Legt den Modus für die Seiteneinpassung fest, oder liest diese aus."), _
   Category("Darstellung"), _
   DefaultValue(GetType(PDFViewMode), "Fit")> _
   Public Property ViewMode() As PDFViewMode
      Get
         Return m_ViewMode
      End Get
      Set(ByVal value As PDFViewMode)
         m_ViewMode = value
         Try
            m_PDFHost.Viewer.setView(m_ViewMode.ToString)
         Catch ex As Exception
            Throw ex
         End Try
      End Set
   End Property
#End Region


#Region "Methoden"
   ''' <summary>
   ''' Geht im Undo-Buffer zur vorherigen Ansicht.
   ''' </summary>
   Public Sub GoBackward()
      Try
         m_PDFHost.Viewer.GoBackwardStack()
      Catch ex As Exception
         Throw ex
      End Try
   End Sub

   Public Sub GoForward()
      Try
         m_PDFHost.Viewer.GoForwardStack()
      Catch ex As Exception
         Throw ex
      End Try
   End Sub

   Public Sub GotoPage(ByVal PageNumber As Integer)
      Try
         m_PDFHost.Viewer.setCurrentPage(PageNumber)
      Catch ex As Exception
         Throw ex
      End Try
   End Sub

   Public Sub GotoFirstPage()
      Try
         m_PDFHost.Viewer.GotoFirstPage()
      Catch ex As Exception
         Throw ex
      End Try
   End Sub

   Public Sub GotoLastPage()
      Try
         m_PDFHost.Viewer.GotoLastPage()
      Catch ex As Exception
         Throw ex
      End Try
   End Sub

   Public Sub GotoNextPage()
      Try
         m_PDFHost.Viewer.GotoNextPage()
      Catch ex As Exception
         Throw ex
      End Try
   End Sub

   Public Sub GotoPreviousPage()
      Try
         m_PDFHost.Viewer.GotoPreviousPage()
      Catch ex As Exception
         Throw ex
      End Try
   End Sub

   Public Function LoadFile(ByVal FileName As String) As Boolean
      Try
         Dim b As Boolean = m_PDFHost.Viewer.LoadFile(FileName)
         If b Then
            Me.ShowToolBar = m_ShowToolBar
            Me.ShowScrollBars = m_ShowScrollBars
            Me.LayoutMode = m_LayoutMode
            Me.PageMode = m_PageMode
            Me.ViewMode = m_ViewMode
         End If
         Return b
      Catch ex As Exception
         Throw ex
      End Try
   End Function

   Public Sub PrintWithDialog()
      Try
         m_PDFHost.Viewer.PrintWithDialog()
      Catch ex As Exception
         Throw ex
      End Try
   End Sub

   Public Sub Zoom(ByVal Percent As Single)
      Try
         m_PDFHost.Viewer.setZoom(Percent)
      Catch ex As Exception
         Throw ex
      End Try
   End Sub

#End Region

End Class

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jul 06, 2011 Jul 06, 2011

Copy link to clipboard

Copied

Why not download the Acrobat SDK and read the documentation?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 07, 2011 Jul 07, 2011

Copy link to clipboard

Copied

Irosenth,

I've read the applicable documentation for using the AcroPDF ActiveX control. Am I mistaken that the source code for the ActiveX control is available in the Acrobat SDK, and I can resolve the many issues that it has on my own, distribute it to thousands of users royalty free?

Also, I don't quite understand the reasons for your passive-aggressive comment. Why not just fix the problem in your ActiveX control? It's been almost three major revisions since these issues have been reported.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jul 07, 2011 Jul 07, 2011

Copy link to clipboard

Copied

There is no source code for the ActiveX control available.

The ActiveX is only a "wrapper" around Reader and/or Acrobat - it does

NOTHING w/o one of those installed on the user's computer.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 07, 2011 Jul 07, 2011

Copy link to clipboard

Copied

Irosenth,

I completely understand that ActiveX controls are wrappers, and simply call API calls offered by the reader. But are you suggesting that I write my own ActiveX control "wrapper" and distribute it to my clients- all to solve two issues? The language that we're using does not allow us to override methods within the ActiveX control like VB.NET or C#, so none of these work-arounds have worked for me.

So rather than relying on work-arounds for the past few years, I just want to know, when will these bugs finally be fixed by Adobe? I have a few users that close (and dispose) the control which causes my application to hang, while all of my users can't tab out of the control because it also causes it to hang.

I can't get any support from you, Adobe. I've tried to get support contracts, and you've refused- multiple times- to support Adobe Reader's ActiveX control. Regardless, it is distributed with either business package, Reader, Acrobat, etc., so it's hard for me get anything reliable from you when you simple say you don't support Reader, or when I then submit a ticket and it gets closed without any response. I open another ticket and the same ensues.

When can these things be fixed?

- Dustin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 27, 2011 Jul 27, 2011

Copy link to clipboard

Copied

Thankyou all for sharing your experience.

I've been able to fix the application hang by mixing the vb code provided by VMBLaOs with c# code provided by AccessViolationException.

You can compile and use your own PDFView class (Translated in english ) adding this code to your application.

Imports System.ComponentModel

Public Enum PDFLayoutMode
    DontCare             ' Layout according to the document specification
    SinglePage           ' Single page
    OneColumn            ' Continuous page
    TwoColumnLeft        ' Continuous double pages, odd pages left
    TwoColumnRight       ' Continuous double pages, odd pages right
End Enum

Public Enum PDFPageMode
    none                 ' Default view
    bookmarks            ' View bookmarks
    thumbs               ' View thumbs
End Enum

Public Enum PDFViewMode
    Fit                  ' Entire page fits completely into the provided object
    FitV                 ' Page height (vertical) fits completely into the object
    FitH                 ' Page width (horizontal) fits completely into the object
    FitB                 ' Document frame ("bounding box") fits completely into the object
    FitBV                ' Document frame height (vertical) fits completely into the object
    FITBH                ' Document frame width (horizontal) fits completely into the object
End Enum

Public Class PDFView
    Inherits UserControl
    Implements IMessageFilter

    Private m_PDFHost As PDFHost
    Private m_isInitialized As Boolean = False
    Private m_ShowToolBar As Boolean = True
    Private m_ShowScrollBars As Boolean = True
    Private m_LayoutMode As PDFLayoutMode = PDFLayoutMode.DontCare
    Private m_PageMode As PDFPageMode = PDFPageMode.none
    Private m_ViewMode As PDFViewMode = PDFViewMode.Fit


#Region " Host Helper Class "
    ''' <summary>
    ''' Helper Class
    ''' </summary>
    ''' <remarks>
    ''' This private class hosts the Acrobat ActiveX control so that it can be inserted into the UserControl.
    ''' </remarks>
    Private Class PDFHost
        Inherits AxHost

        ''' <summary>
        ''' Initializes the host
        ''' </summary>
        Public Sub New(ByVal sCLSID As String)
            MyBase.New(sCLSID)
        End Sub

        ''' <summary>
        ''' Returns an object reference to the ActiveX control
        ''' </summary>
        Public ReadOnly Property Viewer() As Object
            Get
                Try
                    Return Me.GetOcx
                Catch ex As Exception
                    Return Nothing
                End Try
            End Get
        End Property

        ''' <summary>
        ''' Releases all resources used by the component
        ''' </summary>
        Protected Overrides Sub Dispose(ByVal disposing As Boolean)
            If Me.Viewer IsNot Nothing Then
                Me.Viewer.Dipose()
            End If
            MyBase.Dispose(disposing)
        End Sub

    End Class
#End Region


#Region " Initialization "
    ''' <summary>
    ''' Initializes UserControl
    ''' </summary>
    Public Sub New()
        MyBase.New()
        Me.InitializeComponent()
        Application.AddMessageFilter(Me)
    End Sub

    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If m_isInitialized Then
            m_PDFHost.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

    ''' <summary>
    ''' Initialize components.
    ''' </summary>
    ''' <remarks>
    ''' Late binding is trying to create an instance of the Acrobat Reader. On the target system must the reader version 7 or later be installed. If this is not the case, an error message will be shown.
    ''' </remarks>
    Private Sub InitializeComponent()
        Dim t As Type = Type.GetTypeFromProgID("AcroPDF.PDF")
        If t IsNot Nothing Then
            m_PDFHost = New PDFHost(t.GUID.ToString)
            DirectCast((m_PDFHost), ISupportInitialize).BeginInit()
            SuspendLayout()
            m_PDFHost.TabIndex = 0
            m_PDFHost.Visible = True
            m_PDFHost.Name = "PDFHost"
            m_PDFHost.Dock = DockStyle.Fill
            Controls.Add(m_PDFHost)
            DirectCast((m_PDFHost), ISupportInitialize).EndInit()
            ResumeLayout(False)
            PerformLayout()
            m_isInitialized = True
        Else
            m_isInitialized = False
            MessageBox.Show("The Acrobat Reader version 7 or higher could not be initialized." _
               & vbCrLf & "Please install Acrobat Reader version 7 or higher." _
               , "Initializiation of Acrobat Reader component", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub
#End Region


#Region " Properties "
    ''' <summary>
    ''' Property returns the Acrobat Reader initialization state.
    ''' </summary>
    <Browsable(False)> _
    Public ReadOnly Property isInitialized() As Boolean
        Get
            Return m_isInitialized
        End Get
    End Property

    ''' <summary>
    ''' Gets or sets the layout mode for the PDF document.
    ''' </summary>
    <Description("Gets or sets the layout mode for the PDF document."), _
    Category("Layout"), _
    DefaultValue(GetType(PDFLayoutMode), "DontCare")> _
    Public Property LayoutMode() As PDFLayoutMode
        Get
            Return m_LayoutMode
        End Get
        Set(ByVal value As PDFLayoutMode)
            m_LayoutMode = value
            Try
                m_PDFHost.Viewer.setLayoutMode(m_LayoutMode.ToString)
            Catch ex As Exception
                Throw ex
            End Try
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets the mode for the page view.
    ''' </summary>
    <Description("Gets or sets the mode for the page view."), _
    Category("Layout"), _
    DefaultValue(GetType(PDFPageMode), "none")> _
    Public Property PageMode() As PDFPageMode
        Get
            Return m_PageMode
        End Get
        Set(ByVal value As PDFPageMode)
            m_PageMode = value
            Try
                m_PDFHost.Viewer.setPageMode(m_PageMode.ToString)
            Catch ex As Exception
                Throw ex
            End Try
        End Set
    End Property

    ''' <summary>
    ''' Determines whether the toolbar should appear.
    ''' </summary>
    <Description("Determines whether the toolbar should appear."), _
    Category("Layout"), _
    DefaultValue(True)> _
    Public Property ShowToolBar() As Boolean
        Get
            Return m_ShowToolBar
        End Get
        Set(ByVal value As Boolean)
            m_ShowToolBar = value
            Try
                m_PDFHost.Viewer.setShowToolbar(value)
            Catch ex As Exception
                Throw ex
            End Try
        End Set
    End Property

    ''' <summary>
    ''' Determines whether to display the ScrollBars.
    ''' </summary>
    <Description("Determines whether to display the ScrollBars."), _
    Category("Layout"), _
    DefaultValue(True)> _
    Public Property ShowScrollBars() As Boolean
        Get
            Return m_ShowScrollBars
        End Get
        Set(ByVal value As Boolean)
            m_ShowScrollBars = value
            Try
                m_PDFHost.Viewer.setShowScrollbars(value)
            Catch ex As Exception
                Throw ex
            End Try
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets the mode for the page fit.
    ''' </summary>
    <Description("Gets or sets the mode for the page fit."), _
    Category("Layout"), _
    DefaultValue(GetType(PDFViewMode), "Fit")> _
    Public Property ViewMode() As PDFViewMode
        Get
            Return m_ViewMode
        End Get
        Set(ByVal value As PDFViewMode)
            m_ViewMode = value
            Try
                m_PDFHost.Viewer.setView(m_ViewMode.ToString)
            Catch ex As Exception
                Throw ex
            End Try
        End Set
    End Property
#End Region


#Region " Methods "

    Public Sub GoBackward()
        Try
            m_PDFHost.Viewer.GoBackwardStack()
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub GoForward()
        Try
            m_PDFHost.Viewer.GoForwardStack()
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub GotoPage(ByVal PageNumber As Integer)
        Try
            m_PDFHost.Viewer.setCurrentPage(PageNumber)
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub GotoFirstPage()
        Try
            m_PDFHost.Viewer.GotoFirstPage()
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub GotoLastPage()
        Try
            m_PDFHost.Viewer.GotoLastPage()
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub GotoNextPage()
        Try
            m_PDFHost.Viewer.GotoNextPage()
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub GotoPreviousPage()
        Try
            m_PDFHost.Viewer.GotoPreviousPage()
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Function LoadFile(ByVal FileName As String) As Boolean
        Try
            Dim b As Boolean = m_PDFHost.Viewer.LoadFile(FileName)
            If b Then
                Me.ShowToolBar = m_ShowToolBar
                Me.ShowScrollBars = m_ShowScrollBars
                Me.LayoutMode = m_LayoutMode
                Me.PageMode = m_PageMode
                Me.ViewMode = m_ViewMode
            End If
            Return b
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Sub PrintWithDialog()
        Try
            m_PDFHost.Viewer.PrintWithDialog()
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub Zoom(ByVal Percent As Single)
        Try
            m_PDFHost.Viewer.setZoom(Percent)
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

#End Region

    Public Function PreFilterMessage(ByRef m As System.Windows.Forms.Message) As Boolean Implements System.Windows.Forms.IMessageFilter.PreFilterMessage
        'Block the internal Adobe's Application Fatal AccessViolationException when pressing the TAB key.
        Dim bFiltered As Boolean = True
        'Adobe's Application Message
        Const WM_ACROBAT_1450 As Integer = 5200 '0x1450
        'Apply the filter
        If m.Msg = WM_ACROBAT_1450 Then
            'Block this message or it will trigger a fatal AccessViolationException when the TAB key is pressed
            bFiltered = True
        Else
            'Other messages can pass through the filter
            bFiltered = False
        End If
        Return bFiltered
    End Function
End Class

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 28, 2011 Jul 28, 2011

Copy link to clipboard

Copied

Works great.

Many thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 01, 2011 Aug 01, 2011

Copy link to clipboard

Copied

Look for "Dipose" and replace it with "Dispose" in order to let the viewer dispose.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 10, 2011 Nov 10, 2011

Copy link to clipboard

Copied

I'm working on a legacy vb6 application that experiences the same issue with Reader 10.1.

Has anyone come up with a work around that can be applied in vb6?

Thanks ahead of time.

JT

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 10, 2011 Nov 10, 2011

Copy link to clipboard

Copied

VB6 is not supported with Reader X.

[autoresponse info removed by moderator]

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 10, 2011 Nov 10, 2011

Copy link to clipboard

Copied

And Adobe continues to fail and/or refuse to resolve this issue even for those of us using .NET which IS supposedly supported.

-- Edited to remove email sig.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 22, 2011 Dec 22, 2011

Copy link to clipboard

Copied

Here is a workaround for WPF with .NEt 3.5 and Reader X :

add In "Window_Loaded" :

ComponentDispatcher.ThreadFilterMessage += new ThreadMessageEventHandler(ComponentDispatcher_ThreadFilterMessage);

private void ComponentDispatcher_ThreadFilterMessage(ref MSG msg, ref bool handled)

{

    if (msg.message == 0x1450)

        handled = true;

}

Regards,

H.M

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 07, 2012 Mar 07, 2012

Copy link to clipboard

Copied

Microsoft Web Browser control instead of the Adobe Read Control and  loaded the exact same interface alose tab not use it crashed

[links removed]

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines