## ADDED Requirements ### Requirement: Translated PDF Export API The system SHALL expose an API endpoint for downloading translated documents as PDF files. #### Scenario: Download translated PDF via API - **GIVEN** a task with completed translation to English - **WHEN** POST request to `/api/v2/translate/{task_id}/pdf?lang=en` - **THEN** system returns PDF file with translated content - **AND** Content-Type is `application/pdf` - **AND** Content-Disposition suggests filename like `{task_id}_translated_en.pdf` #### Scenario: Download translated PDF with layout preservation - **WHEN** user downloads translated PDF - **THEN** the PDF maintains original document layout - **AND** text positions match original document coordinates - **AND** images and tables appear at original positions #### Scenario: Invalid language parameter - **GIVEN** a task with translation only to English - **WHEN** user requests PDF with `lang=ja` (Japanese) - **THEN** system returns 404 Not Found - **AND** response includes available languages in error message #### Scenario: Task not found - **GIVEN** non-existent task_id - **WHEN** user requests translated PDF - **THEN** system returns 404 Not Found --- ### Requirement: Frontend Translated PDF Download The frontend SHALL provide UI controls for downloading translated PDFs. #### Scenario: Show download button when translation complete - **GIVEN** a task with translation status "completed" - **WHEN** user views TaskDetailPage - **THEN** page displays "Download Translated PDF" button - **AND** button shows target language (e.g., "Download Translated PDF (English)") #### Scenario: Hide download button when no translation - **GIVEN** a task without any completed translations - **WHEN** user views TaskDetailPage - **THEN** "Download Translated PDF" button is not shown #### Scenario: Download progress indication - **GIVEN** user clicks "Download Translated PDF" button - **WHEN** PDF generation is in progress - **THEN** button shows loading state - **AND** prevents double-click - **WHEN** download completes - **THEN** browser downloads PDF file - **AND** button returns to normal state