Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6619943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:02:11+00:00 2026-05-25T21:02:11+00:00

I am trying to convert the document a .docx file available in document library(conversion)

  • 0

I am trying to convert the document a .docx file available in document library(conversion) to PDF format in same library whenever the file is updated.

The code I am using is given below:

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();
           }

When I run it in debug mode, it executes without any error or exception but it is not generating any PDF file.

I am not able to find out what the problem is

it tried this simple 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();
        }
    }
}

This also did nt workd
what i feel is there is no error in code must be some problem with sharepoint settings

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:02:11+00:00Added an answer on May 25, 2026 at 9:02 pm

    Do you have a Document object?

    I’m not sure if you can use this in your context, but if yes, you could try:

    docObject.ExportAsFixedFormat("Yourdoc.pdf", WdExportFormat.wdExportFormatPDF, false,
                            WdExportOptimizeFor.wdExportOptimizeForPrint, WdExportRange.wdExportAllDocument, 0, 0,
                            WdExportItem.wdExportDocumentContent, true, true,
                            WdExportCreateBookmarks.wdExportCreateNoBookmarks, true, false, false, ref oMissing);
    

    More info here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert a xml document from one format to another and while
Currently, I am trying to clean up an HTML file using JTidy, convert it
I'm trying to convert an XML file into the markup used by dokuwiki, using
I'm trying convert xml from one format to other using the XslCompiledTransform in c#.
I'm trying to generate a PDF document using FOP and Java. I receive the
I am trying to convert HTML into a PDF document in Django and haven't
I'm trying to convert an Excel document into a table in SQL 2005. I
I'm trying to convert an XPS document to a BMP so that a C#
i´m using subsonic 3 trying convert a SQL2008 project to MySQL. when the projects
Trying to convert this c code into MIPS and run it in SPIM. int

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.