Skip to content

Commit

Permalink
fixed search-pdfdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
ntatschner committed Aug 23, 2023
1 parent d4b9d62 commit 8b6a06f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Modules/Tatux.Utils/Public/Search-PDFDoc.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ function Search-PDFDoc {
)

BEGIN {
$FunctionPath = Split-Path -Path $PSCommandPath -Parent
$FunctionPath = $(Join-Path -Path $(Split-Path -Path $PSCommandPath -Parent) -ChildPath "Dependencies")
try {
Add-Type -Path "$FunctionPath\itextsharp.dll" -ErrorAction SilentlyContinue
Add-Type -Path "$FunctionPath\itextsharp.dll" -ErrorAction Stop
Write-Verbose "Class itextsharp.dll loaded."
}
catch {
$_
Write-Verbose "Class itextsharp.dll already loaded."
}
#Load File
Expand All @@ -67,6 +68,10 @@ function Search-PDFDoc {
}
try {
$PDFReader = New-Object iTextSharp.text.pdf.pdfreader -ArgumentList $Path -ErrorAction Stop
if ($PSBoundParameters.ContainsKey("Verbose")) {
Write-Output "PDF details from reader:`n"
$PDFReader
}
}
catch {
$Obj = New-Object PSObject -Property $Props
Expand Down

0 comments on commit 8b6a06f

Please sign in to comment.