Word nyomtatása PDF-be


Ez a szkript egy MS Word vagy LibreOffice Writer fájlt nyomtat ki PDF formátumba.

$folderpath =  $(get-location) 
 Add-type -AssemblyName office
#Convert Word formats to pdf
#$Files = Get-ChildItem -Path $folderpath -include *.doc, *.docx, *.odf -recurse 
$wd = New-Object -ComObject word.application 
$wd.visible = $false 

Get-ChildItem -Path $folderpath -Include *.doc, *.docx, *.odf -Recurse |
    ForEach-Object {
    $doc = $wd.Documents.Open($_.Fullname)
    $pdf = $_.FullName -replace $_.Extension, '.pdf'
        "saving $pdf" 
    $doc.ExportAsFixedFormat($pdf,17)
    $doc.Close()
    }
$wd.Quit()

A .ps1 file letöltése