From 66d54293031d32846dab0cfe797485ba97f95abe Mon Sep 17 00:00:00 2001 From: Srihariharan Date: Mon, 25 Sep 2023 17:18:38 +0530 Subject: [PATCH 1/2] 848740_Mac_sample : github sample for mac. --- File-Formats/PDF/Working-with-OCR/MAC.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/File-Formats/PDF/Working-with-OCR/MAC.md b/File-Formats/PDF/Working-with-OCR/MAC.md index c7af6259d..df4797423 100644 --- a/File-Formats/PDF/Working-with-OCR/MAC.md +++ b/File-Formats/PDF/Working-with-OCR/MAC.md @@ -71,7 +71,7 @@ using (OCRProcessor processor = new OCRProcessor()) By executing the program, you will get a PDF document as follows. ![WPF OCR output screenshot](OCR-Images/Output.png) -A complete working sample can be downloaded from [GitHub](https://github.com/SyncfusionExamples/OCR-csharp-examples/tree/master/WPF). +A complete working sample can be downloaded from [GitHub](https://github.com/SyncfusionExamples/OCR-csharp-examples/tree/master/Mac). Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net) to explore the rich set of Syncfusion PDF library features. From 46a625bd557bdc0c5532f31d66e2b89a0b3e0949 Mon Sep 17 00:00:00 2001 From: Srihariharan Date: Tue, 26 Sep 2023 09:32:43 +0530 Subject: [PATCH 2/2] 848740_Mac_sample : tessdata step not added in trouble shooting. --- .../PDF/Working-with-OCR/Troubleshooting.md | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/File-Formats/PDF/Working-with-OCR/Troubleshooting.md b/File-Formats/PDF/Working-with-OCR/Troubleshooting.md index 44d8c02d4..90f0e1e30 100644 --- a/File-Formats/PDF/Working-with-OCR/Troubleshooting.md +++ b/File-Formats/PDF/Working-with-OCR/Troubleshooting.md @@ -204,6 +204,33 @@ If the "brew" is not installed on your machine, you can install it using the fol //Initialize the OCR processor by providing the path of tesseract binaries. using (OCRProcessor processor = new OCRProcessor("/opt/homebrew/Cellar/tesseract/5.3.2/lib")) +{% endhighlight %} +

+ +3.Add the TessDataPath from bin folder. Refer to the example code below: +

+{% highlight c# tabtitle="C#" %} + +using (OCRProcessor processor = new OCRProcessor("/opt/homebrew/Cellar/tesseract/5.3.2/lib")) +{ + FileStream fileStream = new FileStream("../../../Input.pdf", FileMode.Open, FileAccess.Read); + //Load a PDF document. + PdfLoadedDocument lDoc = new PdfLoadedDocument(fileStream); + //Set OCR language to process. + processor.Settings.Language = Languages.English; + //Process OCR by providing the PDF document. + processor.TessDataPath = "runtimes/tessdata"; + processor.PerformOCR(lDoc); + //Create file stream. + using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)) + { + //Save the PDF document to file stream. + lDoc.Save(outputFileStream); + } + //Close the document. + lDoc.Close(true); +} + {% endhighlight %}