ByteScout PDF Extractor SDK - PowerShell - PDF To JSON - ByteScout

ByteScout PDF Extractor SDK – PowerShell – PDF To JSON

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Extractor SDK – PowerShell – PDF To JSON

PDF to JSON in PowerShell and ByteScout PDF Extractor SDK

How to Convert PDF to JSON in Powershell

Writing of the code to PDF to JSON in Powershell can be done by developers of any level using ByteScout PDF Extractor SDK. ByteScout PDF Extractor SDK was made to help with PDF to JSON in Powershell. ByteScout PDF Extractor SDK is the SDK that helps developers to extract data from unstructured documents, pdf, images, scanned and electronic forms. Includes AI functions like automatic table detection, automatic table extraction and restructuring, text recognition and text restoration from pdf and scanned documents. Includes PDF to CSV, PDF to XML, PDF to JSON, PDF to searchable PDF functions as well as methods for low level data extraction.

Powershell code snippet like this for ByteScout PDF Extractor SDK works best when you need to quickly implement PDF to JSON in your Powershell application. This Powershell sample code should be copied and pasted into your application’s code editor. Then just compile and run it to see how it works. Code testing will allow the function to be tested and work properly with your data.

Visit our website provides for free trial version of ByteScout PDF Extractor SDK. Free trial includes lots of source code samples to help you with your Powershell project.

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

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

pdf-to-json.bat
      
@echo off if "%~1"=="" ( echo ----------------------------------------------------- echo Invalid parameter! echo ----------------------------------------------------- echo Usage: pdf-to-json.bat folder_path echo Example: pdf-to-json.bat "c:\documents" echo ----------------------------------------------------- if not "%NOPAUSE%"=="1" pause exit /b 1 ) powershell -NoProfile -ExecutionPolicy Bypass -Command "& .\pdf-to-json.ps1" "%1" echo Script finished with errorlevel=%errorlevel% pause

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Extractor SDK Home Page

Explore ByteScout PDF Extractor SDK Documentation

Explore Samples

Sign Up for ByteScout PDF Extractor SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

pdf-to-json.ps1
      
Param( [Parameter(Mandatory = $true)] [string] $InputFolder = "" ) # Add reference to Bytescout.PDFExtractor.dll assembly Add-Type -Path "c:\Program Files\Bytescout PDF Extractor SDK\net4.00\Bytescout.PDFExtractor.dll" # Check input folder exists if ((Test-Path $InputFolder) -eq $false) { Write-Host "Target folder does not exist." -ForegroundColor Red exit 0 } # Create and activate JSONExtractor instance $jsonExtractor = New-Object Bytescout.PDFExtractor.JSONExtractor $jsonExtractor.RegistrationName = "demo" $jsonExtractor.RegistrationKey = "demo" try { # Get PDF files from input folder $files = Get-ChildItem -Path $InputFolder -Recurse -Include "*.pdf" foreach ($file in $files) { Write-Host "Input file" $file.FullName # Construct output file name $jsonFileName = [System.IO.Path]::ChangeExtension($file.FullName, "json") Write-Host " Output file" $jsonFileName # Load PDF document $jsonExtractor.LoadDocumentFromFile($file.FullName) # Disable the formatting reconstruction $jsonExtractor.PreserveFormattingOnTextExtraction = $false # Extract first page to JSON $jsonExtractor.SaveJSONToFile(0, $jsonFileName) # Reset extractor $jsonExtractor.Reset() } } catch { Write-Host $_.Exception.Message } $jsonExtractor.Dispose()

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Extractor SDK Home Page

Explore ByteScout PDF Extractor SDK Documentation

Explore Samples

Sign Up for ByteScout PDF Extractor 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 PDF Extractor SDK Home Page

Explore ByteScout PDF Extractor SDK Documentation

Explore Samples

Sign Up for ByteScout PDF Extractor SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next