How to parse from url for document parser API in Powershell and Web API

Step By Step Instructions on how to parse from url for document parser API in Powershell

Writing of the code to parse from url in Powershell can be done by developers of any level using Web API. Web API was designed to assist document parser API in Powershell. Web API is the Rest API that provides set of data extraction functions, tools for documents manipulation, splitting and merging of pdf files. Includes built-in OCR, images recognition, can generate and read barcodes from images, scans and pdf.

Powershell code snippet like this for Web API works best when you need to quickly implement document parser API in your Powershell application. For implementation of this functionality, please copy and paste the code below into your app using code editor. Then compile and run your app. Check Powershell sample code examples to see if they respond to your needs and requirements for the project.

Trial version of ByteScout is available for free download from our website. This and other source code samples for Powershell and other programming languages are available.

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

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


templateName: Multipage Table Test templateVersion: 4 templatePriority: 0 detectionRules: keywords: - Sample document with multi-page table objects: - name: total objectType: field fieldProperties: fieldType: macros expression: TOTAL{{Spaces}}({{Number}}) regex: true dataType: decimal - name: table1 objectType: table tableProperties: start: expression: Item{{Spaces}}Description{{Spaces}}Price regex: true end: expression: TOTAL{{Spaces}}{{Number}} regex: true row: expression: '{{LineStart}}{{Spaces}}(?<itemNo>{{Digits}}){{Spaces}}(?<description>{{SentenceWithSingleSpaces}}){{Spaces}}(?<price>{{Number}}){{Spaces}}(?<qty>{{Digits}}){{Spaces}}(?<extPrice>{{Number}})' regex: true columns: - name: itemNo dataType: integer - name: description dataType: string - name: price dataType: decimal - name: qty dataType: integer - name: extPrice dataType: decimal multipage: true


# The authentication key (API Key). # Get your own by registering at $API_KEY = "***********************************" # Source PDF file url $SourceFileUrl = "" # Destination JSON file name $DestinationFile = ".\result.json" try { # Parse url # Template text. Use Document Parser SDK ( # to create templates. # Read template from file: $templateContent = [IO.File]::ReadAllText(".\MultiPageTable-template1.yml") # Prepare URL for `Document Parser` API call $query = "" # Content $Body = @{ "url" = $SourceFileUrl; "template" = $templateContent; } # Execute request $jsonResponse = Invoke-RestMethod -Method 'Post' -Headers @{ "x-api-key" = $API_KEY } -Uri $query -Body ($Body|ConvertTo-Json) -ContentType "application/json" if ($jsonResponse.error -eq $false) { # Get URL of generated HTML file $resultFileUrl = $jsonResponse.url; # Download output file Invoke-WebRequest -Headers @{ "x-api-key" = $API_KEY } -OutFile $DestinationFile -Uri $resultFileUrl Write-Host "Generated output file saved as `"$($DestinationFile)`" file." } else { # Display service reported error Write-Host $jsonResponse.message } } catch { # Display request error Write-Host $_.Exception }


@echo off powershell -NoProfile -ExecutionPolicy Bypass -Command "& .\ParseFromUrl.ps1" echo Script finished with errorlevel=%errorlevel% pause



Get 60 Day Free Trial

See also:


Get Your API Key

See also: