ByteScout PDF Extractor SDK - C# - Extract Text from Foldable Brochure Booklet - ByteScout

ByteScout PDF Extractor SDK – C# – Extract Text from Foldable Brochure Booklet

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Extractor SDK – C# – Extract Text from Foldable Brochure Booklet

How to extract text from foldable brochure booklet in C# using ByteScout PDF Extractor SDK

ByteScout PDF Extractor SDK: the SDK that helps developers to extract data from unstructured documents, pdf, images, scanned and electronic forms. Includes AI functions like automatic table detection, automatic table extraction and restructuring, text recognition and text restoration from pdf and scanned documents. Includes PDF to CSV, PDF to XML, PDF to JSON, PDF to searchable PDF functions as well as methods for low level data extraction.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

ExtractTextFromFoldableBrochure.csproj
      
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion> </ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{25E68A98-BA0D-428D-99F4-0ED8C42DD41C}</ProjectGuid> <OutputType>Exe</OutputType> <RootNamespace>ExtractTextFromFoldableBrochure</RootNamespace> <AssemblyName>ExtractTextFromFoldableBrochure</AssemblyName> <OldToolsVersion>3.5</OldToolsVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Bytescout.PDFExtractor, Version=1.0.0.12, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Drawing" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> </ItemGroup> <ItemGroup> <Compile Include="Program.cs" /> </ItemGroup> <ItemGroup> <Content Include="..\..\SampleFoldable.pdf"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> <Link>SampleFoldable.pdf</Link> </Content> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Extractor SDK Home Page

Explore ByteScout PDF Extractor SDK Documentation

Explore Samples

Sign Up for ByteScout PDF Extractor SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Program.cs
      
using Bytescout.PDFExtractor; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.IO; using System.Text; namespace ExtractTextFromFoldableBrochure { class Program { static void Main(string[] args) { // Set extraction regions // Use Bytescout Template Editor / Bytescout PDF Multitool or other tool to know region co-ordinates var lstExtractionRegion = new List<RectangleF>(); lstExtractionRegion.Add(new RectangleF(7.5f, 33.8f, 244.5f, 353.3f)); lstExtractionRegion.Add(new RectangleF(273.8f, 201.8f, 247.5f, 198.0f)); lstExtractionRegion.Add(new RectangleF(537.8f, 27.0f, 246.0f, 268.5f)); // Ouput File var resFile = "result.txt"; var sRes = new StringBuilder(string.Empty); // Create Bytescout.PDFExtractor.TextExtractor instance TextExtractor extractor = new TextExtractor(); extractor.RegistrationName = "demo"; extractor.RegistrationKey = "demo"; // Load sample PDF document extractor.LoadDocumentFromFile(@".\SampleFoldable.pdf"); // Loop through all extraction regions, and extract text foreach (var oRegion in lstExtractionRegion) { var extractedText = GetTextFromRegion(extractor, oRegion); sRes.AppendLine(extractedText); } // Cleanup extractor.Dispose(); // Write all reslut to output file File.WriteAllText(resFile, sRes.ToString()); // Open result file in default associated application ProcessStartInfo processStartInfo = new ProcessStartInfo(@".\result.txt"); Process.Start(processStartInfo); } /// <summary> /// Get text from particular region /// </summary> private static string GetTextFromRegion(TextExtractor textExtractor, RectangleF extractionRegion, int pageIndex = 0) { // Set Extraction Area textExtractor.SetExtractionArea(extractionRegion); // Get Text from that region return textExtractor.GetTextFromPage(pageIndex); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Extractor SDK Home Page

Explore ByteScout PDF Extractor SDK Documentation

Explore Samples

Sign Up for ByteScout PDF Extractor SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Extractor SDK Home Page

Explore ByteScout PDF Extractor SDK Documentation

Explore Samples

Sign Up for ByteScout PDF Extractor SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next