Hello,
I'm trying to do a simple print/conversion from pdf to text and I'm getting the below errors when I try to execute the following code:
$PDFCreator = New-Object -ComObject PDFCreator.JobQueue
$PDFCreator.Initialize()
$PJ = $PDFCreator.PrintFileSwitchingPrinters('C:\Users\ivaar\OneDrive\Documents\GitHub\PowerShell\ACA-guide.pdf', $TRUE)
$PJ.SetProfileByGuid('TextCon')
$PJ.ConvertTo('C:\Users\ivaar\OneDrive\Documents\GitHub\PowerShell\Converted-Guide.txt')
$PDFCreator.ReleaseCom()
Method invocation failed because [pdfforge.PDFCreator.UI.COM.Queue] does not
contain a method named 'PrintFileSwitchingPrinters'.
At C:\Users\ivaar\OneDrive\Documents\GitHub\PowerShell\TestTwo.ps1:5 char:1
+ $PJ = $PDFCreator.PrintFileSwitchingPrinters('C:\Users\ivaar\OneDrive ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
You cannot call a method on a null-valued expression.
At C:\Users\ivaar\OneDrive\Documents\GitHub\PowerShell\TestTwo.ps1:6 char:1
+ $PJ.SetProfileByGuid('TextCon')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\Users\ivaar\OneDrive\Documents\GitHub\PowerShell\TestTwo.ps1:7 char:1
+ $PJ.ConvertTo('C:\Users\ivaar\OneDrive\Documents\GitHub\PowerShell\Co ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull