S
s.danyal.k
Hi All,
I have made an application that loads an Adobe Acrobat file and shows
it. For this I ve used Adobe ActiveX
Control available in C#. Heres a sample code. I am adding the control
programmitically and NOT through the
designer.
private AxAcroPDFLib.AxAcroPDF axAcroPDF1;
private void InitializeAdobe()
{
try
{
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(Form1));
this.axAcroPDF1 = new AxAcroPDFLib.AxAcroPDF ();
((System.ComponentModel.ISupportInitialize)(this.axAcroPDF1)).BeginInit();
this.axAcroPDF1.Enabled = true;
this.axAcroPDF1.Location = new System.Drawing.Point(84,
38);
this.axAcroPDF1.Name = "axPdf1";
this.axAcroPDF1.OcxState =
((System.Windows.Forms.AxHost.State)(resources.GetObject("axAcroPDF1.OcxState")));
this.axAcroPDF1.Size = new System.Drawing.Size(854,
470);
this.axAcroPDF1.TabIndex = 0;
this.Controls.Add(this.axAcroPDF1);
((System.ComponentModel.ISupportInitialize)(this.axAcroPDF1)).EndInit();
axAcroPDF1.LoadFile ("C:\\Test.pdf");
axAcroPDF1.Show ();
}
catch (Exception ex)
{
Console.WriteLine (ex.ToString ());
}
}
This codes works fine. This sample is written using Adobe ActiveX
Control 7.0. Now the problem is that i cant
run this application is Adobe Acorbat 6.0 is installed and NOT Adobe
7.0. In other words i m facing
compatibility issues. Same is the case if I make the application using
Adobe ActiveX Control 6.0 and then run
it when Adobe 7.0 is installed.
Is there any way I can make it 'generic'. Client may have 6.0 or 7.0 or
any other version installed. I want my
application to work in all circumstances......or atleast in both 6.0
and 7.0. I ve searched for and havent
found anything solid. There are similar questions regarding this
problem but none of them have been answered.
I ve tried something else also :
Guid guid = new Guid
("{ca8a9780-280d-11cf-a24d-444553540000}");
Type myType =Type.GetTypeFromCLSID(guid, true);
Object o = Activator.CreateInstance (myType);
BUT now i cant do anything further. The object returned is of type
'System.__ComObject'. I guess if ANY COM
object is used it will always return this. I ve tried casting the
object to the appropriate library but it
throws exception (invalid cast).
is there anyway that an application built in any version work with all
other versions OR atleast if an
application uses the latest Adobe it would run on earlier ones too.
ANY idea regarding this issue is most welcome.
Thanks
Danyal
I have made an application that loads an Adobe Acrobat file and shows
it. For this I ve used Adobe ActiveX
Control available in C#. Heres a sample code. I am adding the control
programmitically and NOT through the
designer.
private AxAcroPDFLib.AxAcroPDF axAcroPDF1;
private void InitializeAdobe()
{
try
{
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(Form1));
this.axAcroPDF1 = new AxAcroPDFLib.AxAcroPDF ();
((System.ComponentModel.ISupportInitialize)(this.axAcroPDF1)).BeginInit();
this.axAcroPDF1.Enabled = true;
this.axAcroPDF1.Location = new System.Drawing.Point(84,
38);
this.axAcroPDF1.Name = "axPdf1";
this.axAcroPDF1.OcxState =
((System.Windows.Forms.AxHost.State)(resources.GetObject("axAcroPDF1.OcxState")));
this.axAcroPDF1.Size = new System.Drawing.Size(854,
470);
this.axAcroPDF1.TabIndex = 0;
this.Controls.Add(this.axAcroPDF1);
((System.ComponentModel.ISupportInitialize)(this.axAcroPDF1)).EndInit();
axAcroPDF1.LoadFile ("C:\\Test.pdf");
axAcroPDF1.Show ();
}
catch (Exception ex)
{
Console.WriteLine (ex.ToString ());
}
}
This codes works fine. This sample is written using Adobe ActiveX
Control 7.0. Now the problem is that i cant
run this application is Adobe Acorbat 6.0 is installed and NOT Adobe
7.0. In other words i m facing
compatibility issues. Same is the case if I make the application using
Adobe ActiveX Control 6.0 and then run
it when Adobe 7.0 is installed.
Is there any way I can make it 'generic'. Client may have 6.0 or 7.0 or
any other version installed. I want my
application to work in all circumstances......or atleast in both 6.0
and 7.0. I ve searched for and havent
found anything solid. There are similar questions regarding this
problem but none of them have been answered.
I ve tried something else also :
Guid guid = new Guid
("{ca8a9780-280d-11cf-a24d-444553540000}");
Type myType =Type.GetTypeFromCLSID(guid, true);
Object o = Activator.CreateInstance (myType);
BUT now i cant do anything further. The object returned is of type
'System.__ComObject'. I guess if ANY COM
object is used it will always return this. I ve tried casting the
object to the appropriate library but it
throws exception (invalid cast).
is there anyway that an application built in any version work with all
other versions OR atleast if an
application uses the latest Adobe it would run on earlier ones too.
ANY idea regarding this issue is most welcome.
Thanks
Danyal