This repository contains a simple PowerShell script designed to convert Microsoft Word documents (.doc or .docx) into PDF format. The script leverages Microsoft Word's COM object to automate the conversion process.
- Converts Word documents to PDF format.
- Batch conversion of multiple files in a specified directory.
- Minimal dependencies – only requires PowerShell and Microsoft Word installed on your system.
Before using this script, ensure you have:
- Microsoft Word installed on your computer. The script uses the Microsoft Word COM object to perform the conversion.
- PowerShell (typically pre-installed on Windows systems).
Clone the repository or download the script directly to your local machine:
git clone https://github.com/Saqqe/WordDocToPdf_PowerShellScript.gitNavigate to the folder where the script is located. For example:
cd C:\path\to\WordDocToPdf_PowerShellScriptThe script will ask for source and destination folders (script will create the destination folder if it does not exist)
Example:
PS E:\WordDocToPdf_PowerShellScript> .\docToPdf.ps1
Enter the path to the source folder containing Word documents: C:\Documents\TestingWordFiles
Enter the path to the destination folder for PDF files: C:\Documents\TestingWordFiles\pdfs[!CAUTION]
Ensure Execution Policy Allows Scripts: You may need to adjust PowerShell's execution policy if scripts are not allowed to run https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy?view=powershell-7.4
[!CAUTION]
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned