# PDF-Decrypt

**Version 1.2.0**

A small, fully portable Windows tool that removes password protection from
encrypted PDF files. Drag one or more encrypted PDFs onto `PDF-Decrypt.exe`
(or the Desktop shortcut created by `Install.exe`), enter the password, and an
unencrypted copy is saved next to each original. The original file is always
kept.

The user interface is **bilingual**: German when the Windows display language is
German, English otherwise. No Python knowledge, no installation required on the
patient's side — just the Desktop shortcut created by `Install.exe`.

---

## Companion to PDF-Encrypt

PDF-Decrypt is the decryption counterpart to **PDF-Encrypt** and shares its
visual design: the same teal (#008080) header, gold (#f2b705) rule, and bundled
Montserrat font. Any PDF encrypted with PDF-Encrypt can be opened here using the
same password.

---

## For Thomas: one-time build

You need an internet connection for the build only. No Python has to be installed
on your machine — `build.bat` fetches its own portable runtime (~21 MB download,
~65 MB on disk). The C# compiler is part of the .NET Framework that ships with
Windows, and `tar.exe` is in-box on Windows 10 1803+.

**Steps:**

1. Copy `icon.ico` from the PDF-Encrypt folder into this folder (if not already
   present — it is shared between the two apps).
2. Open this `PDF-Decrypt` folder.
3. Double-click **`build.bat`** and choose **[1] Build / rebuild**.
4. When it finishes, test it: drag an encrypted PDF onto `PDF-Decrypt.exe` and
   verify a decrypted copy appears.
5. **Zip the entire `PDF-Decrypt` folder** and send it to patients (via
   website download, WeTransfer, etc.).

> Rebuilding after a code edit: run `build.bat` → option 1 again — it reuses the
> existing runtime. Use `build.bat fresh` for a clean Python.

---

## For patients: installation (one-time, ~30 seconds)

1. **Download** the `PDF-Decrypt.zip` file (link or attachment from your
   therapist).
2. **Unzip** it anywhere — for example, your Downloads folder.
3. Open the `PDF-Decrypt` folder and **double-click `Install.exe`**.
4. Click **Install**. No administrator password is required.
5. A **PDF-Decrypt icon appears on your Desktop**. The original zip can now be
   deleted.

---

## For patients: everyday use

1. **Drag** your encrypted PDF invoice onto the **PDF-Decrypt icon** on your
   Desktop. (Or **double-click the icon** and click **Select PDF file** to pick
   one.)
2. **Enter the password** (provided by your therapist) and click **Open**. If
   the password is wrong, the dialog stays open so you can try again.
3. A decrypted copy named `…_decrypted.pdf` appears in the same folder as the
   original. The original encrypted file is kept.
4. Submit the `…_decrypted.pdf` to your insurance company.

---

## How it behaves

- **Supported input:** encrypted PDF files (`.pdf`). Nothing else is accepted.
- **Password:** entered once per file or once for the whole batch — no
  confirmation required (unlike encryption, where double-entry prevents typos).
- **Multiple files:** when several PDFs are dropped at once, you can choose
  one password for all or a separate password for each.
- **Opening without dragging:** double-clicking the icon (or launching the app
  with no files) opens a file picker so a PDF can be chosen directly.
- **Output file:** named `<original-name>_decrypted.pdf` (English UI) or
  `<original-name>_entschlüsselt.pdf` (German UI), saved next to the original.
  If that name is already taken, ` (2)`, ` (3)`, … is appended.
- **Read-only folder:** if the original's folder can't be written to (for
  example, a file opened straight from an email preview), the decrypted copy is
  saved to the Desktop (or Documents) instead, and the summary says where.
- **Original is kept.** PDF-Decrypt never modifies or deletes the source file.
- **Not encrypted:** if a file has no password protection, it is skipped and
  reported in the summary.
- **Wrong password:** the password dialog stays open and shows a short note so
  it can be corrected without re-dragging the file.
- **Nothing is written to disk** other than the decrypted PDFs themselves.

---

## What's in the folder

```
PDF-Decrypt\
├── Install.exe          (installer — double-click to install; creates Desktop shortcut)
├── PDF-Decrypt.exe      (launcher — drag files onto it directly, without installing)
├── PDFDecrypt.cs        (thin launcher source)
├── Installer.cs         (installer source)
├── app\
│   ├── ui.py            (branded Tkinter interface)
│   ├── decrypt.py       (headless worker: password removal)
│   └── fonts\           (Montserrat Regular/Medium/SemiBold, SIL OFL)
├── runtime\             (created by build.bat — portable Python + libs + Tk)
│   └── RUNTIME.txt      (records which portable Python build is installed)
├── icon.ico             (app icon — copy from PDF-Encrypt before building)
├── build.bat            (build / update / fresh)
└── README.md
```
