3

I'm trying to convert a DOCX file into a PDF file using a workflow in Sharepoint 2010 using Word Automation Services.

Here is what I use in my workflow :

ConversionJobSettings jobSettings = new ConversionJobSettings();
jobSettings.OutputFormat = SaveFormat.PDF;

ConversionJob pdfConversion = new ConversionJob("Word Automation Services",         jobSettings);

pdfConversion.UserToken = workflowProperties.Web.CurrentUser.UserToken;

string wordFile = workflowProperties.WebUrl + "/" + workflowProperties.Item.Url;
string pdfFile = wordFile.Replace(".docx", ".pdf");

pdfConversion.AddFile(wordFile, pdfFile);

pdfConversion.Start();

But no PDF is ever created. The workflow is defined as "Completed", but I saw nothing else. I checked the state of the Workflow Automation Services in the Central Administration and everything looks good and the service is started. The Word file is in a document library and I want to create the PDF file in the same folder as the Word file.

Does someone know what to do in order to convert Word to PDF ?

  • I have the same issue, did you find a solution? – user10749 Sep 16 '12 at 23:11
1

When I add files to the convention job queue, I use a different script where I see a couple of things missing:

Loading Microsoft.Office.Word.Server and Jobsetting.OutPutFormat = "PDF";

[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 Automation Service", $jobSettings)
$job.UserToken = (Get-SPWeb http://SiteCollectionURL).CurrentUser.UserToken
$job.AddFile("http://SiteCollectionURL/Shared%20Documents/Test.docx", "http://SiteCollectionURL/Shared%20Documents/Test.pdf")

$job.Start()

Try without you workflow, and set the Word Automation Timer Job to 1 minute. Make sure your service account (WAS) have access to the Content Database and that the Word Automation Service (in services on server) is running on the server where you run your test, and later on, your workflow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.