How to PDF text search API in PowerShell with PDF.co 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. 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. 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 PDF.co 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.

PDF.co Web API free trial version is available on our website. PowerShell and other programming languages are supported.

Try PDF.co Web API today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

GetPdfTextSearchFromUrl.ps1
      
# The authentication key (API Key). # Get your own by registering at https://app.pdf.co/documentation/api $API_KEY = "***********************************" # Direct URL of PDF file to get information $SourceFileURL = "https://bytescout-com.s3.amazonaws.com/files/demo-files/cloud-api/pdf-to-text/sample.pdf" # 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: https://app.pdf.co/documentation/api/1.0/pdf/find.html $query = "https://api.pdf.co/v1/pdf/find?password=$($Password)&pages=$($Pages)&url=$($SourceFileURL)&searchString=$($SearchString)&regexSearch=$($RegexSearch)" $query = [System.Uri]::EscapeUriString($query) try { # Execute request $jsonResponse = Invoke-RestMethod -Method Get -Headers @{ "x-api-key" = $API_KEY } -Uri $query if ($jsonResponse.error -eq $false) { # Display search information foreach ($item in $jsonResponse.body) { Write-Host "Found text $($item.text) at coordinates $($item.left), $($item.top)" } } else { # Display service reported error Write-Host $jsonResponse.message } } catch { # Display request error Write-Host $_.Exception }

Try PDF.co Web API today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

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

Try PDF.co Web API today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

VIDEO

ON-PREMISE VERSION INFORMATION

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

Explore PDF.co Web API Documentation

Get PDF.co Web API Free Training

WEB API

Get Your Free API Key

Explore Web API Documentation

Related Samples: