How to parse from url for document parser API in VB.NET and PDF.co Web API

How to parse from url in VB.NET with easy ByteScout code samples to make document parser API. Step-by-step tutorial

On this page, you will find sample source codes which show you how to handle a complex task, such as, document parser API in VB.NET. PDF.co Web API helps with document parser API in VB.NET. PDF.co Web API is the flexible Web API that includes full set of functions from e-signature requests to data extraction, OCR, images recognition, pdf splitting and pdf splitting. Can also generate barcodes and read barcodes from images, scans and pdf.

The SDK samples displayed below below explain how to quickly make your application do document parser API in VB.NET with the help of PDF.co Web API. For implementation of this functionality, please copy and paste the code below into your app using code editor. Then compile and run your app. Further improvement of the code will make it more robust.

Free! Free! Free! ByteScout free trial version is available for FREE download from our website. Programming tutorials along with source code samples are assembled.

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

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

Module1.vb
      
Imports System.Collections.Specialized Imports System.IO Imports System.Net Imports System.Text Imports Newtonsoft.Json.Linq Module Module1 ' The authentication key (API Key). ' Get your own by registering at https://app.pdf.co/documentation/api Const API_KEY As String = "***********************************" ' Source PDF file Urll Const SourceFileUrl As String = "https://bytescout-com.s3.amazonaws.com/files/demo-files/cloud-api/document-parser/MultiPageTable.pdf" ' Destination TXT file name Const DestinationFile As String = ".\result.json" Sub Main() ' Template text. Use Document Parser SDK (https//bytescout.com/products/developer/documentparsersdk/index.html) ' to create templates. ' Read template from file Dim templateText As String = File.ReadAllText("MultiPageTable-template1.yml") ' Create standard .NET web client instance Dim webClient As WebClient = New WebClient() ' Set API Key webClient.Headers.Add("x-api-key", API_KEY) Try ' PARSE UPLOADED PDF DOCUMENT ' URL for `Document Parser` API call Dim query As String = "https://api.pdf.co/v1/pdf/documentparser" Dim requestBody As New NameValueCollection() requestBody.Add("url", SourceFileUrl) requestBody.Add("template", templateText) ' Execute request Dim responseBytes As Byte() = webClient.UploadValues(query, "POST", requestBody) Dim response As String = Encoding.UTF8.GetString(responseBytes) ' Parse JSON response Dim json As JObject = JObject.Parse(response) If json("error").ToObject(Of Boolean) = False Then ' Get URL of generated JSON file Dim resultFileUrl As String = json("url") ' Download JSON file webClient.DownloadFile(resultFileUrl, DestinationFile) Console.WriteLine("Generated JSON file saved as {0} file.", DestinationFile) Else Console.WriteLine(json("message").ToString()) End If Catch ex As WebException Console.WriteLine(ex.ToString()) End Try webClient.Dispose() Console.WriteLine() Console.WriteLine("Press any key...") Console.ReadKey() End Sub End Module

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit PDF.co Web API Home Page

Explore PDF.co Web API Documentation

Explore Samples

Sign Up for PDF.co Web API Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

MultiPageTable-template1.yml
      
--- # Template that demonstrates parsing of multi-page table using only # regular expressions for the table start, end, and rows. # If regular expression cannot be written for every table row (for example, # if the table contains empty cells), try the second method demonstrated # in `MultiPageTable-template2.yml` template. templateVersion: 2 templatePriority: 0 sourceId: Multipage Table Test detectionRules: keywords: - Sample document with multi-page table fields: total: expression: TOTAL {{DECIMAL}} tables: - name: table1 start: # regular expression to find the table start in document expression: Item\s+Description\s+Price\s+Qty\s+Extended Price end: # regular expression to find the table end in document expression: TOTAL\s+\d+\.\d\d row: # regular expression to find table rows expression: '^\s*(?<itemNo>\d+)\s+(?<description>.+?)\s+(?<price>\d+\.\d\d)\s+(?<qty>\d+)\s+(?<extPrice>\d+\.\d\d)' columns: - name: itemNo type: integer - name: description type: string - name: price type: decimal - name: qty type: integer - name: extPrice type: decimal multipage: true

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit PDF.co Web API Home Page

Explore PDF.co Web API Documentation

Explore Samples

Sign Up for PDF.co Web API Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

packages.config
      
<?xml version="1.0" encoding="utf-8"?> <packages> <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net40" /> </packages>

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit PDF.co Web API Home Page

Explore PDF.co Web API Documentation

Explore Samples

Sign Up for PDF.co Web API 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 PDF.co Web API Home Page

Explore PDF.co Web API Documentation

Explore Samples

Sign Up for PDF.co Web API Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Related Samples: