PowerTip of the Day, from PowerShell.com:
To convert a whole folder full of MS Word documents to PDF, here's a function that might help:
function Export-WordToPDF {
param(
[Parameter(Mandatory=$true,Val
[Alias("FullName")]
$path,
$pdfpath = $null)
process {
if (!$pdfpath) {
$pdfpath = [System.IO.Path]::ChangeExtens
}
$word = New-Object -ComObject Word.Application
$word.displayAlerts = $false
$word.Visible = $true
$doc = $word.Documents.Open($path)
#$doc.TrackRevisions = $false
$null = $word.ActiveDocument.ExportAsF
$word.ActiveDocument.Close()
$word.Quit()
}
}
Use it like this:
PS> Dir c:\folder -Filter *.doc | Export-WordToPDF
Thanks