@@ -745,24 +745,31 @@ of different libraries.
745745
746746Currently, the following libraries are supported:
747747
748- Library | Downloadable from | PhpSpreadsheet Internal Constant
749- -------- |-------------------------------------|---------------------------------
750- tcPDF | https://github.com/tecnickcom/tcpdf | PDF_RENDERER_TCPDF
751- mPDF | https://github.com/mpdf/mpdf | PDF_RENDERER_MPDF
752- domPDF | https://github.com/dompdf/dompdf | PDF_RENDERER_DOMPDF
748+ Library | Downloadable from | PhpSpreadsheet writer
749+ -------- |-------------------------------------|----------------------
750+ tcPDF | https://github.com/tecnickcom/tcpdf | TcPdf
751+ mPDF | https://github.com/mpdf/mpdf | MPDF
752+ domPDF | https://github.com/dompdf/dompdf | DomPDF
753753
754754The different libraries have different strengths and weaknesses. Some
755755generate better formatted output than others, some are faster or use
756756less memory than others, while some generate smaller .pdf files. It is
757757the developers choice which one they wish to use , appropriate to their
758758own circumstances.
759759
760- Before instantiating a Writer to generate PDF output , you will need to
761- indicate which Rendering library you are using.
760+ Before instantiating a Writer via `IOFactory` to generate PDF output ,
761+ you will need to indicate which writer you are using:
762762
763763``` php
764- $rendererName = \P hpOffice\P hpSpreadsheet\S ettings::PDF_RENDERER_MPDF;
765- \P hpOffice\P hpSpreadsheet\S ettings::setPdfRendererName($rendererName);
764+ $rendererName = \P hpOffice\P hpSpreadsheet\W riter\P df\M PDF::class;
765+ \P hpOffice\P hpSpreadsheet\S ettings::setDefaultPdfWriter($rendererName);
766+ $writer = \P hpOffice\P hpSpreadsheet\I OFactory\I OFactory::createWriter($spreadsheet, 'Pdf');
767+ ```
768+
769+ Or you can instantiate directly the writer of your choice like so:
770+
771+ ``` php
772+ $writer = \P hpOffice\P hpSpreadsheet\W riter\P df\M PDF($spreadsheet);
766773```
767774
768775#### Writing a spreadsheet
@@ -771,11 +778,11 @@ Once you have identified the Renderer that you wish to use for PDF
771778generation, you can write a .pdf file using the following code :
772779
773780``` php
774- $writer = new \P hpOffice\P hpSpreadsheet\W riter\P df($spreadsheet);
781+ $writer = new \P hpOffice\P hpSpreadsheet\W riter\P df\M PDF ($spreadsheet);
775782$writer- > save("05featuredemo.pdf");
776783```
777784
778- Please note that \P hpOffice\P hpSpreadsheet\W riter\P df only outputs the
785+ Please note that ` \P hpOffice\P hpSpreadsheet\W riter\P df` only outputs the
779786first worksheet by default.
780787
781788#### Write all worksheets
@@ -803,7 +810,7 @@ This can be slow on large spreadsheets, and maybe even unwanted. You can
803810however disable formula pre-calculation :
804811
805812``` php
806- $writer = new \P hpOffice\P hpSpreadsheet\W riter\P df($spreadsheet);
813+ $writer = new \P hpOffice\P hpSpreadsheet\W riter\P df\M PDF ($spreadsheet);
807814$writer- > setPreCalculateFormulas(false);
808815
809816$writer- > save("05featuredemo.pdf");
0 commit comments