0

I'm developing an ASP.net web api (.NET Framework) and use "Microsoft Office Document Imaging" v12. On my local system, it works fine. But then I pushed it on my azure web app and I got following error:

Could not load file or assembly 'Interop.MODI, Version=12.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

I'm sure, I have to install "Microsoft Office Document Imaging". But how can I do this when I'm just using an Azure Web App?


EDIT: I found a much better way to solve my problem: https://azure.microsoft.com/de-de/services/cognitive-services/computer-vision/

everydayXpert
  • 785
  • 2
  • 11
  • 27

1 Answers1

0

As far as I know, we don't have permission to install the "Microsoft Office Document Imaging"(using sharepoint install package) in the azure web app.

Azure web app env as a sanbox, there are several strict restrictions and limitations, we couldn't use it as azure VM. More details, you could refer to this article.

If you still want to use "Microsoft Office Document Imaging", I suggest you could consider using azure VM which we have full permission to change the env.

Besides,I guess you wan to convert the doc to image. I suggest you could try to use Aspose.Words for .NET to convert the doc to image or PDF.

This package could be installed in the Nuget Package.

More details, you could refer to below test demo codes.

        string location = Server.MapPath("/exe/");
        Document document = new Document(Server.MapPath("/exe/bbbb.docx"));
        ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Png);
        options.PageCount = 1;

        // Save each page of the document as Png.
        for (int i = 0; i < document.PageCount; i++)
        {
            options.PageIndex = i;
            document.Save(string.Format(location+ @"\out_{0}.png", i), options);
        }

Result:

enter image description here

Brando Zhang
  • 22,586
  • 6
  • 37
  • 65
  • Thanks for your answer! I'm using the MODI to extract the words from a document/image.. Is it also possible with Aspose.Words? I saw there is also Aspose.OCR, but it costs too much for my needs.. – everydayXpert Oct 09 '17 at 05:50
  • I suggest you could consider using azure VM. As my above azure web app sandbox [link](https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox#unsupported-frameworks) says, azure web app just support little third party convert tool. So if you used the sadbox not supported tool, you will face the same error. – Brando Zhang Oct 09 '17 at 08:59