#Download http://sourceforge.net/projects/itextsharp/
#Set paths: iTextSharp, PDF
$iTextSharpFilePath = “C:\Users\user1\Downloads\PowerShell.PDF\itextsharp.dll”
$pdfFilePath = “C:\Users\user1\Downloads\PowerShell.PDF\”#Load iTextSharp
[System.Reflection.Assembly]::LoadFrom($iTextSharpFilePath)#PDF example
$reader = New-Object iTextSharp.text.pdf.pdfreader -ArgumentList “$pdfFilePath\example.pdf”for ($page = 1; $page -le $reader.NumberOfPages; $page++)
{
$lines = [char[]]$reader.GetPageContent($page) -join “” -split “`n”
foreach ($line in $lines)
{
if ($line -match “^\[“)
{
$line = $line -replace “\\([\S])”, $matches[1]
$line -replace “^\[\(|\)\]TJ$”, “” -split “\)\-?\d+\.?\d*\(” -join “”
}
}
#Print content
$line
$line=””
}
The post Read PDF (iTextsharp) appeared first on Scripting.