Skip to main content
Nintex Community Menu Bar

Convert doсx to pdf


25799i0FF18D63126DD7F9.jpg25800iBB037D5B0220536C.png25801i6C93B53E37C7DD81.png25802i7BBD1C46AB8C152B.png 

25803iCDB67BEED6B07E59.pngyou can write the full path to a single file, instead of *.docx

 

$dollar$Files = Get-ChildItem "D:*.docx"

 

$dollar$Word = New-Object -ComObject Word.Application

 

Foreach ($dollar$File in $dollar$Files) {

  # open a Word document, filename from the directory

  $dollar$Doc = $dollar$Word.Documents.Open($dollar$File.FullName)

 

  # Swap out DOCX with PDF in the Filename

 $dollar$Name=($dollar$Doc.FullName).Replace("docx","pdf")

 

  # Save this File as a PDF in Word 2010/2013

  $dollar$Doc.SaveAs([ref] $dollar$Name, [ref] 17)

  $dollar$Doc.Close()

}

Translate
Did this topic help you find an answer to your question?

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings