Skip to content

Latest commit

 

History

History
65 lines (40 loc) · 1.72 KB

File metadata and controls

65 lines (40 loc) · 1.72 KB

macOS Python License

.docx to .pdf Export Automation (Mac)

Automate the process of exporting Microsoft Word documents to PDF on macOS. This script exports the currently open Word document (including unsaved changes) to PDF, replacing the existing PDF file.

Problem Solved

Frequent small changes to Word documents and need to export them as PDFs. The manual process involves:

  • Press cmd+shift+s
  • Select PDF format
  • Click export
  • Click replace

This automation reduces it to a single keyboard shortcut or button click.

Features

  • Exports active Word document to PDF (even with unsaved changes)
  • Warns if no existing PDF exists (prevents accidental file creation)
  • Works with any Word document
  • Can be triggered via keyboard shortcut or Dock icon

Requirements

  • macOS
  • Microsoft Word for Mac
  • Python 3

Installation

  1. Clone this repository: git clone https://github.com/MusaOzcetin/export_replace.git

    cd export-replace-automation

  2. Make the script executable: chmod +x export_replace.py

  3. Update the script path in your setup (if different from default location)

Usage

Method 1: Run from Terminal

python3 export_replace.py

How It Works

The script uses AppleScript (via Python's subprocess) to:

  1. Get the currently active Word document
  2. Check if a PDF with the same name exists
  3. Export the document to PDF using Word's native export function
  4. Show a notification when complete

License

MIT License - feel free to use and modify as needed.

Author

Musa Ozcetin