Skip to content

Commit 9121e5b

Browse files
Added the samples for smart table extractor features
1 parent 9c4d723 commit 9121e5b

File tree

25 files changed

+379
-0
lines changed

25 files changed

+379
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 18
4+
VisualStudioVersion = 18.4.11626.88 stable
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apply-confidence-threshold-to-table-data", "Apply-confidence-threshold-to-table-data\Apply-confidence-threshold-to-table-data.csproj", "{A418A236-8244-44EB-B263-47B17F2C7D8F}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{A418A236-8244-44EB-B263-47B17F2C7D8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{A418A236-8244-44EB-B263-47B17F2C7D8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{A418A236-8244-44EB-B263-47B17F2C7D8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{A418A236-8244-44EB-B263-47B17F2C7D8F}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {13914425-6630-49AF-AD71-110DDEBD1371}
24+
EndGlobalSection
25+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Apply_confidence_threshold_to_table_data</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.SmartTableExtractor.Net.Core" Version="*" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<None Update="Data\Input.pdf">
17+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
18+
</None>
19+
<None Update="Output\.gitkeep">
20+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
21+
</None>
22+
</ItemGroup>
23+
24+
</Project>

Data-Extraction/Smart-Table-Extractor/Apply-confidence-threshold/.NET/Apply-confidence-threshold-to-table-data/Output/.gitkeep

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System.IO;
2+
using System.Text;
3+
using Syncfusion.SmartTableExtractor;
4+
5+
namespace ApplyConfidenceThresholdToTableData
6+
{
7+
class Program
8+
{
9+
static void Main(string[] args)
10+
{
11+
// Open the input PDF file as a stream.
12+
using (FileStream stream = new FileStream(Path.GetFullPath(@"Data\Input.pdf"), FileMode.Open, FileAccess.Read))
13+
{
14+
// Initialize the Smart Table Extractor.
15+
TableExtractor extractor = new TableExtractor();
16+
// Configure table extraction options to set the confidence threshold for detection.
17+
TableExtractionOptions options = new TableExtractionOptions();
18+
options.ConfidenceThreshold = 0.75;
19+
// Assign the configured options to the extractor.
20+
extractor.TableExtractionOptions = options;
21+
// Extract table data from the PDF document as a JSON string.
22+
string data = extractor.ExtractTableAsJson(stream);
23+
// Save the extracted JSON data into an output file.
24+
File.WriteAllText(Path.GetFullPath(@"Output\Output.json"), data, Encoding.UTF8);
25+
}
26+
}
27+
}
28+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 18
4+
VisualStudioVersion = 18.4.11626.88 stable
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Extract-border-less-table-detection", "Extract-border-less-table-detection\Extract-border-less-table-detection.csproj", "{83B2EA3C-AE8E-46CC-802F-2DE7D76D0C17}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{83B2EA3C-AE8E-46CC-802F-2DE7D76D0C17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{83B2EA3C-AE8E-46CC-802F-2DE7D76D0C17}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{83B2EA3C-AE8E-46CC-802F-2DE7D76D0C17}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{83B2EA3C-AE8E-46CC-802F-2DE7D76D0C17}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {B7018F64-F882-4B08-A65A-51BD9B15B5C0}
24+
EndGlobalSection
25+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Extract_border_less_table_detection</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.SmartTableExtractor.Net.Core" Version="*" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<None Update="Data\Input.pdf">
17+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
18+
</None>
19+
<None Update="Output\.gitkeep">
20+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
21+
</None>
22+
</ItemGroup>
23+
24+
</Project>

Data-Extraction/Smart-Table-Extractor/Extract-border-less-table-detection/.NET/Extract-border-less-table-detection/Output/.gitkeep

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System.IO;
2+
using System.Text;
3+
using Syncfusion.SmartTableExtractor;
4+
5+
namespace ExtractBorderlessTablesFromPdf
6+
{
7+
class Program
8+
{
9+
static void Main(string[] args)
10+
{
11+
// Open the input PDF file as a stream.
12+
using (FileStream stream = new FileStream(Path.GetFullPath(@"Data\Input.pdf"), FileMode.Open, FileAccess.ReadWrite))
13+
{
14+
// Initialize the Smart Table Extractor.
15+
TableExtractor extractor = new TableExtractor();
16+
// Configure the table extraction option to detect border-less tables in the document.
17+
TableExtractionOptions options = new TableExtractionOptions();
18+
options.DetectBorderlessTables = true;
19+
// Assign the configured options to the extractor.
20+
extractor.TableExtractionOptions = options;
21+
// Extract table data from the PDF document as a JSON string.
22+
string data = extractor.ExtractTableAsJson(stream);
23+
// Save the extracted JSON data into an output file.
24+
File.WriteAllText(Path.GetFullPath(@"Output\Output.json"), data, Encoding.UTF8);
25+
}
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)