public void Execute(Arguments arguments)
        {
            AbbyyManager       manager  = AbbyyManager.Instance;
            FineReaderDocument document = manager.GetDocument(manager.CurentDocumentCount);

            document.ExportToXml(arguments.Path.Value);
        }
Exemplo n.º 2
0
        public void Execute(Arguments arguments)
        {
            AbbyyManager manager = AbbyyManager.Instance;
            int          docID   = arguments.DocumentID == null ? manager.CurentDocumentCount : arguments.DocumentID.Value;
            var          doc     = manager.GetDocument(docID);

            Scripter.Variables.SetVariableValue(arguments.Result.Value, new AbbyyDocumentStructure(doc.CustomDocument));
        }
Exemplo n.º 3
0
        public void Execute(Arguments arguments)
        {
            manager = AbbyyManager.Instance;
            int           docID = arguments.DocumentID == null ? manager.CurentDocumentCount : arguments.DocumentID.Value;
            var           doc   = manager.GetDocument(docID);
            List <string> table = doc.Tables[arguments.TableIndex.Value].ReturnWordPosition(arguments.Search.Value);
            ListStructure cells = new ListStructure(new List <Structure>());

            foreach (String t in table)
            {
                cells.Value.Add(new TextStructure(t));
            }
            Scripter.Variables.SetVariableValue(arguments.Result.Value, cells);
        }
        public void Execute(Arguments arguments)
        {
            manager = AbbyyManager.Instance;
            int docID = arguments.DocumentID == null ? manager.CurentDocumentCount : arguments.DocumentID.Value;
            var doc   = manager.GetDocument(docID);

            List <Rectangle> rectangles = doc.FindPosition(arguments.Search.Value);

            ListStructure matchesRectangles = new ListStructure(new List <Structure>());

            foreach (Rectangle r in rectangles)
            {
                matchesRectangles.Value.Add(new RectangleStructure(r));
            }

            Scripter.Variables.SetVariableValue(arguments.Result.Value, matchesRectangles);
        }
Exemplo n.º 5
0
        public void Execute(Arguments arguments)
        {
            AbbyyManager       manager  = AbbyyManager.Instance;
            int                docID    = arguments.DocumentID == null ? manager.CurentDocumentCount : arguments.DocumentID.Value;
            FineReaderDocument document = manager.GetDocument(docID);

            document.ExtractData();
            List <FineReaderParagraph> paragraphs = document.Paragraphs;

            ListStructure paragraphsList = new ListStructure(new List <Structure>());

            foreach (FineReaderParagraph p in paragraphs)
            {
                paragraphsList.Value.Add(new TextStructure(p.Text));
            }

            Scripter.Variables.SetVariableValue(arguments.Result.Value, paragraphsList);
        }
Exemplo n.º 6
0
        public void Execute(Arguments arguments)
        {
            AbbyyManager       manager  = AbbyyManager.Instance;
            int                docID    = arguments.DocumentID == null ? manager.CurentDocumentCount : arguments.DocumentID.Value;
            FineReaderDocument document = manager.GetDocument(docID);
            int                row      = 0;
            int                column   = 0;

            string[] position = arguments.Position.Value.Split(',');

            row    = int.Parse(position[0]);
            column = int.Parse(position[1]);

            System.Drawing.Point cellSpans = new System.Drawing.Point(
                document.Tables[arguments.TableIndex.Value - 1][row - 1, column - 1].RowSpan,
                document.Tables[arguments.TableIndex.Value - 1][row - 1, column - 1].ColumnSpan);

            Scripter.Variables.SetVariableValue(arguments.Result.Value, new PointStructure(cellSpans));
        }
Exemplo n.º 7
0
        public void Execute(Arguments arguments)
        {
            AbbyyManager manager = AbbyyManager.Instance;

            int docID = arguments.DocumentID == null ? manager.CurentDocumentCount : arguments.DocumentID.Value;

            FineReaderDocument document = manager.GetDocument(docID);

            document.ExtractData();

            ListStructure cellsText = new ListStructure(new List <Structure>());

            foreach (FineReaderCell c in document.Cells)
            {
                cellsText.Value.Add(new TextStructure(c.Text));
            }

            Scripter.Variables.SetVariableValue(arguments.Result.Value, cellsText);
        }
        public void Execute(Arguments arguments)
        {
            AbbyyManager manager = AbbyyManager.Instance;
            int          docID   = arguments.DocumentID == null ? manager.CurentDocumentCount : arguments.DocumentID.Value;
            var          doc     = manager.GetDocument(docID);
            string       output  = string.Empty;

            switch (arguments.Method.Value.ToLower())
            {
            case "structured":
                output = doc.GetAllText();
                break;

            case "linebyline":
                output = doc.GetLinesText();
                break;

            default:
                throw new ArgumentException("Wrong method argument. It accepts either 'structured' or 'linebyline' value.");
            }
            Scripter.Variables.SetVariableValue(arguments.Result.Value, new TextStructure(output));
        }
Exemplo n.º 9
0
        public void Execute(Arguments arguments)
        {
            AbbyyManager       manager      = AbbyyManager.Instance;
            int                docID        = arguments.DocumentID?.Value ?? manager.CurentDocumentCount;
            FineReaderDocument document     = manager.GetDocument(docID);
            int                row          = 0;
            int                column       = 0;
            int                rowOffset    = 0;
            int                columnOffset = 0;

            var position = arguments.Position.Value.Split(',');

            row    = int.Parse(position[0]);
            column = int.Parse(position[1]);

            if (!string.IsNullOrEmpty(arguments.Offset?.Value))
            {
                var positionOffset = arguments.Offset.Value.Split(',');
                rowOffset    = int.Parse(positionOffset[0]);
                columnOffset = int.Parse(positionOffset[1]);
            }

            string cellTextValue = string.Empty;

            try
            {
                cellTextValue = document.Tables[arguments.TableIndex.Value - 1][row - 1 + rowOffset, column - 1 + columnOffset].Text ?? string.Empty;
            }
            catch
            {
            }

            TextStructure cellText = new TextStructure(cellTextValue);

            Scripter.Variables.SetVariableValue(arguments.Result.Value, cellText);
        }
Exemplo n.º 10
0
        public void Execute(Arguments arguments)
        {
            AbbyyManager manager = AbbyyManager.Instance;

            FineReaderDocument.FilterFlags paramsFilter = FineReaderDocument.FilterFlags.none;

            string[] flagsString = arguments.Filter.Value.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string flag in flagsString)
            {
                FineReaderDocument.FilterFlags currentFlag = FineReaderDocument.FilterFlags.none;
                try
                {
                    currentFlag   = (FineReaderDocument.FilterFlags)Enum.Parse(typeof(FineReaderDocument.FilterFlags), flag.Trim(), true);
                    paramsFilter |= (FineReaderDocument.FilterFlags)Enum.Parse(typeof(FineReaderDocument.FilterFlags), flag.Trim(), true);
                }
                catch
                {
                    throw new ArgumentOutOfRangeException(nameof(arguments.Filter), currentFlag, $"{currentFlag} is not defined filter");
                }
            }

            int docID = arguments.DocumentID == null ? manager.CurentDocumentCount : arguments.DocumentID.Value;

            FineReaderDocument document = manager.GetDocument(docID);

            document.ExtractData();

            ListStructure filteredTexts = new ListStructure(new List <Structure>());

            foreach (string s in document.Filter(paramsFilter))
            {
                filteredTexts.Value.Add(new TextStructure(s));
            }

            Scripter.Variables.SetVariableValue(arguments.Result.Value, filteredTexts);
        }