Free Trial
Web API version
Licensing
Request A Quote
HAVE QUESTIONS OR NEED HELP? SUBMIT THE SUPPORT REQUEST FORM or write email to SUPPORT@BYTESCOUT.COM
Arabic Text Extraction | Powershell
ExtractArabicText.bat:
@echo off if "%~1"=="" ( echo ----------------------------------------------------- echo Invalid parameter! echo ----------------------------------------------------- echo Usage: ExtractArabicText.bat file_name echo Example: ExtractArabicText.bat "sample_english_arabic.pdf" echo ----------------------------------------------------- if not "%NOPAUSE%"=="1" pause exit /b 1 ) powershell -NoProfile -ExecutionPolicy Bypass -Command "& .\ExtractArabicText.ps1" "%1" echo Script finished with errorlevel=%errorlevel% pause
ExtractArabicText.ps1:
#*******************************************************************************************# # # # Download Free Evaluation Version From: https://bytescout.com/download/web-installer # # # # Also available as Web API! Get Your Free API Key: https://app.pdf.co/signup # # # # Copyright © 2017-2020 ByteScout, Inc. All rights reserved. # # https://www.bytescout.com # # https://pdf.co # # # #*******************************************************************************************# Param ( [Parameter(Mandatory = $true)] [string] $InputFileName = "" ) #Add reference to Bytescout.PDFExtractor.dll assembly Add-Type -Path "C:\Program Files\Bytescout PDF Extractor SDK\net4.00\Bytescout.PDFExtractor.dll" # Check input file exists if ((Test-Path $InputFileName) -eq $false) { Write-Host "Input file does not exist." -ForegroundColor Red Exit 0 } # Create and activate Bytescout.PDFExtractor.TextExtractor instance $Extractor = New-Object Bytescout.PDFExtractor.TextExtractor $Extractor.RegistrationName = "demo" $Extractor.RegistrationKey = "demo" try { # Load sample PDF document $Extractor.LoadDocumentFromFile($InputFileName) # Enable Arabic (and other RTL languages) text detection $Extractor.RTLTextAutoDetectionEnabled = $true # Construct output file name $OutputFileName = [System.IO.Path]::ChangeExtension($InputFileName, "txt") # Save extracted text to file $Extractor.SaveTextToFile($OutputFileName) Write-Host "Data has been extracted to $OutputFileName file." } catch { Write-Host $_.Exception.Message } $Extractor.Dispose()