public PipelineText <TextLine> AllPages <T>(Action <PipelineInputPdfPage> callback)
            where T : IConvertBlock, new()
        {
            var textLines = StreamConvert <T>(callback);

            var pipeText = new PipelineText <TextLine>(this._documentFactory, this, textLines, _indexTree, this);

            return(pipeText);
        }
Beispiel #2
0
        IEnumerable <TT> ConvertPipelineTextToEnumerable(PipelineText <TT> pipelineText)
        {
            var stream = pipelineText.CurrentStream;

            foreach (var data in stream)
            {
                yield return(data);
            }

            pipelineText.Dispose();
        }
Beispiel #3
0
        public PipelineText <TextLine> AllPagesExcept <T>(IEnumerable <int> exceptPages, Action <PipelineInputPdfPage> callback)
            where T : IConvertBlock, new()
        {
            var pageList = Enumerable.Range(1, _pdfDocument.GetNumberOfPages()).Except(exceptPages);

            var textLines = StreamConvert <T>(pageList, callback);

            var pipeText = new PipelineText <TextLine>(this, textLines, _indexTree, this);

            return(pipeText);
        }
Beispiel #4
0
        public PipelineText <TO> ConvertText <P, TO>()
            where P : class, IAggregateStructure <TT, TO>, new()
        {
            var initial = (IEnumerable <TT>) this.CurrentStream;

            var processor = _factory.CreateInstance(() => new TransformText <P, TT, TO>());

            var index = processor.GetIndexRef();

            _indexTree.AddRef(index);

            var result = processor.Transform(initial);

            var pipe = new PipelineText <TO>(this.Context, result, _indexTree, this);

            return(pipe);
        }
Beispiel #5
0
        public PipelineText <TO> ConvertText <P, TO>(bool preprocess)
            where P : class, IAggregateStructure <TT, TO>
        {
            var initial   = (IEnumerable <TT>) this.CurrentStream;
            var transform = _factory.CreateGlobalInstance <P>();
            var processor = new TransformText <P, TT, TO>(transform);

            _tracker.TrackInstance(processor);

            var index = processor.GetIndexRef();

            _indexTree.AddRef(index);

            var result = processor.Transform(initial);

            if (preprocess)
            {
                result = result.ToArray();
            }

            var pipe = new PipelineText <TO>(_factory, this.Context, result, _indexTree, this);

            return(pipe);
        }
        //static public PipelineText Output(this PipelineText page, string filename)
        //{
        //    PipelineDebug.Output(page.Context, filename);

        //    return page;
        //}

        static public PipelineText <T> DebugBreak <T>(this PipelineText <T> page, Func <PipelineText <T>, bool> condition = null)
        {
            PipelineDebug.DebugBreak(page, condition);

            return(page);
        }