11 Replies Latest reply on Sep 21, 2011 11:58 AM by cwarren1221

    AxAcroPDF throws unhandled exception on click of TAB

      Hi,

      I am using Acrobat SDK 9.0 for viewing pdf files in windows forms (C#). I have viewer control on my form and I load the pdf file with a call to method AxAcroPDF.LoadFile( strFilename );

      File loads into the viewer in the form and just after the load if I click TAB, I get the below error and application just closes:

      "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

      Please suggest any thing about this error.

      Thanks,
      Ravi.
        • 1. Re: AxAcroPDF throws unhandled exception on click of TAB
          ekb0211 Level 1

          Hi, I am getting the same error under the same circumstances (C# WinForms app, SDK 9.0) - and it occurs at the same time.  If I load the file using AxAcroPDF.LoadFile( strFilename ), and then hit Tab, I get "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."   I had the same problem using 8.0.

           

          Have you been able to come up with a solution?  Any help would be appreciated!  Thanks!

          • 2. Re: AxAcroPDF throws unhandled exception on click of TAB
            ekb0211 Level 1

            Is anyone else having this problem when tabbing on the reader? It's giving me a lot of grief and I would really appreciate any help.

             

            Also, I just wanted to correct myself from my previous post...I am not using the SDK, I'm just using the activex control that comes with Adobe Reader, and making a reference to it in my .NET WinForms project (VS 2008).  After I load a pdf using a call to AxAcroPDF.LoadFile( strFilename ), and then hit tab to the control, I get the following error:  "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

             

            Please help!  Thanks!

            • 3. Re: AxAcroPDF throws unhandled exception on click of TAB
              ekb0211 Level 1

              Hi, it's me again....

               

              I still haven't figured out this problem, but I do have one more tiny piece of information, in hopes that someone knowledgable will see this and be able to help.

               

              The error seems to be thrown when you're tabbing OUT of the pdf viewer.  Previously, I was under the impression that the problem was when I tabbed TO the viewer, but I guess I wasn't paying close enough attention.  So, if the pdf viewer currently has the focus, and you hit TAB to give focus to the next control - that is when it throws the error:

               

              "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

              • 4. Re: AxAcroPDF throws unhandled exception on click of TAB
                cjputnam

                Glad to know it's not only me having the issue. We just deployed a new (.NET CLR 2.0 winform) app and have encountered the issue. Our developers had Adobe Reader 8.x on their workstations and did not encounter (nor can they reproduce) the problem. However, it occured(s) when the application runs on machines with 9.x installed. Subsequent updates of the developer machines to Reader 9.x yield the same error.

                 

                We also are having trouble forcing the focus to other controls on the containing form, so by default the PDF ActiveX control has focus and users are naturally using the tab key to navigate away. Curious as to whether there is a way to overrule the default focusing behavior of the ActiveX control or way to intercept the Tab key (LostFocus?).

                 

                Also, I tried adding an OnError handler as exposed by the ActiveX control, but the UnhandledException bypasses it.

                 

                Lastly, I've not evaulated the SDK - is there anything that could assist?

                • 5. Re: AxAcroPDF throws unhandled exception on click of TAB
                  cjputnam Level 1

                  Here is the underlying error:

                  "Faulting application <myapp>.exe, version <w.x.y.z>, faulting module acropdf.dll, version 9.1.0.163, fault address 0x0000486c".

                   

                  Since yesterday's post, I've tried wrapping the Adobe ActiveX control with a custom (VB 6) OCX wrapper to try and intercept the exception. However, there seems to be no event or generic error trapping event that works. And, the same error does occur in a traditional COM DLL vs. the .NET InterOp reference.

                   

                  I look forward to someone from Adobe weighing in on this one.

                  • 6. Re: AxAcroPDF throws unhandled exception on click of TAB
                    M_O_W Level 1

                    Hello.

                    I just want to say that I have the same problem.

                     

                    Our product is a Winforms application based on Dot.Net 3.5. Our development happend on machines with Adobe Reader 8.0. But our customer uses Reader 9.0 on the target platforms. They don't allow a downgrade because of the security issues with Windows XP machines. Our alternative, displaying the PDF files in a webbrowser element, isn't acceptable because the used PDFs show the bookmark tab which the customer doesn't want to see. Our attempt to use a HTML page with the embedded activeX PDF Viewer element, so that we can change the view option in javascript, failed because of the "Access denied" error described elsewhere in this forum.

                     

                    In addition to the error when using tab I receive it when I close my application, too (When I start the application executable directly).

                     

                    I hope that Adobe will take care of this, or my company is forced to look for PDF Viewer components from other companys.

                    • 7. Re: AxAcroPDF throws unhandled exception on click of TAB
                      Sjoerd66

                      I also have found this problem and even build a small vb6 application which demonstrates it. But my application tabs to the Adobe control and then crashes.

                      See my original thread for the program before I was directed to this thread:

                      http://forums.adobe.com/message/3344385

                      • 8. Re: AxAcroPDF throws unhandled exception on click of TAB
                        Quesnt Level 1

                        Has anyone been able to get around this by disabling the tab key or something while the AcroPDF control has focus? There HAS to be a way around this...

                        • 9. Re: AxAcroPDF throws unhandled exception on click of TAB
                          5SC_Eboda

                          I am busy with a windows forms app that allows me to select a pdf from a list and have it shown as a preview using AxAcroPDF. I had the same error when "tabbing" through the app. Only thing that helped me was to set TabStop = False in the properties. The error occurs when "tabbing" away from AxAcroPDF. This setting makes sure that your pdf does not get focused when "tabbing" through the system.

                          • 10. Re: AxAcroPDF throws unhandled exception on click of TAB
                            cjputnam Level 1

                            In our applications, the users are often zooming in/out, using bookmarks and paging through the PDF using the toolbar embedded in the ActiveX control. So they need to put focus on the control to do this.

                             

                            BTW: I have checked Adobe Reader X (they appear to have updated the ActiveX control), but the Tab problem still occurs. Adobe needs to fix this.

                            • 11. Re: AxAcroPDF throws unhandled exception on click of TAB
                              cwarren1221

                              I had the same problem in my application but I found the following workaround:

                               

                              Application.EnableVisualStyles();

                              Application.SetCompatibleTextRenderingDefault(false);

                              Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

                              Application.ThreadException += delegate(object sender, ThreadExceptionEventArgs e)

                                          {

                                              if (e.Exception.GetType() == typeof(AccessViolationException))

                                              {

                                                  // Ignore this type of exception to fix the bug in the Adobe

                                                  // Reader ActiveX (i.e. TAB out of the control).

                                              }

                                              else

                                              {

                                                  // Add the original callstack of the exception data because

                                                  // it will be overrided when the exception is re-thrown.

                                                  e.Exception.Data.Add("OriginalCallStack", e.Exception.StackTrace);

                                                  throw e.Exception;

                                              }

                                          };

                              Application.Run(new MyFormThatIncludeAnAdobeActiveX());

                               

                              This will make the exception disappear but it will also lock the TAB cycle inside the control. The user won't be able to "TAB out" of the control.

                               

                              For my application, I didn't really mind if the user was 'locked in' but I assume that something could be done in the delegate to set the focus to the next control in the form, if needed.