|
1 |
| -# FusionFiles.Pdf |
2 |
| -Generate pdf files with Neos.Fusion |
| 1 | +# Kleisli.FusionFiles.Pdf |
| 2 | +*** |
| 3 | +Serve pdf files with Neos.Fusion using wkhtmltopdf |
| 4 | +*** |
| 5 | + |
| 6 | +## Requirements |
| 7 | +* [wkhtmltopdf](https://github.com/wkhtmltopdf/wkhtmltopdf) |
| 8 | + |
| 9 | +## Fusion Document |
| 10 | +To render a node `My.DocumentType` as pdf, create a fusion prototype `My.DocumentType.Pdf` that |
| 11 | +extends `Kleisli.FusionFiles:File.Pdf`. |
| 12 | + |
| 13 | +### Properties of `Kleisli.FusionFiles:File.Pdf` |
| 14 | +* `showAsHtml`, boolean, to debug the response, default = false |
| 15 | +* `disposition`, either 'inline' (default value, to display the pdf file in the brower) or 'attachment' (to download the pdf file directly) |
| 16 | +* `filename`, string, with disposition='attachment' this defines the filename of the file to be downlaoded |
| 17 | +* `cssRessourcePaths`, Neos.Fusion:DataStructure, the paths to the css files needed to render the html for the pdf |
| 18 | +* `htmlContent`, Neos.Fusion:DataStructure with fixed keys |
| 19 | + * `header`, string, the html code to be repeated on top of every page of the pdf document |
| 20 | + * `body`, string, the html code containing the content |
| 21 | + * `footer`, string, the html code to be repeated in the bottom of every page of the pdf document |
| 22 | + |
| 23 | +### Configuration |
| 24 | +``` |
| 25 | +Kleisli: |
| 26 | + FusionFiles: |
| 27 | + Pdf: |
| 28 | + pathToWkhtmltopdf: '/usr/local/bin/wkhtmltopdf' |
| 29 | +``` |
| 30 | + |
| 31 | +## Fusion Content |
| 32 | +Rendering a Document node as Pdf using `Neos.Neos:ContentCollection` displays the Content nodes |
| 33 | +with the same Markup as for the HTML web page. |
| 34 | + |
| 35 | +### pdf specific markup for content |
| 36 | +While the same markup might be fine for many content elements, there might also be elements (especially |
| 37 | +elements relying on javascript), that need a pdf specific markup. This can be achieved by just creating a |
| 38 | +prototype with appended `.Pdf`, e.g. to change markup for `My.ContentType` in the pdf, create `My.ContentType.Pdf` |
| 39 | + |
| 40 | +### hide content in pdf or render in pdf only |
| 41 | +To render content elements in pdf only and hide them in other formats, or skip them in the pdf document, create a node |
| 42 | +property `pdfVisibility` and set it to either 'hideInPdf' or 'pdfOnly'. |
| 43 | + |
| 44 | +Or add the mixin `Kleisli.FusionFiles.Pdf:Mixin.PdfVisibility` to the node type to be able to define visibility |
| 45 | +in the backend. |
| 46 | + |
| 47 | +## Kudos |
| 48 | +The development of this package has significantly been funded by [Profolio](https://www.profolio.ch/) - a digital platform for career choice & career counseling |
| 49 | + |
0 commit comments