Content
View differences
Updated by Andrej Sandorf over 1 year 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**
* [x] No local installation of Ruby and the export gem required.
* [x] The .md-content is taken from description.
* [x] 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 so we can test it on community before we have the UX polished
* [x] The logo is taken from the Administration (like for the PDF reports).
* [ ] A user can add page breaks for the PDF generation
**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
**Open Points**
* [x] **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_
* [x] **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>_
##56779_
* [ ] **PDF specific rich text elements**
~~Special „forced page break in PDF“ tags are removed by OP rich text optimization~~
~~In our legal repo we used a custom html tag, but currently that does not work with CKEditor. CKEditor supports a~~ [~~page break~~](https://ckeditor.com/docs/ckeditor5/latest/features/page-break.html) ~~of sort in their internal format, we may extend it so the page break is translated into a custom html tag in markdown.~~
~~Again, OP rich text optimization has to be changed, too.~~ Support for page breaks in CKEditor and md-to-pdf is possible, remaining question is where in the toolbar the button should be displayed
* [x] **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._
* [x] **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
* Styles (select element): list of stores styled. eg. "contract", ...
* Document language (select element): list of supported languages for hyphenation
* Hyphenation (checkbox): enable/disable hyphenation
* One time-Logo upload (upload input): just for one usage in the current generation
* Custom page header/page footer text
This dialog is a closely related dialog to <mention class="mention" data-id="48274" data-type="work_package" data-text="#48274">#48274</mention> and could share the "in progress" part (spinner, result display)
_MVP: generate modal similar to export modal_
* [x] **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**
* [x] No local installation of Ruby and the export gem required.
* `workPackageValue:45896:author` -> workPackageValue:45896:author
* `workPackageValue:45896:status`\-> workPackageValue:45896:status
* [ ] The export is triggered by the more menu.
* 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
**Open Points**
* [x] **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_
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>_
~~Special „forced page break in PDF“ tags are removed by OP rich text optimization~~
~~In our legal repo we used a custom html tag, but currently that does not work with CKEditor. CKEditor supports a~~ [~~page break~~](https://ckeditor.com/docs/ckeditor5/latest/features/page-break.html) ~~of sort in their internal format, we may extend it so the page break is translated into a custom html tag in markdown.~~
~~Again, OP rich text optimization has to be changed, too.~~ Support for page breaks in CKEditor and md-to-pdf is possible, remaining question is where in the toolbar the button should be displayed
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._
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)._
Possible direct config the dialog could contain:
* Page size (select element): list of page sizes, eg. US LETTER, DIN A4
* Styles (select element): list of stores styled. eg. "contract", ...
* Document language (select element): list of supported languages for hyphenation
* Hyphenation (checkbox): enable/disable hyphenation
* One time-Logo upload (upload input): just for one usage in the current generation
* Custom page header/page footer text
This dialog is a closely related dialog to <mention class="mention" data-id="48274" data-type="work_package" data-text="#48274">#48274</mention> and could share the "in progress" part (spinner, result display)
_MVP: generate modal similar to export modal_
* [x] **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"._