2 Replies Latest reply on May 2, 2017 3:20 AM by Parthiban.Kumaravel

    AcroPDF throwing exception when used in x64 Application

    Parthiban.Kumaravel

      Hi,

       

      I am facing few issues in rendering PDF document in the 64-bit environment. The same source code is working fine in the 32-bit environment.

       

      Application Build Plat Form Target: x64

      In the project, the below DLL's were referenced

      1. AxInterop.AcroPDFLib

      2. Interop.AcroPDFLib

       

                  this.axAcroPDF1 = new AxAcroPDFLib.AxAcroPDF();

                  ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF1)).BeginInit();

                  this.axAcroPDF1.Dock = System.Windows.Forms.DockStyle.Fill;

                  this.axAcroPDF1.Enabled = true;

                  this.axAcroPDF1.Location = new System.Drawing.Point(0, 0);

                  this.axAcroPDF1.Name = "axAcroPDF1";

                  this.axAcroPDF1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axAcroPDF1.OcxState")));

                  this.axAcroPDF1.Size = new System.Drawing.Size(800, 0);

                  this.axAcroPDF1.TabIndex = 16;

                  ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF1)).EndInit();

       

      While executing the above code exception is thrown at the line

      ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF1)).EndInit();

      Exception Message:

                A first chance exception of type 'System.BadImageFormatException' occurred in System.Windows.Forms.dll

                Additional information: Could not load file or assembly 'Interop.AcroPDFLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.           An attempt was made to load a program with an incorrect format.

       

      Is there any solution to overcome this issue?

       

      Thanks in advance

      Parthiban Kumaravel