Content
Updated by Andrej Sandorf 1 day ago
**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` -> workPackageValue:45896:updatedAt
* `workPackageValue:45896:author` -> workPackageValue:45896:author
* `workPackageValue:45896:status`\-> workPackageValue:45896:status
* 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
* Select: Hyphenation language (all which are supported by the pdf library)
* Select: Paper size
* Text Input: Footer center text, default: work package subject
* Text input: Header right text, default: work package type - work package id
**Later - Out of Scope**
**Follow up work package at** <mention class="mention" data-id="59513" data-type="work_package" data-text="#59513"><strong>#59513</strong></mention>
* 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"._
**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` -> workPackageValue:45896:updatedAt
* `workPackageValue:45896:author` -> workPackageValue:45896:author
* `workPackageValue:45896:status`\-> workPackageValue:45896:status
* 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
* Select: Hyphenation language (all which are supported by the pdf library)
* Select: Paper size
* Text Input: Footer center text, default: work package subject
* Text input: Header right text, default: work package type - work package id
**Later - Out of Scope**
**Follow up work package at** <mention class="mention" data-id="59513" data-type="work_package" data-text="#59513"><strong>#59513</strong></mention>
* 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"._