Hello PowerShell Gurus,
I need your help in my script. I need to be able to edit the font type of a document to “MS PGothic” and then save it as PDF. The problem is it does not change all the fonts just save it as pdf. I am thinking perhap because it is in protected mode. Could you help me find out what is wrong with my code? Thanks in advance.
$folderpath = “C:\Users\codavar\Documents\CCIBS\Report\”
$word = New-Object -ComObject word.application
$word.visible = $False
$DisplayAlerts = $false
$fileTypes = “.doc”, ".docx"
Update-FormatData -path $fileTypes |
$path = ($.fullname).substring(0,($.FullName).lastindexOf(“.”))
“Converting $path to pdf …”
$doc = $word.documents.open($_.fullname)
$Word.Selection.PageSetup.Orientation = 1
$Word.Selection.Font.Name = “MS PGothic”
$doc.saveas([ref] $path, [ref]$wdFormatPDF)