bool ProtectCall(Action <PipelineInputPdfPage> callback, PipelineInputPdfPage pdfPage)
        {
            if (!g_continueOnException)
            {
                callback(pdfPage);
                return(true);
            }

            try
            {
                callback(pdfPage);
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                System.Diagnostics.Debug.WriteLine(ex.ToString());

                bool hasOutput = (_pdfOutput != null);
                if (hasOutput)
                {
                    PipelineDebug.ShowException(this, ex);
                }

                StoreStatistics(new StatsExceptionHandled(pdfPage.GetPageNumber(), ex));
                StoreStatistics(pdfPage.GetPageNumber(), new StatsExceptionHandled(pdfPage.GetPageNumber(), ex));
            }

            return(false);
        }
        public PipelineInputPdfPage Page(int pageNumber)
        {
            if (CurrentPage != null)
            {
                CurrentPage.Dispose();
            }

            var page = new PipelineInputPdfPage(new PipelineFactory(this._documentFactory), this, pageNumber);

            CurrentPage = page;

            return(page);
        }
        public void Dispose()
        {
            if (CurrentPage != null)
            {
                CurrentPage.Dispose();
                CurrentPage = null;
            }

            if (_pdfDocument != null)
            {
                ((IDisposable)_pdfDocument).Dispose();
                _pdfDocument = null;
            }

            if (_pdfOutput != null)
            {
                ((IDisposable)_pdfOutput).Dispose();
                _pdfOutput = null;
            }
        }