Пример #1
0
        /// <summary>
        /// Appends the image.
        /// </summary>
        private void AppendImage()
        {
            try
            {
                if (this.AxViewer.PageNum < 0)
                {
                    this.document.Create(this.imageFileName);
                    this.AxViewer.Document = this.document;
                    this.AxViewer.Refresh();
                }
                else
                {
                    MODI.Document tempDoc = new MODI.Document();
                    tempDoc.Create(this.imageFileName);

                    for (int j = 0; j < tempDoc.Images.Count; j++)
                    {
                        this.document.Images.Add(tempDoc.Images[j], null);
                    }
                }

                this.HeaderLabel.Text = this.document.Images.Count + " page scanned.";
                this.AxViewer.Visible = false;
                this.Show();
                ////this.Visible = true;
            }
            catch (Exception ex)
            {
                ExceptionManager.ManageException(ex, ExceptionManager.ActionType.CloseCurrentForm, this);
            }
        }
Пример #2
0
    private string OCR(string fileToOCR)
    {
        MODI.Document md = new MODI.Document();

        md.Create(fileToOCR);

        md.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, true, true);

        MODI.Image img = (MODI.Image)md.Images[0];

        MODI.Layout layout = img.Layout;

        layout = img.Layout;

        string result = layout.Text;

        md.Close(false);

        return(result);
    }
Пример #3
0
 static string OCRFile(string path)
 {
     MODI.Document md = new MODI.Document();
     md.Create(path);
     md.OCR(MiLANGUAGES.miLANG_ENGLISH);
     MODI.Images imgs = md.Images;
     MODI.Image img = imgs[0];
     MODI.Layout layout = img.Layout;
     try
     {
         var text = layout.Text;
         return text;
     }
     finally
     {
         md.Close(false);
         Marshal.FinalReleaseComObject(md);
         Marshal.FinalReleaseComObject(imgs);
         Marshal.FinalReleaseComObject(img);
         Marshal.FinalReleaseComObject(layout);
         md = null;
         GC.Collect();
     }
 }
Пример #4
0
 /// <summary>
 /// Print Form Constructor
 /// </summary>
 /// <param name="epage">end page</param>
 /// <param name="midoc">modi document object</param>
 public Printform(int epage, MODI.Document midoc)
 {
     this.InitializeComponent();
     this.endpage = epage;
     this.modidoc = midoc;
 }