# Epic OP-11832 - Generate PDF document from a work package description 

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-11832

## Detailed specification

### Motivation and background information

### Acceptance criteria

### Out of scope

| Attribute | Value |
| --- | --- |
| Mockups |  |

## Planning

| Attribute | Value |
| --- | --- |
| Roadmap |  |
| Date |  |
| Votes |  |
| List |  |
| Target versions | 15.4.0 |
| Sprint | 15.4.0 |
| Backlog bucket |  |
| Relevance |  |

## Subitems

| ID | Type | Subject | Status | Assignee | Target versions | Project | Priority | Spent time |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| OP-11084 | Feature | Work package PDF export: Insert page breaks | closed |  | 15.1.0 | OpenProject | Medium |  |
| OP-16430 | Feature | Consolidate "Download PDF" feature with the "Generate PDF" feature in one export modal | closed |  | 15.4.0 | OpenProject | Medium |  |
| OP-15554 | Open Point | How will this feature be impacted by future decisions on the WYSIWYG functionality | resolved |  |  | OpenProject | Medium |  |

## Bugs and other work packages

| ID | Type | Subject | Status | Assignee | Target versions | Module |
| --- | --- | --- | --- | --- | --- | --- |
| OP-16394 | Bug | Hyphenation feature in generated pdf files removes space before italic text | closed |  | 15.3.0 |  |
| OP-16175 | Bug | Table formatting is not reflected in the PDF export | closed |  | 15.3.0 |  |
| OP-16174 | Bug | Changing an image size is not reflected in the export | closed |  | 15.3.0 |  |
| OP-15554 | Open Point | How will this feature be impacted by future decisions on the WYSIWYG functionality | resolved |  |  |  |

## Details

| Attribute | Value |
| --- | --- |
| Module |  |
| Enterprise plan |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable | Andrej Sandorf |
| Product manager |  |
| Feature Lead |  |
| Designer |  |
| Developers | Andrej Sandorf |
| Requested by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| Work |  |

## Description

**As an** OpenProject employee

**I want to** trigger the pdf creation from markdown files directly inside OpenProject

**so that** I don't have to install all the mechanism on my local machine.

**Acceptance criteria**

  - No local installation of Ruby and the export gem required.

  - The .md-content is taken from the description.

  - Text macros are rendered in the pdf export, e.g.:
    
      - `workPackageValue:45896:updateAt` ->  03/26/2026 03:56 PM
    
      - `workPackageValue:45896:author` ->  Niels Lindenthal
    
      - `workPackageValue:45896:status`->  closed

  - The export is triggered by the more menu.

  - Feature flag `generate_pdf_from_work_package` so we can test it on community before we have the UX polished

  - The logo is taken from the Administration (like for the PDF reports).

  - A user can add page breaks for the PDF generation (CKEditor: <https://github.com/opf/commonmark-ckeditor-build/pull/93>)

  - Existing font is used

  - Allow empty lines in rich text  *<mention class="mention" data-id="56779" data-type="work_package" data-text="#56779">\#56779</mention>*

  - Allow user defined page breaks <mention class="mention" data-id="44047" data-type="work_package" data-text="#44047">\#44047</mention>

  - Dialog <mention class="mention" data-id="60562" data-type="work_package" data-text="#60562">\#60562</mention> 

**Later - Out of Scope**

  - Trigger the PDF generation from a custom action button.
    
      - More configuration option to activate a styling (YAML) for a work package type.
    
      - Enable/disable the feature per project.

  - Save the created PDF file directly in Nextcloud

  - Use a user-defined font (uploading to the dialog and/or settings)

  - Use a user-defined styling (selecting in the dialog and uploading/editing in the settings)

  - Use a user-defined logo (uploading to the dialog and/or settings)

  - Support rich text content embedding macros on the root level of the document

**Open Points**

  - **Fonts**  
    Statically added font „OpenSans“ (Apache License) which we use in PDFs to the OpenProject source code  
    Do we want to offer font uploading or just include a few fonts?  
    Uploading must be aware that fonts consist of and need several files to work properly (e.g. `OpenSans-Bold.ttf OpenSans-BoldItalic.ttf OpenSans-Italic.ttf OpenSans-Regular.ttf`), so only a complete uploaded font cut set can be used.  
    *MVP: Switch to existing fonts that we use for the other exports*

  - **Rich text vs Markdown**  
    Different uses case for the rich text in a WP description:  
    Blank lines for (mini-) formatting are removed by OP rich text optimization  
    If you want to influence whitespace (e.g. on the front page of a contract),  
    CKEditor and/or our html pipeline prevent it. This is a **potential severe change** that may not only affect the PDF generation.  
    MVP: <mention class="mention" data-id="56779" data-type="work_package" data-text="#56779">\#56779</mention>

  - **PDF specific rich text elements**  
    Support for page breaks in CKEditor and md-to-pdf  
    MVP: <mention class="mention" data-id="44047" data-type="work_package" data-text="#44047">\#44047</mention>

  - **Logo**  
    Header logo image is quite inflexible, as must be changed globally if it should be different between generation, eg. a combined logo file of a contract between two companies. If it is changed at the same time another user generates a PDF, their resulting docs are effected, too.  
    *MVP: we use the existing logo. Later: we upload dedicated logos.*

  - **Styles**  
    How to present the admin users the styles configuration.   
    A plain YAML editor?   
    Edit the style values with form components (e.g. combo box/selects)?  
    Edit the YAML file locally and upload?  
    *MVP: hard-coded standard styles (one size fits all).*

  - **Dialog**  
    Possible direct config the dialog could contain:
    
      - Page size (select element): list of page sizes, eg. US LETTER, DIN A4
    
      - Document language (select element): list of supported languages for hyphenation
    
      - Hyphenation (checkbox): enable/disable hyphenation
    
      - Custom page header/page footer text
    
      - One time-Logo upload (upload input): just for one usage in the current generation
    
      - Styles (select element):  list of stores styled. eg. "contract", ...
    
    *MVP: generate modal similar to export modal*

  - **Macros**  
    We currently do not support embedding of long text fields nor descriptions of other WPs. in the PDF generation eg. `workpackageValue:xyz:description`, that could be allowed for all easy cases (eg. not in a table cell, but on document root level)  
    *MVP: we do not support long-text fields. Later we allow long text fields on "root level".*
