Using different versions of a DLL in a project

The Aquaforest OCR SDK makes use of two libraries that can cause problems if referenced individually in a project. The two libraries in question are:

  • iTextSharp
  • Log4Net

If your application makes use of any of these 2 libraries in addition to the Aquaforest SDK, you will need some additional configuration to be able to compile it.

For instance, let’s say your application uses the most recent version of iTextSharp and you are also referencing the Aquaforest SDK, which uses an old version of iTextSharp (4.1.6.0). If you try to compile the application you will end with an error as follows:

Error in OCR Processing: Method not found: 'System.Collections.Hashtable iTextSharp.text.pdf.PdfReader.get_Info()'.

To fix this, you will need to do the following:

  1. Rename the new version of itextsharp. In this example, it’s been renamed to “itextsharp_new.dll”.
  2. Add a reference to “itextsharp_new.dll” to your project.
  3. Modify your app.config file as follows:

2

If you cannot rename the new itextsharp DLL, you can do the following:

  1. Add a reference to the new version of the itextsharp.dll to your project.
  2. Set “Copy Local” to False.

3

  1. Create a folder in your bin directory and place the itextsharp.dll in it. In this example, the folder has been renamed to “itextsharp-5.5.8”
  2. Modify your app.config file as follows:

4

You can get the public token of a DLL by running the following command from the Visual Studio command prompt. Note that the arguments are case sensitive.

sn -T <assemblyname>

1

Author

Shrevin Sookun

Software Development Manager

Categories

Archive

Share Post

Related Posts

Autobahn can perform a great many functions. One that is often asked about is PDF/A compliance. In this use case, I will be using…
Explore the capabilities of Searchlight OCR through three videos that demonstrate its seamless integration and transformative capabilities for document management and OCR in SharePoint. …