# Showing a Downloadable PDF in Webhelp

When a PDF is present in the correct location with the correct name, a **Download PDF** button automatically appears in the **More Options** menu (the three-dot button in the top-right corner) on every page of the associated Webhelp publication.

This document explains the naming rule, how to configure your transformation scenario to output the PDF in the right place with the right name, and how the feature works.

---

## How the Feature Works

When any page in a Webhelp publication loads, the site checks whether a PDF file exists at the root of that publication's folder. It does this by:

1. Reading the current page's URL path.
2. Walking up the path until it finds a known Webhelp subdirectory (`topics`, `tasks`, `images`, etc.) — the folder above that is the **document root**.
3. Constructing an expected PDF URL: `/<document-root-path>/<folder-name>.pdf`
4. Sending a lightweight HEAD request to that URL.
5. If the file exists (HTTP 200), the **Download PDF** button appears in the menu and triggers a download when clicked. If not, the button remains hidden.

**The rule, stated simply:** the PDF must be named exactly the same as its parent folder and placed directly in that folder.

---

## Naming and Placement Rule

| | Example |
|---|---|
| Document folder | `\Expere\Authoring\AuthoringEnvironmentInstallation\` |
| Required PDF name | `AuthoringEnvironmentInstallation.pdf` |
| Full path on server | `\Expere\Authoring\AuthoringEnvironmentInstallation\AuthoringEnvironmentInstallation.pdf` |

The PDF name is **case-sensitive on some servers** — match the folder name exactly, including capitalization.

---

## Step 1 — Generate the PDF

Follow the full instructions in [PDF-Transformation_README.md](PDF-Transformation_README.md) to configure your DITA map metadata and run the **DITA Map PDF (XSL-FO) - WKFS 2026** transformation scenario in Oxygen XML Editor.

Come back here once the transformation completes successfully.

---

## Step 2 — Configure the Output Path in Your Scenario

By default, the transformation writes its output to `C:\DITA\transforms\out\<mapname>\`. To have the PDF land directly in the correct server folder, update the **Output** settings in your project-level scenario.

1. In Oxygen, open **DITA Maps > Configure Transformation Scenarios**.
2. Select your project-level copy of **DITA Map PDF (XSL-FO) - WKFS 2026** and click **Edit**.
3. Go to the **Output** tab.
4. Set the **Output folder** to the document root of the associated webhelp on the localhost server — this is the folder that also contains `index.html`. For example:

   ```
   C:\inetpub\wwwroot\Expere\Authoring\AuthoringEnvironmentInstallation
   ```

5. Set the **Output file** name to match the folder name exactly:

   ```
   AuthoringEnvironmentInstallation.pdf
   ```

6. Click **OK**, then **Apply Associated**.

> **Tip:** You can use the Oxygen variable `${cfn}` (current file name without extension) as the output file name if your `.ditamap` filename already matches the folder name — Oxygen will substitute the correct name automatically.

---

## Step 3 — Verify the Result

After the transformation, confirm:

1. The PDF exists at the document root alongside `index.html`:

   ```
   \AuthoringEnvironmentInstallation\
       index.html                          ← Webhelp publication root marker
       AuthoringEnvironmentInstallation.pdf  ← PDF (must match folder name)
       topics\
       images\
       ...
   ```

2. Open any page within that Webhelp publication in a browser and click the **More Options** button (⋮) in the top-right corner. The **Download PDF** item should appear in the menu.

3. Clicking **Download PDF** should immediately prompt the browser to download the file.

---

## Troubleshooting

| Symptom | Check |
|---|---|
| **Download PDF** button does not appear | 1) Refresh the browser using F5. 2) Confirm the PDF filename matches the folder name exactly (including case). Confirm the PDF is in the document root folder, not a subfolder. |
| Button appears but download fails | Confirm the web server has read permissions on the PDF file. |
| Button appears on the wrong publication | Ensure there is only one PDF in the document root. The feature picks up any `.pdf` file present — if the wrong one is there from a previous run, delete it. |
| Unsure which folder is the document root | It is the folder containing `index.html` — the same folder you publish your Webhelp output to. |
