Logo
Home Products Support Contact About Us
arrow1 File Converters
arrow1 TIFF and PDF apps
arrow1 Forensic
arrow1 Freeware

Convert Word to PDF from the Command Line

 

Converting one Word document to PDF by hand is easy. Converting a shared folder of reports every night on a server, without anyone clicking a button, is a different job. Total Doc Converter X is the command-line edition built for exactly that: it turns DOC and DOCX files into PDF from a single command, so you can script the whole task and forget about it.

Quick answer: To convert Word to PDF from the command line, install Total Doc Converter X, then run its executable with the source path, the destination folder and the target format flag, for example DocConverterX.exe C:\Reports\*.docx C:\PDF\ -cPDF. Add the command to a .bat file or a scheduled task and the whole folder converts in an unattended batch on your server.

How do I convert Word to PDF from the command line?

The conversion is a single action: you send one command to the converter. It reads the source files, applies the settings you passed, and writes the PDFs. Below is a working example that takes every DOCX file in a folder and writes each one to a matching PDF:

DocConverterX.exe C:\Reports\*.docx C:\PDF\ -cPDF -Log C:\PDF\log.txt

The parameters sit at the end of the line, after the source mask, the destination folder and the target format. Swap -cPDF for another format, add page and font options, or point the source mask at *.doc to catch older files too. To merge every document into one PDF instead of separate files, add the combine flag:

DocConverterX.exe C:\Reports\*.docx C:\PDF\Monthly.pdf -cPDF -combine

  • Convert an entire folder of DOC and DOCX files with one command
  • Set paper size, font and margins right in the command line
  • Combine all documents into one PDF or write each to its own file
  • Encrypt and digitally sign the PDFs for secure distribution
  • Run silently with no window, no dialogs and no user input

How do I run it unattended on a server?

Put the command in a .bat file and point Windows Task Scheduler at it to run overnight or every hour. One installed copy on a local server can serve every user on your network, since the work happens on the server, not on each workstation. If you want files converted the moment they land in a folder, pair Total Doc Converter X with Total Folder Monitor to trigger the batch automatically. Prefer clicking to scripting? The GUI Word to PDF converter covers the same job with a visual interface.

Need to be sure your DOCX files carry over cleanly, including tables and embedded images? See the dedicated DOCX to PDF page for format details before you script the batch.

Total Doc Converter X installs quickly and runs on Windows 7, 8, 10 and 11. The 30-day trial is fully functional and needs no email or credit card, so you can test a real batch on your own files first.

Every option you would set in a graphic interface is available as a command-line parameter, so nothing is lost by going scriptless. The full parameter list is in the program Help.

Download the server Word converter and turn Word to PDF conversion into a background task that just runs.

Word to PDF Command Line — FAQ

How do I convert Word to PDF from the command line?

Install Total Doc Converter X and call its executable with three parts: the source mask, the destination folder and the target format flag. For example, DocConverterX.exe C:\Reports\*.docx C:\PDF\ -cPDF converts every DOCX file in the folder to PDF in one pass.

Can I convert Word to PDF in batch?

Yes. Total Doc Converter X is built for batch work. A single command with a wildcard mask such as *.docx or *.doc processes every matching file in the folder, so you never repeat steps for individual documents.

Can I run the conversion silently without any window?

Yes. Total Doc Converter X runs with no GUI and no dialogs, which is exactly what a server or scheduled task needs. Put the command in a .bat file and it converts in the background with no user input.

How do I schedule automatic Word to PDF conversion?

Save your command in a .bat file and add it to Windows Task Scheduler to run at set times. To convert files the moment they appear in a folder, combine Total Doc Converter X with Total Folder Monitor, which watches the folder and fires the batch for you.

Can I combine several Word files into one PDF?

Yes. Add the combine flag and give a single PDF file as the destination, for example DocConverterX.exe C:\Reports\*.docx C:\PDF\Monthly.pdf -cPDF -combine. Without that flag each Word file becomes its own PDF.

Does the command line keep formatting, fonts and images?

Yes. Total Doc Converter X preserves the layout, fonts, tables and embedded images of your DOC and DOCX files. You can also set paper size, margins and font options directly in the command.

Is Total Doc Converter X free?

Total Doc Converter X offers a fully functional 30-day trial with no email or credit card required. A personal license starts at 49.90 USD and unlocks unlimited use on your server after the trial.

 

Start working now!

Download free trial and convert your files in minutes.
No credit card or email required.

⬇ Download Free Trial Windows 7/8/10/11 • 152 MB

Examples of Total Doc Converter X

Convert Doc files with Total Doc Converter X and .NET


string src  = @"C:\test\Source.docx";
string dest = @"C:\test\Dest.pdf";

var cnv = new DocConverterX();
cnv.Convert(src, dest, "-cPDF -log c:\\test\\Doc.log");

if (!string.IsNullOrEmpty(cnv.ErrorMessage))
    throw new Exception(cnv.ErrorMessage);

Convert Doc files on web servers with Total Doc Converter X

