开发者

Convert pdf to Word document [closed]

开发者 https://www.devze.com 2023-01-10 02:37 出处:网络
Closed. This question does not meet Stack Overflow开发者_如何转开发 guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow开发者_如何转开发 guidelines. It is not currently accepting answers.

Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist

Closed 9 years ago.

Improve this question

Thanks for the answers that you all given... Here I would like to ask one more question :

What is the best way to convert PDF document to Word document in .net?


Save all pdf in run folder to docx.

Convert powershell script to C#.

Test in 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;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消