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 7443981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:25:10+00:00 2026-05-29T11:25:10+00:00

I cannot convert PPT to XPS or PNG to PDF file. Two ways for

  • 0

I cannot convert PPT to XPS or PNG to PDF file.

Two ways for this problem is:

First Way: Using COM Component Microsoft. For Example

:Microsoft.Office.Interop.PowerPoint,Microsoft.Office.Core , … .

My Code :

private static void PPT2XPS()
{
    Microsoft.Office.Interop.PowerPoint.Application powerpoint;
    Microsoft.Office.Interop.PowerPoint.Presentation presentation;
    Microsoft.Office.Interop.PowerPoint.Presentations presentations;
    powerpoint = new Microsoft.Office.Interop.PowerPoint.Application();
    presentations = powerpoint.Presentations;
    presentation = presentations.Open(@"d:\test.ppt", MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);
    Microsoft.Office.Interop.PowerPoint.Slides slides = presentation.Slides;
    for (int i = 1; i <= slides.Count; i++)
    {
        Microsoft.Office.Interop.PowerPoint.Slide slide = slides[i];
        String slideName = slide.Name;
        releaseCOM(slide);
        slide.Export(@"d:\test\" + i.ToString() + ".xps", "");
    }
}

private static void releaseCOM(object o)
{
    try
    {
        System.Runtime.InteropServices.Marshal.FinalReleaseComObject(o);
    }
    catch { }
    finally
    {
        o = null;
    }
}

Second Way: Sending file to

“Microsoft XPS Document Writer” printer With Process.

My Code :

 Process P = new Process();
    ProcessStartInfo psInfo = new ProcessStartInfo();

    psInfo.FileName = @"C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe";
    string option = @"/t";
    string xps = "Microsoft XPS Document Writer";
    string targetFile = Path.GetDirectoryName(filename) + Path.DirectorySeparatorChar +
        Path.GetFileNameWithoutExtension(filename) +  @".xps";

    string Myargs = String.Format("{0} \"{1}\" \"{2}\" {0} \"{3}\"", option, filename, xps, targetFile);
    psInfo.CreateNoWindow = true;
    psInfo.Arguments = Myargs;
    psInfo.UseShellExecute = false;
    psInfo.ErrorDialog = false;

    P.StartInfo = psInfo;
    P.Start();
    P.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

Third Way: Using API Windows And Sending Binary File .
This is sample for this way :

http://support.microsoft.com/kb/322091

My Problem :

First Way: COM object that has been separated from its underlying RCW cannot be used

Second Way: Cannot Hidden Window and Close Window

Third Way: Cannot Create XPS File . di.OutPutFile Create ill [bad?] file.

  • 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-29T11:25:11+00:00Added an answer on May 29, 2026 at 11:25 am

    Owner this Answer : Emmanuel N

    You can do it like this or this for pdf/word. You can also use 2007 Microsoft Office Add-in: Microsoft Save as PDF or XPS, like this

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

Sidebar

Related Questions

At the following first line of code I get this error: cannot convert ‘std::string’
Can someone please explain why I'm getting this error Type mismatch: cannot convert from
I'm receiving this error in my Linq statement --- Cannot implicitly convert type 'System.Collections.Generic.IEnumerable'
while doing LINQ I got this Error. Cannot implicitly convert type 'System.DateTime?' to 'System.DateTime'.
Am just trying to understand why this exception throws. Cannot implicitly convert type 'System.DateTime?'
I cannot figure out how to convert this code from C# to VB.net. It
The following code gives me this error: Cannot convert from 'System.Collections.Generic.List' to 'System.Collections.Generic.List'. How
what does this error message mean : error C2662: 'addDoctor' : cannot convert 'this'
Is this possible? When i compile i get an error saying cannot convert Component
Does anyone know how to deal with this error? cannot convert from 'System.Guid?' to

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.