ByteScout Document Parser SDK - C# - Create Custom Template - ByteScout

ByteScout Document Parser SDK – C# – Create Custom Template

  • Home
  • /
  • Articles
  • /
  • ByteScout Document Parser SDK – C# – Create Custom Template

How to create custom template in C# with ByteScout Document Parser SDK

This tutorial will show how to create custom template in C#

The coding tutorials are designed to help you test the features without need to write your own code. ByteScout Document Parser SDK is the template based data extraction engine can process thousands and millions of documents per day based on templates. Can work online and offline for privacy focused tasks. Templates can be supported and updated without any programming or technical knowledge required. Output is generated in JSON, CSV, XML and custom format if required and you can use it to create custom template with C#.

Fast application programming interfaces of ByteScout Document Parser SDK for C# plus the instruction and the code below will help you quickly learn how to create custom template. Follow the instructions from the scratch to work and copy the C# code. Further enhancement of the code will make it more vigorous.

Free trial version of ByteScout Document Parser SDK is available for download from our website. Get it to try other source code samples for C#.

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

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

Program.cs
      
using System; using ByteScout.DocumentParser; // This example demonstrates data parsing from an invoice using the custom template. namespace CustomTemplate { class Program { static void Main(string[] args) { string customTemplate = @".\SampleTemplate.yml"; string inputDocument = @".\SampleInvoice.pdf"; // Create DocumentParser instance using (DocumentParser documentParser = new DocumentParser("demo", "demo")) { Console.WriteLine({code}quot;Loading template \"{customTemplate}\"..."); Console.WriteLine(); documentParser.AddTemplate(customTemplate); Console.WriteLine({code}quot;Parsing \"{inputDocument}\"..."); Console.WriteLine(); // Parse invoice data in JSON format string jsonString = documentParser.ParseDocument(inputDocument, OutputFormat.JSON); // Display parsed data in console Console.WriteLine("Parsing results in JSON format:"); Console.WriteLine(); Console.WriteLine(jsonString); } Console.WriteLine(); Console.WriteLine("Press any key to continue..."); Console.ReadLine(); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Document Parser SDK Home Page

Explore ByteScout Document Parser SDK Documentation

Explore Samples

Sign Up for ByteScout Document Parser SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

SampleTemplate.yml
      
sourceId: My Custom Template detectionRules: keywords: - Your Company Name - Invoice No\. - TOTAL fields: total: expression: TOTAL {{DECIMAL}} type: decimal pageIndex: 0 dateIssued: expression: Invoice Date {{DATE}} type: date dateFormat: auto-mdy pageIndex: 0 invoiceId: expression: Invoice No. {{123}} pageIndex: 0 companyName: expression: Vendor Company static: true pageIndex: 0 billTo: rect: - 32.25 - 150 - 348 - 70.5 pageIndex: 0 notes: rect: - 32.25 - 227.25 - 531 - 47.25 pageIndex: 0 tables: - name: table1 start: expression: Item\s+Quantity\s+Price\s+Total end: expression: TOTAL subItemStart: {} subItemEnd: {} row: expression: ^\s*(?<description>\w+.*)(?<quantity>\d+)\s+(?<unitPrice>\d+\.\d{2})\s+(?<itemTotal>\d+\.\d{2})\s*$

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Document Parser SDK Home Page

Explore ByteScout Document Parser SDK Documentation

Explore Samples

Sign Up for ByteScout Document Parser 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 Document Parser SDK Home Page

Explore ByteScout Document Parser SDK Documentation

Explore Samples

Sign Up for ByteScout Document Parser SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

prev
next