---
title: "Preview Office As Pdf"
method: GET
path: "/api/files/{file_id}/preview-pdf"
tags: ["files", "files"]
---

# Preview Office As Pdf

`GET /api/files/{file_id}/preview-pdf`

## Request

- Base URL: `https://api.dialogbrain.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.dialogbrain.com/api/files/{file_id}/preview-pdf`
- Auth: none declared

Convert an Office file (PPTX/DOCX/XLSX/...) to PDF on demand for in-app preview.

The frontend FileViewer modal renders PDF in an iframe, but browsers can't
render Office Open XML formats natively. This endpoint shells out to
LibreOffice headless on the api-gateway pod, caches the converted PDF
per file_version, and streams it back so the same modal works for all
document types.

PDFs already pass through `/preview` unchanged — the frontend should only
hit this route when the source mime_type is in SUPPORTED_OFFICE_MIMES.

## Path parameters

- `file_id` integer, required

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/dialogbrain/apis/dialogbrain-v2-api-gateway.md) · [All operations](https://skmtc.dev/dialogbrain/apis/dialogbrain-v2-api-gateway/llms.txt) · [OpenAPI document](https://skmtc.dev/dialogbrain/apis/dialogbrain-v2-api-gateway/revisions/77bef09a9209?raw)
