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.
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
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.
"Our dispatch software drops signed DOCX delivery notes into a shared folder all day, and legal wanted them archived as PDF. I wrote one .bat line with Total Doc Converter X and scheduled it hourly. It runs on the server with no window and no babysitting, and the folder empties into clean PDFs every hour without anyone touching it."
Dmitri Volkov Systems Administrator, Meridian Logistics
"We generate hundreds of Word specs per project and needed them merged into a single signed PDF per client. The combine flag plus the digital signature option did both in one command. What used to be an afternoon of opening and printing is now a scheduled task I never think about."
Priya Raghavan Documentation Lead, Halcyon Engineering
"One installed copy on our file server converts Word to PDF for the whole office over the network, which saved us buying seats per workstation. Getting the paper-size and margin parameters right took a read through the Help, but once the .bat was set it has run reliably for months."
Marcus Feldmann IT Coordinator, Nordbau Group
Download free trial and convert your files in minutes.
No credit card or email required.
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);
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);
}
}
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
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
$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;
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
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)
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;
var c = new ActiveXObject("DocConverter.DocConverterX");
c.Convert("C:\\test\\source.docx", "C:\\test\\dest.pdf", "-cPDF");
if (c.ErrorMessage != "")
alert(c.ErrorMessage)
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;