User Word Automation Service using PowerShell

With PowerShell also possible to use Word Automation Service to convert documents to pdf, xps, etc formats.

Execute below script in PowerShell on your SharePoint Server. Don’t forgot to make necessary changes in script as per your environment. Also Word Automation Service should be in running state.

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Word.Server")

$jobSettings = New-Object Microsoft.Office.Word.Server.Conversions.ConversionJobSettings

$jobSettings.OutputFormat = "PDF"

$job = New-Object Microsoft.Office.Word.Server.Conversions.ConversionJob("Var Word Automation Service", $jobSettings)

$job.UserToken = (Get-SPWeb http://VarSiteName).CurrentUser.UserToken

$job.AddFile("http://VarSiteName/Document%20Library/VarDocName.docx", "http://VarSiteName/Document%20Library/VarDocName.pdf")

$job.Start()

For UI based solution check this link: SharePoint Document Converter

%d bloggers like this: