title: How to perform a PDF conversion in Event Receiver?
body: <p>I am trying to convert the document a <code>.docx</code> file available in document library(conversion) to PDF format in same library whenever the file is updated.</p>
  
  <p>The code I am using is given below:    </p>
  
  <pre><code>public override void ItemUpdated(SPItemEventProperties properties)
             {          
                     ConversionJob job = new ConversionJob(wordAutomationServiceName);
                     job.UserToken = properties.Web.CurrentUser.UserToken;
                     job.Settings.UpdateFields = true;
                     job.Settings.OutputFormat = SaveFormat.PDF;
                     string input = siteURL + "Conversion/Test.docx";
                     string output = siteURL + "Conversion/Test.pdf";
                     job.AddFile(input, output);
                     job.Start();
             }
  </code></pre>
  
  <p>When I run it in debug mode, it executes without any error or exception but it is not generating any PDF file.</p>
  
  <p>I am not able to find out what the problem is</p>
  
  <p>it tried this simple code</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using Microsoft.SharePoint;
  using Microsoft.Office.Word.Server.Conversions;
  
  class Program
  {
      static void Main(string[] args)
      {
  
          string siteUrl = "http://siteurl";
          string wordAutomationServiceName = "Word Automation Services";
          using (SPSite spSite = new SPSite(siteUrl))
          {
              ConversionJob job = new ConversionJob(wordAutomationServiceName);
              job.UserToken = spSite.UserToken;
              job.Settings.UpdateFields = true;
              job.Settings.OutputFormat = SaveFormat.PDF;
              job.AddFile(siteUrl + "/Shared%20Documents/Test.docx",
              siteUrl + "/Shared%20Documents/Test.pdf");
              job.Start();
          }
      }
  }
  </code></pre>
  
  <p>This also did nt workd
  what i feel is there is no error in code must be some problem with sharepoint settings</p>