private static Rectangle GetScreenToImageRectangle(AxMODI.AxMiDocView viewer, Rectangle r, out int page) { Rectangle clientRect = r; Point cp = viewer.PointToClient(new Point(r.X, r.Y)); clientRect.X = cp.X; clientRect.Y = cp.Y; page = -1; int ppage1, imgx1, imgy1; int ppage2, imgx2, imgy2; try { viewer.ClientToImage(clientRect.Left, clientRect.Top, out ppage1, out imgx1, out imgy1); viewer.ClientToImage(clientRect.Right, clientRect.Bottom, out ppage2, out imgx2, out imgy2); } catch (Exception exc) { throw new DocumentAreaException("Invalid bounds! Frame must be within a single page!"); } if (ppage1 != ppage2) { throw new DocumentAreaException("Invalid bounds (2 pages selected)! Frame must be within a single page!"); } page = ppage1; Rectangle rect = new Rectangle(imgx1, imgy1, imgx2 - imgx1, imgy2 - imgy1); return(rect); }
public TableExtractorFrame(AxMODI.AxMiDocView documentViewer, TableRequest request) { InitializeComponent(); _documentViewer = documentViewer; _request = request; // Synchronize transparent color this.TransparencyKey = TransparentListView.TransparentColor; }
public static Rectangle GetImageSelectionToClientRectangle(AxMODI.AxMiDocView viewer, DocumentArea DocumentArea) { int x1, y1, x2, y2; viewer.ImageToClient(DocumentArea.Page, DocumentArea.Area.X, DocumentArea.Area.Y, out x1, out y1); viewer.ImageToClient(DocumentArea.Page, DocumentArea.Area.Right, DocumentArea.Area.Bottom, out x2, out y2); return(new Rectangle(x1, y1, x2 - x1, y2 - y1)); }
public static DocumentArea GetScreenToImageRectangle(AxMODI.AxMiDocView viewer, Rectangle screenRectangle) { int viewPage = 0; DocumentArea context = new DocumentArea(); Rectangle viewTarget = DocumentViewerSupport.GetScreenToImageRectangle(viewer, screenRectangle, out viewPage); context.Area = viewTarget; context.Page = viewPage; return(context); }
public static Rectangle GetImageSelectionAreaToScreen(AxMODI.AxMiDocView viewer) { DocumentArea DocumentArea = GetImageSelection(viewer); if (DocumentArea == null) { return(Rectangle.Empty); } Rectangle clientRect = GetImageSelectionToClientRectangle(viewer, DocumentArea); Rectangle screenRect = viewer.RectangleToScreen(clientRect); return(screenRect); }
public static DocumentArea GetImageSelection(AxMODI.AxMiDocView viewer) { try { int page, left, top, right, bottom; viewer.ImageSelection.GetBoundingRect(out page, out left, out top, out right, out bottom); DocumentArea DocumentArea = new DocumentArea(); DocumentArea.Area = new Rectangle(left, top, right - left, bottom - top); DocumentArea.Page = page; return(DocumentArea); } catch (Exception ee) { return(null); } }
private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components); this.miFile = new System.Windows.Forms.MenuItem(); this.miOpen = new System.Windows.Forms.MenuItem(); this.miExportTable = new System.Windows.Forms.MenuItem(); this.miSave = new System.Windows.Forms.MenuItem(); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.miCopy = new System.Windows.Forms.MenuItem(); this.miAnalyse = new System.Windows.Forms.MenuItem(); this.miOCRParameters = new System.Windows.Forms.MenuItem(); this.miExtractTable = new System.Windows.Forms.MenuItem(); this.statusBar1 = new System.Windows.Forms.StatusBar(); this.axMiDocView1 = new AxMODI.AxMiDocView(); this.toolBar1 = new System.Windows.Forms.ToolBar(); this.toolBarButton8 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton9 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton4 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton6 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton5 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton1 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton7 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton3 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton2 = new System.Windows.Forms.ToolBarButton(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.listView1 = new System.Windows.Forms.ListView(); this.splitter1 = new System.Windows.Forms.Splitter(); ((System.ComponentModel.ISupportInitialize)(this.axMiDocView1)).BeginInit(); this.SuspendLayout(); // // mainMenu1 // this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.miFile, this.menuItem1 }); // // miFile // this.miFile.Index = 0; this.miFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.miOpen, this.miExportTable, this.miSave }); this.miFile.Text = "File"; // // miOpen // this.miOpen.Index = 0; this.miOpen.Text = "Open.."; this.miOpen.Click += new System.EventHandler(this.miOpen_Click); // // miExportTable // this.miExportTable.Index = 1; this.miExportTable.Text = "Export table.."; this.miExportTable.Click += new System.EventHandler(this.miExportTable_Click); // // miSave // this.miSave.Index = 2; this.miSave.Text = "Save"; this.miSave.Click += new System.EventHandler(this.miSave_Click); // // menuItem1 // this.menuItem1.Index = 1; this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.miCopy, this.miAnalyse, this.miOCRParameters, this.miExtractTable }); this.menuItem1.Text = "Edit"; // // miCopy // this.miCopy.Index = 0; this.miCopy.Shortcut = System.Windows.Forms.Shortcut.CtrlC; this.miCopy.Text = "Copy text to clipboard"; this.miCopy.Click += new System.EventHandler(this.miCopy_Click); // // miAnalyse // this.miAnalyse.Index = 1; this.miAnalyse.Shortcut = System.Windows.Forms.Shortcut.F5; this.miAnalyse.Text = "Start OCR"; this.miAnalyse.Click += new System.EventHandler(this.miOCR_Click); // // miOCRParameters // this.miOCRParameters.Index = 2; this.miOCRParameters.Text = "Select OCR Parameters.."; this.miOCRParameters.Click += new System.EventHandler(this.miOCRParameters_Click); // // miExtractTable // this.miExtractTable.Index = 3; this.miExtractTable.Shortcut = System.Windows.Forms.Shortcut.F2; this.miExtractTable.Text = "Extract Table"; this.miExtractTable.Click += new System.EventHandler(this.miExtractTable_Click); // // statusBar1 // this.statusBar1.Location = new System.Drawing.Point(0, 595); this.statusBar1.Name = "statusBar1"; this.statusBar1.Size = new System.Drawing.Size(760, 22); this.statusBar1.TabIndex = 4; // // axMiDocView1 // this.axMiDocView1.Dock = System.Windows.Forms.DockStyle.Fill; this.axMiDocView1.Enabled = true; this.axMiDocView1.Location = new System.Drawing.Point(275, 42); this.axMiDocView1.Name = "axMiDocView1"; this.axMiDocView1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axMiDocView1.OcxState"))); this.axMiDocView1.Size = new System.Drawing.Size(485, 553); this.axMiDocView1.SelectionChanged += new System.EventHandler(this.axMiDocView1_SelectionChanged); // // toolBar1 // this.toolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat; this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { this.toolBarButton8, this.toolBarButton9, this.toolBarButton4, this.toolBarButton6, this.toolBarButton5, this.toolBarButton1, this.toolBarButton7, this.toolBarButton3, this.toolBarButton2 }); this.toolBar1.DropDownArrows = true; this.toolBar1.ImageList = this.imageList1; this.toolBar1.Location = new System.Drawing.Point(0, 0); this.toolBar1.Name = "toolBar1"; this.toolBar1.ShowToolTips = true; this.toolBar1.Size = new System.Drawing.Size(760, 42); this.toolBar1.TabIndex = 6; this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick); // // toolBarButton8 // this.toolBarButton8.ImageIndex = 0; this.toolBarButton8.Name = "toolBarButton8"; this.toolBarButton8.Tag = "OpenDocument"; this.toolBarButton8.Text = "Open"; // // toolBarButton9 // this.toolBarButton9.ImageIndex = 0; this.toolBarButton9.Name = "toolBarButton9"; this.toolBarButton9.Tag = "Export"; this.toolBarButton9.Text = "Export"; // // toolBarButton4 // this.toolBarButton4.ImageIndex = 0; this.toolBarButton4.Name = "toolBarButton4"; this.toolBarButton4.Tag = "OCR"; this.toolBarButton4.Text = "OCR"; // // toolBarButton6 // this.toolBarButton6.ImageIndex = 0; this.toolBarButton6.Name = "toolBarButton6"; this.toolBarButton6.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; // // toolBarButton5 // this.toolBarButton5.ImageIndex = 0; this.toolBarButton5.Name = "toolBarButton5"; this.toolBarButton5.Tag = "NewRequest"; this.toolBarButton5.Text = "New Request"; // // toolBarButton1 // this.toolBarButton1.ImageIndex = 0; this.toolBarButton1.Name = "toolBarButton1"; this.toolBarButton1.Tag = "AppendColumn"; this.toolBarButton1.Text = "Append Column"; // // toolBarButton7 // this.toolBarButton7.ImageIndex = 0; this.toolBarButton7.Name = "toolBarButton7"; this.toolBarButton7.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; // // toolBarButton3 // this.toolBarButton3.ImageIndex = 0; this.toolBarButton3.Name = "toolBarButton3"; this.toolBarButton3.Tag = "AdjustFrame"; this.toolBarButton3.Text = "Adjust and Capture"; // // toolBarButton2 // this.toolBarButton2.ImageIndex = 0; this.toolBarButton2.Name = "toolBarButton2"; this.toolBarButton2.Tag = "Capture"; this.toolBarButton2.Text = "Capture"; // // imageList1 // this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.Images.SetKeyName(0, ""); // // listView1 // this.listView1.Dock = System.Windows.Forms.DockStyle.Left; this.listView1.FullRowSelect = true; this.listView1.GridLines = true; this.listView1.Location = new System.Drawing.Point(0, 42); this.listView1.Name = "listView1"; this.listView1.Size = new System.Drawing.Size(272, 553); this.listView1.TabIndex = 7; this.listView1.View = System.Windows.Forms.View.Details; this.listView1.Click += new System.EventHandler(this.listView1_Click); // // splitter1 // this.splitter1.Location = new System.Drawing.Point(272, 42); this.splitter1.Name = "splitter1"; this.splitter1.Size = new System.Drawing.Size(3, 553); this.splitter1.TabIndex = 8; this.splitter1.TabStop = false; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(760, 617); this.Controls.Add(this.axMiDocView1); this.Controls.Add(this.splitter1); this.Controls.Add(this.listView1); this.Controls.Add(this.toolBar1); this.Controls.Add(this.statusBar1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Menu = this.mainMenu1; this.Name = "Form1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Table Extraction"; ((System.ComponentModel.ISupportInitialize)(this.axMiDocView1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
public MODIHandler(AxMODI.AxMiDocView docView, string tmp) { converter = docView; tmpDir = tmp; }