Skip to content

Commit db12b73

Browse files
author
MarkBaker
committed
Update to ReadMe about PDF and Chart Export installation and configuration
1 parent c3f5385 commit db12b73

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,38 @@ to ensure that the correct dependencies are retrieved to match your deployment e
4949

5050
See [CLI vs Application run-time](https://php.watch/articles/composer-platform-check) for more details.
5151

52+
### Additional Installation Options
53+
54+
If you want to write to PDF, or to include Charts when you write to HTML or PDF, then you will need to install additional libraries:
55+
56+
#### PDF
57+
58+
For PDF Generation, you can install any of the following, and then configure PhpSpreadsheet to indicate which library you are going to use:
59+
- mpdf/mpdf
60+
- dompdf/dompdf
61+
- tecnickcom/tcpdf
62+
63+
and configure PhpSpreadsheet using:
64+
65+
```php
66+
// Dompdf, Mpdf or Tcpdf (as appropriate)
67+
$className = \PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf::class;
68+
IOFactory::registerWriter('Pdf', $className);
69+
```
70+
or the appropriate PDF Writer wrapper for the library that you have chosen to install.
71+
72+
#### Chart Export
73+
74+
For Chart export, we support, which you will also need to install yourself
75+
- jpgraph/jpgraph
76+
77+
and then configure PhpSpreadsheet using:
78+
```php
79+
Settings::setChartRenderer(\PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph::class);
80+
```
81+
82+
You can `composer/require` the github version of jpgraph, but this was abandoned at version 4.0; or manually download the latest version that supports PHP 8 and above from [jpgraph.net](https://jpgraph.net/)
83+
5284
## Documentation
5385

5486
Read more about it, including install instructions, in the [official documentation](https://phpspreadsheet.readthedocs.io). Or check out the [API documentation](https://phpoffice.github.io/PhpSpreadsheet).

0 commit comments

Comments
 (0)