感谢你们给出的答案...... 在这里,我想再问一个问题:
在.net中将 PDF文档转换为Word文档的最佳方法是什么?
答案 0 :(得分:2)
将运行文件夹中的所有pdf保存到docx。
将powershell脚本转换为C#。
在AcrobatX Pro中测试。
Pdf2Docx.ps1:
$TypeExt="docx"
$closeDocParam = $true;
Get-ChildItem -Filter *.pdf |Where {
# logical document
$AVDoc = New-Object -ComObject AcroExch.AVDoc;
$AVDoc.Open($_.Fullname, "") | Out-Null;
# physical document
$PDDoc = $AVDoc.GetPDDoc();
$JavaScriptObject = $PDDoc.GetJSObject();
# get the bridge JavaScript Object
$T = $JavaScriptObject.GetType();
$T.InvokeMember("SaveAs",
[Reflection.BindingFlags]::InvokeMethod -bor `
[Reflection.BindingFlags]::Public -bor `
[Reflection.BindingFlags]::Instance ,
$null,
$JavaScriptObject,
@([IO.Path]::ChangeExtension($_.Fullname, $TypeExt), ("com.adobe.acrobat."+$TypeExt)));
$T.InvokeMember("closeDoc",
[Reflection.BindingFlags]::InvokeMethod -bor `
[Reflection.BindingFlags]::Public -bor `
[Reflection.BindingFlags]::Instance ,
$null,
$JavaScriptObject,
$closeDocParam) | Out-Null;
$PDDoc.Close() | Out-Null;
$AVDoc.Close(1) | Out-Null;
}