ohtake / WindowsPowerShell

my Windows PowerShell profile
0 stars 0 forks source link

Acrobat.txt script GetType error #1

Closed luoqeng closed 1 year ago

luoqeng commented 1 year ago

I get an error running the Acrobat.txt script, can you help me? Adobe Acrobat Pro 2022 is already installed

值不在预期的范围内。
所在位置 C:\Users\luoqe\Desktop\doc2pdf\pdf2doc.ps1:113 字符: 5
+     $t = $j.GetType();
+     ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException

不能对 Null 值表达式调用方法。
所在位置 C:\Users\luoqe\Desktop\doc2pdf\pdf2doc.ps1:114 字符: 5
+     $t.InvokeMember(
+     ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [],RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
ohtake commented 1 year ago

I wrote Actobat.txt 12 years ago. Please solve the issue by yourself using the latest documentation at https://opensource.adobe.com/dc-acrobat-sdk-docs/library/interapp/IAC_API_OLE_Objects.html.

luoqeng commented 1 year ago

I found the fix. $t = $j.GetType(); replace with $t = [Type]::GetType($j); https://github.com/ohtake/WindowsPowerShell/blob/master/Acrobat.txt#L18

Reference https://dy100ms.hatenadiary.jp/entry/2022/01/22/000000

wlevene commented 1 month ago

pdf2document.com - No loss of pdf layout 30 free page conversions daily for all users.