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

  • Home
  • SEARCH
  • 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 144527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:16:03+00:00 2026-05-11T08:16:03+00:00

I have found several open-source/freeware programs that allow you to convert .doc files to

  • 0

I have found several open-source/freeware programs that allow you to convert .doc files to .pdf files, but they’re all of the application/printer driver variety, with no SDK attached.

I have found several programs that do have an SDK allowing you to convert .doc files to .pdf files, but they’re all of the proprietary type, $2,000 a license or thereabouts.

Does anyone know of any clean, inexpensive (preferably free) programmatic solution to my problem, using C# or VB.NET?

Thanks!

  • 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. 2026-05-11T08:16:04+00:00Added an answer on May 11, 2026 at 8:16 am

    Use a foreach loop instead of a for loop – it solved my problem.

    int j = 0; foreach (Microsoft.Office.Interop.Word.Page p in pane.Pages) {     var bits = p.EnhMetaFileBits;     var target = path1 +j.ToString()+  '_image.doc';     try     {         using (var ms = new MemoryStream((byte[])(bits)))         {             var image = System.Drawing.Image.FromStream(ms);             var pngTarget = Path.ChangeExtension(target, 'png');             image.Save(pngTarget, System.Drawing.Imaging.ImageFormat.Png);         }     }     catch (System.Exception ex)     {         MessageBox.Show(ex.Message);       }     j++; } 

    Here is a modification of a program that worked for me. It uses Word 2007 with the Save As PDF add-in installed. It searches a directory for .doc files, opens them in Word and then saves them as a PDF. Note that you’ll need to add a reference to Microsoft.Office.Interop.Word to the solution.

    using Microsoft.Office.Interop.Word; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text;  ...  // Create a new Microsoft Word application object Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();  // C# doesn't have optional arguments so we'll need a dummy value object oMissing = System.Reflection.Missing.Value;  // Get list of Word files in specified directory DirectoryInfo dirInfo = new DirectoryInfo(@'\\server\folder'); FileInfo[] wordFiles = dirInfo.GetFiles('*.doc');  word.Visible = false; word.ScreenUpdating = false;  foreach (FileInfo wordFile in wordFiles) {     // Cast as Object for word Open method     Object filename = (Object)wordFile.FullName;      // Use the dummy value as a placeholder for optional arguments     Document doc = word.Documents.Open(ref filename, ref oMissing,         ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,         ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,         ref oMissing, ref oMissing, ref oMissing, ref oMissing);     doc.Activate();      object outputFileName = wordFile.FullName.Replace('.doc', '.pdf');     object fileFormat = WdSaveFormat.wdFormatPDF;      // Save document into PDF Format     doc.SaveAs(ref outputFileName,         ref fileFormat, ref oMissing, ref oMissing,         ref oMissing, ref oMissing, ref oMissing, ref oMissing,         ref oMissing, ref oMissing, ref oMissing, ref oMissing,         ref oMissing, ref oMissing, ref oMissing, ref oMissing);      // Close the Word document, but leave the Word application open.     // doc has to be cast to type _Document so that it will find the     // correct Close method.                     object saveChanges = WdSaveOptions.wdDoNotSaveChanges;     ((_Document)doc).Close(ref saveChanges, ref oMissing, ref oMissing);     doc = null; }  // word has to be cast to type _Application so that it will find // the correct Quit method. ((_Application)word).Quit(ref oMissing, ref oMissing, ref oMissing); word = null; 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 183k
  • Answers 183k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Essentially two things: Add the AllowPartiallyTrustedCallers attribute to the web… May 12, 2026 at 4:36 pm
  • Editorial Team
    Editorial Team added an answer Use collections.defaultdict, where the default value is a new list… May 12, 2026 at 4:36 pm
  • Editorial Team
    Editorial Team added an answer <?php in_array('13', explode(',', '8,7,13,14,16')); ?> …will return whether '13' is… May 12, 2026 at 4:36 pm

Related Questions

I've been digging through Stack Overflow as well as a number of Google searches,
I have several small open-source projects that I wrote. All my attempts to find
I have an open source Java application that uses Hibernate and HSQLDB for persistence.
I have written some code that makes use of an open source library to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.