Example: Converting MS Word to PDF

Previous Next

Here is an example of a PowerShell script which uses MS Word to convert a Word document to PDF:

INVOKE USPowershell.ExecuteScript

WITH

SELECT '

$word_app = New-Object -ComObject Word.Application

$document = $word_app.Documents.Open("C:\Temp\MyDocument.docx")

$document.SaveAs([ref] "C:\Temp\MyDocument.pdf", [ref] 17)

$document.Close()

$word_app.Quit()

'

This causes a file "C:\Temp\MyDocument.pdf" to be generated.

 

See also

Example: Simple script execution

Example: Script execution with paramaters

Example: Stateful test

Example: Dynamically Adding C#

Example: Query call to the Rules Engine

Example: Manipulation call to the Rules Engine

Example: Call to the Rules Engine with variables

Example: Query call to the Rules Engine and loop through result

USPowerShell