Skip to content

Commit 9d84a18

Browse files
committed
removed unwanted code changes
1 parent a97a653 commit 9d84a18

File tree

1 file changed

+3
-18
lines changed
  • How-to/How-to-extract-Text-using-OCR/ExtractingSample/WinForms_TextExtractionByOCR

1 file changed

+3
-18
lines changed

How-to/How-to-extract-Text-using-OCR/ExtractingSample/WinForms_TextExtractionByOCR/PdfViewer.xaml.cs

+3-18
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,11 @@ namespace WinForms_TextExtractionByOCR
2424
/// </summary>
2525
public partial class PdfViewer : UserControl
2626
{
27-
string file;
28-
string tessaractBinariesPath;
29-
string tessDataPath;
3027
RectangleF bounds;
3128
public PdfViewer()
3229
{
3330
InitializeComponent();
34-
#if NETCOREAPP
35-
file = "../../../Data/F#.pdf";
36-
#else
37-
file = "../../Data/F#.pdf";
38-
#endif
39-
pdfViewer.Load(file);
31+
pdfViewer.Load("../../Data/F#.pdf");
4032
}
4133

4234
private void Rectangle_Click(object sender, RoutedEventArgs e)
@@ -49,23 +41,16 @@ private void PdfViewer_ShapeAnnotationChanged(object sender, Syncfusion.Windows.
4941
{
5042
if (e.Action == Syncfusion.Windows.PdfViewer.AnnotationChangedAction.Add)
5143
{
52-
#if NETCOREAPP
53-
tessaractBinariesPath = "../../../Tesseract binaries";
54-
tessDataPath = @"../../../Tessdata/";
55-
#else
56-
tessaractBinariesPath = "../../Tesseract binaries";
57-
tessDataPath = @"../../Tessdata/";
58-
#endif
5944
bounds = e.NewBounds;
6045
PdfLoadedDocument loadedDocument = pdfViewer.LoadedDocument;
61-
using (OCRProcessor processor = new OCRProcessor(tessaractBinariesPath))
46+
using (OCRProcessor processor = new OCRProcessor("../../Tesseract binaries"))
6247
{
6348
//Language to process the OCR
6449
processor.Settings.Language = Languages.English;
6550
Bitmap image = GetBitmap(pdfViewer.ExportAsImage(pdfViewer.CurrentPageIndex - 1));
6651
using (Bitmap clonedImage = image.Clone(bounds, System.Drawing.Imaging.PixelFormat.Format32bppArgb))
6752
{
68-
string ocrText = processor.PerformOCR(clonedImage, tessDataPath);
53+
string ocrText = processor.PerformOCR(clonedImage, @"../../Tessdata/");
6954
}
7055
image.Dispose();
7156
}

0 commit comments

Comments
 (0)