Copy link to clipboard
Copied
why do we need AxInterop.AcroPDFLib.dll to create an adobe reader instance from a .net application, even though the machine has adobe reader installed in it.
Copy link to clipboard
Copied
I'm sorry, I don't understand this question at all. Especially the point about Reader being already installed.
Perhaps we could try these questions as well as any background you might be able to give.
What are your aims?
What is it that you expect to be able to do?
What is it that you have to do?
Copy link to clipboard
Copied
I have a .net application. I have installed adobe reader in my system. In my .net application, I have written code to use adobe reader to display certain content. But when I run the application I failed to display the content in the adobe reader, and it showed the following error.
System.IO.FileNotFoundException: Could not load file or assembly 'AxInterop.AcroPDFLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Das System kann die angegebene Datei nicht finden.
File name: 'AxInterop.AcroPDFLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
When I downloaded AxInterop.AcroPDFLib.dll and copied it to my application folder the problem was solved.
But my question is: what is the significance of AxInterop.AcroPDFLib? Why do we need it to use adobe reader from a .net application?
Copy link to clipboard
Copied
Where exactly did you download AxInterop.AcroPDFLib.dll?
Copy link to clipboard
Copied
Sorry, not exactly downloaded.
Let me describe the scenario more descriptively.
I have a .net application (.net version 4). I had a requirement to display certain files in pdf format. In order to add reference, in Visual studio I selected the specific project and then from tool box -> General -> Choose Items -> Com components -> Adobe PDF reader was selected.
Then the following two dlls were automatically referenced.
1. AxInterop.AcroPDFLib.dll
2. Interop.AcroPDFLib.dll
This action automatically generated the following code:
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PdfViewer));
this.acrobatViewer = new AxAcroPDFLib.AxAcroPDF();
((System.ComponentModel.ISupportInitialize)(this.acrobatViewer)).BeginInit();
this.SuspendLayout();
//
// acrobatViewer
//
this.acrobatViewer.Dock = System.Windows.Forms.DockStyle.Fill;
this.acrobatViewer.Enabled = true;
this.acrobatViewer.Location = new System.Drawing.Point(0, 0);
this.acrobatViewer.Name = "acrobatViewer";
this.acrobatViewer.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("acrobatViewer.OcxState")));
this.acrobatViewer.Size = new System.Drawing.Size(150, 150);
this.acrobatViewer.TabIndex = 0;
//
// PdfViewer
//
this.BackColor = System.Drawing.Color.Transparent;
this.Controls.Add(this.acrobatViewer);
this.Name = "PdfViewer";
((System.ComponentModel.ISupportInitialize)(this.acrobatViewer)).EndInit();
this.ResumeLayout(false);
}
#endregion
private AxAcroPDFLib.AxAcroPDF acrobatViewer;
And then I was able to load a pdf file in my application.
But when this application was run in a different machine the previously mentioned exception was thrown. When I manually copy AxInterop.AcroPDFLib.dll into the application folder in that machine the problem is solved.
But I wanted to know the therotical concept behind this; the puropse of AxInterop.AcroPDFLib.dll.
Copy link to clipboard
Copied
I think that AXInterop files are like Interop files, generated automatically by your development environment, and intended to be deployed with the product. There is information on Interop files, and how to avoid generating them, here http://msdn.microsoft.com/en-us/library/tc0204w0(v=vs.110).aspx which may be applicable.
Copy link to clipboard
Copied
Thank you very much for your valid inputs.
Infact we would like to avoid generating the interop files. We went through the suggested link
http://msdn.microsoft.com/en-us/library/tc0204w0(v=vs.110).aspx
and we tried to embed the interop dll, the following error was shown.
Error 2 Cannot embed interop types from assembly 'd:\svn\project\obj\Debug\AxInterop.AcroPDFLib.dll' because it is missing the 'GuidAttribute' attribute D:\svn\project\obj\Debug\AxInterop.AcroPDFLib.dll
Please comment
Copy link to clipboard
Copied
All I know about this subject I found out yesterday with Google. I recommend you find a .NET development forum.
Copy link to clipboard
Copied
The reason it did not run on a foreign PC is because you did not or might not have added it as a repository. In visual studio you add this by going to Project->Properties(of the application/solution)->Publish->application files-> change the acrobat dll to include and it should work on other systems.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more