How to PDF text search API in PowerShell with Web API

This tutorial will show how to PDF text search API in PowerShell

With this source code sample you may quickly learn how to PDF text search API in PowerShell. 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. It can be used to PDF text search API using PowerShell.

PowerShell code samples for PowerShell developers help to speed up coding of your application when using Web API. Follow the instructions from the scratch to work and copy the PowerShell code. Enjoy writing a code with ready-to-use sample PowerShell codes. Web API free trial version is available on our website. PowerShell and other programming languages are supported.

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

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


# The authentication key (API Key). # Get your own by registering at $API_KEY = "***********************************" # Direct URL of PDF file to get information $SourceFileURL = "" # Comma-separated list of page indices (or ranges) to process. Leave empty for all pages. Example: '0,2-5,7-'. $Pages = "" # PDF document password. Leave empty for unprotected documents. $Password = "" # Search string. $SearchString = '\d{1,}\.\d\d' #Regular expression to find numbers like '100.00' # Enable regular expressions (Regex) $RegexSearch = 'True' # Prepare URL for PDF text search API call. # See documentation: $query = "" # Prepare request body (will be auto-converted to JSON by Invoke-RestMethod) # See documentation: $body = @{ "password" = $Password "pages" = $Pages "url" = $SourceFileURL "searchString" = $SearchString "regexSearch" = $RegexSearch } | ConvertTo-Json try { # Execute request $response = Invoke-WebRequest -Method Post -Headers @{ "x-api-key" = $API_KEY; "Content-Type" = "application/json" } -Body $body -Uri $query $jsonResponse = $response.Content | ConvertFrom-Json if ($jsonResponse.error -eq $false) { # Display search information foreach ($item in $jsonResponse.body) { Write-Host "Found text $($item.text) at coordinates $($item.left), $($" } } else { # Display service reported error Write-Host $jsonResponse.message } } catch { # Display request error Write-Host $_.Exception }


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



Get 60 Day Free Trial

See also:


Get Your API Key

See also: