Batch convert Word documents to PDFs

This might be pushing it into stackoverflow.com territory, but you could script Word 2007 to open and save a document as PDF. This requires Office 2007 and the "Save as PDF" plug-in from Microsoft.

Save this to a file SaveAsPDF.js and run it from the command line using cscript.exe //nologo SaveAsPDF.js SomeFolder\MyDocToConvert.doc:

var fso = new ActiveXObject("Scripting.FileSystemObject");
var docPath = WScript.Arguments(0);
docPath = fso.GetAbsolutePathName(docPath);

var pdfPath = docPath.replace(/\.doc[^.]*$/, ".pdf");
var objWord = null;

try
{
    WScript.Echo("Saving '" + docPath + "' as '" + pdfPath + "'...");

    objWord = new ActiveXObject("Word.Application");
    objWord.Visible = false;

    var objDoc = objWord.Documents.Open(docPath);

    var wdFormatPdf = 17;
    objDoc.SaveAs(pdfPath, wdFormatPdf);
    objDoc.Close();

    WScript.Echo("Done.");
}
finally
{
    if (objWord != null)
    {
        objWord.Quit();
    }
}

This is how I would do it:

  1. Download CutePDF writer
  2. Set the writer as your default printer (you can change it back later)
  3. Place all your .doc files in the same folder
  4. Highlight all the files, right-click, Print

Only downside is that you have to click Ok once for each file.


well, cutepdf & pdf99 do their job well, but i find PDFcreator more appealing as it 'print's in higher quality than the other two, it also has more configuration option, plus it's open-source.