예제 #1
0
        public static void TestTextExtraction()
        {
            PDFRenderer renderer = new PDFRenderer(TEST_PDF_FILENAME, null, null);

            renderer.OnPageTextAvailable += PageTextReady;

            while (true)
            {
                renderer.FlushCachedTexts();

                for (int i = 0; i < 8; ++i)
                {
                    try
                    {
                        string filename = renderer.PDFRendererFileLayer.MakeFilename_TextSingle(i);
                        if (File.Exists(filename))
                        {
                            File.Delete(filename);
                        }
                    }
                    catch (Exception)
                    {
                    }

                    WordList text = renderer.GetOCRText(i);
                }

                Thread.Sleep(100);
            }
        }
            public Job(PDFRenderer pdf_renderer, int page)
            {
                this.pdf_renderer = pdf_renderer;
                this.page         = page;

                force_job = false;
                language  = "";
            }
            public Job(PDFRenderer pdf_renderer, int page, int TEXT_PAGES_PER_GROUP)
            {
                this.pdf_renderer         = pdf_renderer;
                this.page                 = page;
                this.TEXT_PAGES_PER_GROUP = TEXT_PAGES_PER_GROUP;

                force_job = false;
                language  = "";
            }
예제 #4
0
 public static void TestCoherentTextExtractor()
 {
     {
         PDFRenderer pdf_renderer = new PDFRenderer(TEST_PDF_FILENAME_LOCAL2, null, null);
         //   PDFCoherentTextExtractor.ExtractText(pdf_renderer);
     }
     {
         PDFRenderer pdf_renderer = new PDFRenderer(TEST_PDF_FILENAME_LOCAL5, null, null);
         //   PDFCoherentTextExtractor.ExtractText(pdf_renderer);
     }
     {
         PDFRenderer pdf_renderer = new PDFRenderer(TEST_PDF_FILENAME_LOCAL8, null, null);
         PDFCoherentTextExtractor.ExtractText(pdf_renderer);
     }
 }
예제 #5
0
        public static void TestPDFRenderer()
        {
            PDFRenderer renderer = new PDFRenderer(TEST_PDF_FILENAME, null, null);

            while (true)
            {
                for (int i = 1; i < 10; ++i)
                {
                    Logging.Info("Asking for page {0}", i);
                    Image image = Image.FromStream(new MemoryStream(renderer.GetPageByDPIAsImage(i, 72)));
                    Logging.Info("Image is {0}", image);

                    Thread.Sleep(100);
                }
            }
        }
 public void Clear()
 {
     pdf_renderer = null;
     language     = String.Empty;
 }