Autor da pergunta: Ttutors BR
Como Converter Vários Arquivos Do Word Para PDF Grátis
se liga que dá sim! pra converter vários documentos.docx para documentos.pdf de uma vez só! coloca na pasta e manda braza veja o tutorial!
$Word=New-Object -ComObject Word.Application
$Files=@(Get-ChildItem ".\*.docx") + @(Get-ChildItem ".\*.doc")
# Need @() to get an array in case there is only one file - see
# https://blogs.technet.microsoft.com/heyscriptingguy/2013/07/18/powertip-find-number-elements-in-a-powershell-array/#comment-104863
for($file_idx = 0; $file_idx -lt $Files.Count; ++$file_idx) {
# Show the current progress
$File = $Files[$file_idx]
Write-Progress -Activity "Convert DOC(X) to PDF" `
-CurrentOperation $File.Name `
-PercentComplete (($file_idx/$Files.Count)*100)
# Make the PDF
$Document=$Word.Documents.Open($File.FullName)
$Name=($Document.FullName -replace "\.docx?", ".pdf") # -replace is case-insensitive regex per https://ss64.com/ps/syntax-regex.html
$Document.SaveAs([ref] $Name, [ref] 17)
$Document.Close()
}
# Clean up
$Word.Quit() # Doesn't close other Word instance that may be running.
# Remove any dangling references, per https://technet.microsoft.com/en-us/library/ff730962.aspx
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($Word)
Remove-Variable Word
#Copiado no blog e canal Servti
https://www.servti.com/2020/08/27/como-converter-varios-arquivos-do-word-para-pdf-gratis/
Perguntado em: Computador e Internet
REF-1740523750
Deseja acompanhar as respostas para esta pergunta?
CliqueSabe a Resposta? responda usando o Facebook: