logo
down
shadow

Help with debugging COM errors? (.mdi to .pdf file conversions using Microsoft Office Document Imaging)


Help with debugging COM errors? (.mdi to .pdf file conversions using Microsoft Office Document Imaging)

By : user3853776
Date : October 28 2020, 04:55 PM
This might help you There's something interesting here about closing the COMObject after its use or something like that. This might perhaps help, I hope it does.
COMException 0x80010105 Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))
code :


Share : facebook icon twitter icon
How to OCR serially with MODI (Microsoft Office Document Imaging) in C#

How to OCR serially with MODI (Microsoft Office Document Imaging) in C#


By : Esmeray Youth
Date : March 29 2020, 07:55 AM
around this issue Here is the fully working code! thanks to @Ramhound
Below code just specifies a folder full of pictures and one by one does OCR scan on them.
code :
    /// <summary>
    /// Gets all images inside a Folder
    /// and triggers OCR on each..
    /// </summary>
    /// <param name="directoryPath"> Path to Folder </param>
    /// <returns> Text </returns>        
    public string CheckFileAndDoOCR(string directoryPath)
    {
        string TheTxt = "";
        IEnumerator files = Directory.GetFiles(directoryPath).GetEnumerator();

        while (files.MoveNext())
        {
            // FileInfo
            FileInfo foo = new FileInfo(Convert.ToString(files.Current));

            // Check for JPG File Format
            if (foo.Extension == ".jpg" || foo.Extension == ".JPG")
            // or // ImageFormat.Jpeg.ToString()
            {
                // Start OCR Procedure
                TheTxt = DoOCR(foo.FullName);
                // Create TXT file next to ImageFile
                string txtFileName = foo.DirectoryName + "\\" + foo.Name.Replace(foo.Extension,"") + ".txt";
                FileStream createFile = new FileStream(txtFileName, FileMode.OpenOrCreate);
                // Save the text in to TXT file
                StreamWriter writeFile = new StreamWriter(createFile);
                writeFile.Write(TheTxt);
                // Close
                writeFile.Close();
                createFile.Close();
            }

            // Delete used pictures (Optional)
            /*--------------------------------------------------------------------*/
            try 
            { foo.Delete(); }
            catch (Exception ex)
            { Logger(LogPath, "| Exception: Source[" + ex.Source + "] Message[" + ex.Message + 
                "] InnerException[" + ex.InnerException + "] StackTrace[" + ex.StackTrace + "] | "); }
            /*--------------------------------------------------------------------*/
        }
        return TheTxt;
    }
    // DoOCR
    // 
    /// <summary>
    /// Start an OCR scan on given ImageFile
    /// </summary>
    /// <param name="FullPath"> Path to ImageFile </param>
    /// <returns> Text </returns>
    public string DoOCR(string FullPath)
    {
        string txt;

        // OCR Operations...
        MODI.Document md = new MODI.Document(); // Create MODI.Document
        md.Create(FullPath); // Fill MODI.Document with my file
        // Showprogress of OCR
        md.OnOCRProgress += new MODI._IDocumentEvents_OnOCRProgressEventHandler(this.ShowProgress);
        // Begin OCR
        md.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, false, false); // OCR();
        // Image from file
        MODI.Image image = (MODI.Image)md.Images[0];
        txt = image.Layout.Text;
        // Optionally you can get only first word by using word.Text
        /// Words from Image :
        // MODI.Word word = image.Layout.Words[0];
        /// Text from first Word :
        // txt = word.Text;

        // Close OCR
        word = null;
        image = null;
        md.Close(false);
        md = null;

        // Finalize
        GC.Collect();
        GC.WaitForPendingFinalizers();

        // Return Text
        return txt;
    }
Getting error on Azure Web App using "Microsoft Office Document Imaging"

Getting error on Azure Web App using "Microsoft Office Document Imaging"


By : James Morris
Date : March 29 2020, 07:55 AM
it helps some times 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.
code :
        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);
        }
Microsoft Office Document Imaging (MODI) for Office 2016

Microsoft Office Document Imaging (MODI) for Office 2016


By : nk58
Date : March 29 2020, 07:55 AM
I wish did fix the issue. According to my search and test, Office2016 has OCR function and you need to turn it on manually.
Please review link below for more details:
Converting a Microsoft Document Imaging (.mdi) file to PDF (or JPG) in ASP.net

Converting a Microsoft Document Imaging (.mdi) file to PDF (or JPG) in ASP.net


By : user3783074
Date : March 29 2020, 07:55 AM
This might help you Since the Microsoft Office Document Imaging (MODI) format contains private extensions to the TIFF format, your best bet is to use the Microsoft Office Document Imaging Object Model:
Using the Microsoft Office Document Imaging 2003 Object Model
I have to work with Microsoft Office Document imaging withMS office 2010 through .Net. How do I do it?

I have to work with Microsoft Office Document imaging withMS office 2010 through .Net. How do I do it?


By : phoenixlay
Date : March 29 2020, 07:55 AM
To fix the issue you can do You need to add a reference to your .net project. When adding a reference, go to the com tab and look for Ms Office Document Imaging Library (MODI) 12.0.
Related Posts Related Posts :
  • How to use Selenium Grid with C#?
  • What is the best way to download files via HTTP using .NET?
  • How to get files from a device using USB
  • Given a user's SID, how do I get their userPrincipalName?
  • NHibernate mapping in Asp.Net using MySql
  • Why do some cookies have a '.' before the domain?
  • C# SqlDataReader = null?
  • InvalidCastException for two Objects of the same type
  • "The parameters dictionary contains a null entry for parameter" - How to fix?
  • Font family name from font file
  • What is the best way to generate KML files in C#?
  • How can I receive mail using .NET?
  • How to send raw data over a network?
  • meaning of '+='
  • Object reference not set to an instance of an object #5
  • C# Create "wireframe"/3D "map"
  • How to change size of database
  • Serialization problem
  • Using unmanaged code from managed code
  • Are there any bindings between .NET and TK
  • error with linq join
  • VB.NET equivalent to C# var keyword
  • Accessing object properties from string representations
  • Inheritance issue
  • C# timer won't tick
  • How to retrieve items from a database c#
  • Sending mail using SmtpClient in .net
  • Tag problem c# listbox
  • How to know if the Form App open or not c#
  • C# XPath id() not working?
  • Load PDF from Memory ASP.Net
  • C# ListView with a ProgressBar
  • Getting the right WPF dispatcher in a thread
  • How to create Pivot table using C#?
  • how to download a file from remote server using asp.net
  • Binding files in C#?
  • Copy one object to another
  • How to post on Google Buzz?
  • Generic <T> how cast?
  • Set global hotkeys using C#
  • Change the key being pressed with C#
  • Uploading Large Files
  • How do I get the duration of a video file using C#?
  • how to create instance for a generic type in c#
  • Drag and drop rectangle in C#
  • RSA Encryption C#
  • Title=
  • What is meant by Web Services?
  • The provided URI scheme 'https' is invalid; expected 'http'. Parameter name: via
  • Check if server exists
  • time interval in c#
  • Extracting a sub-string in C#
  • C# - Programmatically Log-off and Log-on a user
  • c# array vs generic list
  • TCPClient in C# (Error)
  • How can I know if a file has been changed in .NET C#?
  • New to C# and trying to use a global variable
  • Convert RGB color to CMYK?
  • Tesseract.NET in C#
  • Is it possible to Update Sharepoint List Without "ID"?
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk