@@ -83,10 +83,33 @@ using System.IO;
8383using Syncfusion.SmartDataExtractor;
8484using System.Text;
8585
86- string inputPath = "Image.png";
86+ //Open the input image file as a stream.
87+ using (FileStream stream = new FileStream("Image.png", FileMode.Open, FileAccess.Read))
88+ {
89+ //Initialize the Data Extractor.
90+ DataExtractor extractor = new DataExtractor();
91+ //Enable form detection in the image document.
92+ extractor.EnableFormDetection = true;
93+ //Enable table detection in the image document.
94+ extractor.EnableTableDetection = true;
95+ //Set confidence threshold for extraction.
96+ extractor.ConfidenceThreshold = 0.6;
97+ //Extract data as JSON from the image stream.
98+ string data = extractor.ExtractDataAsJson(stream);
99+ //Save the extracted JSON data into an output file.
100+ File.WriteAllText("Output.json", data, Encoding.UTF8);
101+ }
102+
103+ {% endhighlight %}
104+
105+ {% highlight c# tabtitle="C# [Windows-specific]" %}
106+
107+ using System.IO;
108+ using Syncfusion.SmartDataExtractor;
109+ using System.Text;
87110
88111//Open the input image file as a stream.
89- using (FileStream stream = new FileStream(inputPath , FileMode.Open, FileAccess.Read))
112+ using (FileStream stream = new FileStream("Image.png" , FileMode.Open, FileAccess.Read))
90113{
91114 //Initialize the Data Extractor.
92115 DataExtractor extractor = new DataExtractor();
@@ -119,16 +142,15 @@ using Syncfusion.SmartDataExtractor;
119142using Syncfusion.SmartFormRecognizer;
120143using System.Text;
121144
122- string inputPath = "Input.pdf";
123-
124145//Open the input PDF file as a stream.
125- using (FileStream stream = new FileStream(inputPath , FileMode.Open, FileAccess.Read))
146+ using (FileStream stream = new FileStream("Input.pdf" , FileMode.Open, FileAccess.Read))
126147{
127148 //Initialize the Smart Data Extractor.
128149 DataExtractor extractor = new DataExtractor();
129150
130151 //Enable form detection in the document.
131152 extractor.EnableFormDetection = true;
153+ extractor.EnableTableDetection = false;
132154 //Set confidence threshold for extraction.
133155 extractor.ConfidenceThreshold = 0.6
134156 //Configure form recognition options.
@@ -160,16 +182,15 @@ using Syncfusion.SmartDataExtractor;
160182using Syncfusion.SmartFormRecognizer;
161183using System.Text;
162184
163- string inputPath = "Input.pdf";
164-
165185//Open the input PDF file as a stream.
166- using (FileStream stream = new FileStream(inputPath , FileMode.Open, FileAccess.Read))
186+ using (FileStream stream = new FileStream("Input.pdf" , FileMode.Open, FileAccess.Read))
167187{
168188 //Initialize the Smart Data Extractor.
169189 DataExtractor extractor = new DataExtractor();
170190
171191 //Enable form detection in the document.
172192 extractor.EnableFormDetection = true;
193+ extractor.EnableTableDetection = false;
173194 //Set confidence threshold for extraction.
174195 extractor.ConfidenceThreshold = 0.6
175196 //Configure form recognition options.
@@ -209,16 +230,15 @@ using Syncfusion.Pdf.Parsing;
209230using Syncfusion.SmartDataExtractor;
210231using Syncfusion.SmartFormRecognizer;
211232
212- string inputPath = "Input.pdf";
213-
214233//Open the input PDF file as a stream.
215- using (FileStream stream = new FileStream(inputPath , FileMode.Open, FileAccess.Read))
234+ using (FileStream stream = new FileStream("Input.pdf" , FileMode.Open, FileAccess.Read))
216235{
217236 //Initialize the Smart Data Extractor.
218237 DataExtractor extractor = new DataExtractor();
219238
220239 //Enable form detection in the document to identify form fields.
221240 extractor.EnableFormDetection = true;
241+ extractor.EnableTableDetection = false;
222242 //Apply confidence threshold to extract only reliable data.
223243 extractor.ConfidenceThreshold = 0.6;
224244
@@ -258,10 +278,8 @@ using Syncfusion.Pdf.Parsing;
258278using Syncfusion.SmartDataExtractor;
259279using Syncfusion.SmartFormRecognizer;
260280
261- string inputPath = "Input.pdf";
262-
263281//Open the input PDF file as a stream.
264- using (FileStream stream = new FileStream(inputPath , FileMode.Open, FileAccess.Read))
282+ using (FileStream stream = new FileStream("Input.pdf" , FileMode.Open, FileAccess.Read))
265283{
266284 //Initialize the Smart Data Extractor.
267285 DataExtractor extractor = new DataExtractor();
@@ -315,14 +333,14 @@ using Syncfusion.SmartDataExtractor;
315333using Syncfusion.SmartTableExtractor;
316334
317335// Load the input PDF file.
318- string inputPath = "Input.pdf";
319- using (FileStream stream = new FileStream(inputPath, FileMode.Open, FileAccess.Read))
336+ using (FileStream stream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read))
320337{
321338 // Initialize the Smart Data Extractor.
322339 DataExtractor extractor = new DataExtractor();
323340
324341 // Enable table detection and set confidence threshold.
325342 extractor.EnableTableDetection = true;
343+ extractor.EnableFormDetection = false;
326344 extractor.ConfidenceThreshold = 0.6;
327345
328346 // Configure table extraction options.
@@ -355,14 +373,14 @@ using Syncfusion.SmartDataExtractor;
355373using Syncfusion.SmartTableExtractor;
356374
357375// Load the input PDF file.
358- string inputPath = "Input.pdf";
359- using (FileStream stream = new FileStream(inputPath, FileMode.Open, FileAccess.Read))
376+ using (FileStream stream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read))
360377{
361378 // Initialize the Smart Data Extractor.
362379 DataExtractor extractor = new DataExtractor();
363380
364381 // Enable table detection and set confidence threshold.
365382 extractor.EnableTableDetection = true;
383+ extractor.EnableFormDetection = false;
366384 extractor.ConfidenceThreshold = 0.6;
367385
368386 // Configure table extraction options.
@@ -401,14 +419,14 @@ using Syncfusion.Pdf.Parsing;
401419using Syncfusion.SmartDataExtractor;
402420
403421// Load the input PDF file.
404- string inputPath = "Input.pdf";
405- using (FileStream stream = new FileStream(inputPath, FileMode.Open, FileAccess.Read))
422+ using (FileStream stream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read))
406423{
407424 // Initialize the Smart Data Extractor.
408425 DataExtractor extractor = new DataExtractor();
409426
410427 // Apply confidence threshold to extract the data.
411428 // Only elements with confidence >= 0.75 will be included in the results.
429+ //default confidence threshold value is 0.6
412430 extractor.ConfidenceThreshold = 0.75;
413431 // Extract data and return as a loaded PDF document.
414432 PdfLoadedDocument pdf = extractor.ExtractDataAsPdfDocument(stream);
@@ -428,14 +446,14 @@ using Syncfusion.Pdf.Parsing;
428446using Syncfusion.SmartDataExtractor;
429447
430448// Load the input PDF file.
431- string inputPath = "Input.pdf";
432- using (FileStream stream = new FileStream(inputPath, FileMode.Open, FileAccess.Read))
449+ using (FileStream stream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read))
433450{
434451 // Initialize the Smart Data Extractor.
435452 DataExtractor extractor = new DataExtractor();
436453
437454 // Apply confidence threshold to extract the data.
438455 // Only elements with confidence >= 0.75 will be included in the results.
456+ //default confidence threshold value is 0.6
439457 extractor.ConfidenceThreshold = 0.75;
440458 // Extract data and return as a loaded PDF document.
441459 PdfLoadedDocument pdf = extractor.ExtractDataAsPdfDocument(stream);
@@ -462,10 +480,8 @@ using System.IO;
462480using Syncfusion.Pdf.Parsing;
463481using Syncfusion.SmartDataExtractor;
464482
465- string inputPath = "Input.pdf";
466-
467483//Open the input PDF file as a stream.
468- using (FileStream stream = new FileStream(inputPath , FileMode.Open, FileAccess.Read))
484+ using (FileStream stream = new FileStream("Input.pdf" , FileMode.Open, FileAccess.Read))
469485{
470486 //Initialize the Smart Data Extractor.
471487 DataExtractor extractor = new DataExtractor();
@@ -491,10 +507,8 @@ using System.IO;
491507using Syncfusion.Pdf.Parsing;
492508using Syncfusion.SmartDataExtractor;
493509
494- string inputPath = "Input.pdf";
495-
496510//Open the input PDF file as a stream.
497- using (FileStream stream = new FileStream(inputPath , FileMode.Open, FileAccess.Read))
511+ using (FileStream stream = new FileStream("Input.pdf" , FileMode.Open, FileAccess.Read))
498512{
499513 //Initialize the Smart Data Extractor.
500514 DataExtractor extractor = new DataExtractor();
0 commit comments