public static class Function1
    {
        [FunctionName("Function1")]
        public static async Task Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
            ILogger log)
        {
            StringBuilder sbLogs = new StringBuilder();
            sbLogs.AppendLine("started...");
            try
            {
                ProcessStartInfo startInfo = new ProcessStartInfo();
                startInfo.CreateNoWindow = true;
                startInfo.UseShellExecute = false;
                var assemblyDirectoryPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                assemblyDirectoryPath = assemblyDirectoryPath.Substring(0, assemblyDirectoryPath.Length - 4);

                var executablePath = $@"{assemblyDirectoryPath}\Converter\DocConverterX.exe";
                sbLogs.AppendLine(executablePath + "...");
                var srcPath = $@"{assemblyDirectoryPath}\src\sample.docx";
                var outPath = Path.GetTempFileName() + ".pdf";
                startInfo.FileName = executablePath;

                if (File.Exists(outPath))
                {
                    File.Delete(outPath);
                }

                if (File.Exists(executablePath) && File.Exists(srcPath))
                {
                    sbLogs.AppendLine("files exists...");
                }
                else
                    sbLogs.AppendLine("EXE & source files NOT exists...");
                startInfo.WindowStyle = ProcessWindowStyle.Hidden;
                startInfo.Arguments = $"\"{srcPath}\" \"{outPath}\" -cPDF";
                using (Process exeProcess = Process.Start(startInfo))
                {
                    sbLogs.AppendLine($"wait...{DateTime.Now.ToString()}");
                    exeProcess.WaitForExit();
                    sbLogs.AppendLine($"complete...{DateTime.Now.ToString()}");
                }
                sbLogs.AppendLine("Conversion complete.");
            }
            catch (Exception ex)
            {
                sbLogs.AppendLine(ex.ToString());
            }

            return new OkObjectResult(sbLogs);
        }
    }
More information about Azure Functions.

Convert Doc files on web servers with Total Doc Converter X

dim C
Set C=CreateObject("DocConverter.DocConverterX")
C.Convert "c:\source.docx", "c:\dest.pdf", "-cPDF -log c:\doc.log"
Response.Write C.ErrorMessage
set C = nothing

Stream the resulting PDF directly from ASP

dim C
Set C=CreateObject("DocConverter.DocConverterX")
Response.Clear
Response.AddHeader "Content-Type", "binary/octet-stream"
Response.AddHeader "Content-Disposition", "attachment; filename=test.pdf"
Response.BinaryWrite C.ConvertToStream("C:\www\ASP\Source.docx", "C:\www\ASP", "-cpdf -log c:\doc.log")
set C = nothing

Convert Doc files with PHP and Total Doc Converter X

$src="C:\\test\\test.docx";
$dest="C:\\test\\test.pdf";
if (file_exists($dest)) unlink($dest);
$c= new COM("DocConverter.DocConverterX");
$c->convert($src,$dest, "-cPDF -log c:\\test\\Doc.log");
if (file_exists($dest)) echo "OK"; else echo "fail:".$c->ErrorMessage;

Convert Doc files with Total Doc Converter X and Ruby

require 'win32ole'
c = WIN32OLE.new('DocConverter.DocConverterX')

src = "C:\\test\\test.docx"
dest = "C:\\test\\test.pdf"

c.convert(src, dest, "-cPDF -log c:\\test\\Doc.log")

if not File.exist?(dest)
  puts c.ErrorMessage
end

Convert Doc files with Total Doc Converter X and Python

import win32com.client
import os.path

c = win32com.client.Dispatch("DocConverter.DocConverterX")

src  = "C:\\test\\test.docx"
dest = "C:\\test\\test.pdf"

c.convert(src, dest, "-cPDF -log c:\\test\\Doc.log")

if not os.path.exists(dest):
    print(c.ErrorMessage)

Convert Doc files with Pascal and Total Doc Converter X

uses Dialogs, Vcl.OleAuto;

var
  c: OleVariant;
begin
  c := CreateOleObject('DocConverter.DocConverterX');
  c.Convert('c:\test\source.docx', 'c:\test\dest.pdf', '-cPDF -log c:\test\Doc.log');
  if c.ErrorMessage <> '' then
    ShowMessage(c.ErrorMessage);
end;

Convert Doc files on web servers with Total Doc Converter X

var c = new ActiveXObject("DocConverter.DocConverterX");
c.Convert("C:\\test\\source.docx", "C:\\test\\dest.pdf", "-cPDF");
if (c.ErrorMessage != "")
  alert(c.ErrorMessage)

Convert Doc files with Total Doc Converter X and Perl

use Win32::OLE;

my $src  = "C:\\test\\test.docx";
my $dest = "C:\\test\\test.pdf";

my $c = CreateObject Win32::OLE 'DocConverter.DocConverterX';
$c->convert($src, $dest, "-cPDF -log c:\\test\\Doc.log");
print $c->ErrorMessage if -e $dest;

Support
Total Doc Converter X Preview1

Latest News

Newsletter Subscribe

No worries, we don't spam.


© 2026. All rights reserved. CoolUtils File Converters

Cards