@@ -739,37 +739,44 @@ regarding to styling cells, number formatting, ...
739739### \P hpOffice\P hpSpreadsheet\W riter\P df
740740
741741PhpSpreadsheet’s PDF Writer is a wrapper for a 3rd-Party PDF Rendering
742- library such as tcPDF , mPDF or DomPDF . You must now install a PDF
742+ library such as TCPDF , mPDF or Dompdf . You must now install a PDF
743743rendering library yourself; but PhpSpreadsheet will work with a number
744744of different libraries.
745745
746746Currently, the following libraries are supported:
747747
748748Library | Downloadable from | PhpSpreadsheet writer
749749-------- |-------------------------------------|----------------------
750- tcPDF | https://github.com/tecnickcom/tcpdf | TcPdf
751- mPDF | https://github.com/mpdf/mpdf | MPDF
752- domPDF | https://github.com/dompdf/dompdf | DomPDF
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 via `IOFactory` to generate PDF output ,
761- you will need to indicate which writer you are using:
760+ You can instantiate a writer with its specific name, like so:
762761
763762``` php
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');
763+ $writer = \P hpOffice\P hpSpreadsheet\I OFactory::createWriter($spreadsheet, 'Mpdf');
764+ ```
765+
766+ Or you can register which writer you are using with a more generic name,
767+ so you don't need to remember which library you chose, only that you want
768+ to write PDF files:
769+
770+ ``` php
771+ $class = \P hpOffice\P hpSpreadsheet\W riter\P df\M pdf::class;
772+ \P hpOffice\P hpSpreadsheet\I OFactory::registerWriter('Pdf', $class);
773+ $writer = \P hpOffice\P hpSpreadsheet\I OFactory::createWriter($spreadsheet, 'Pdf');
767774```
768775
769776Or you can instantiate directly the writer of your choice like so:
770777
771778``` php
772- $writer = \P hpOffice\P hpSpreadsheet\W riter\P df\M PDF ($spreadsheet);
779+ $writer = \P hpOffice\P hpSpreadsheet\W riter\P df\M pdf ($spreadsheet);
773780```
774781
775782#### Writing a spreadsheet
@@ -778,7 +785,7 @@ Once you have identified the Renderer that you wish to use for PDF
778785generation, you can write a .pdf file using the following code :
779786
780787``` php
781- $writer = new \P hpOffice\P hpSpreadsheet\W riter\P df\M PDF ($spreadsheet);
788+ $writer = new \P hpOffice\P hpSpreadsheet\W riter\P df\M pdf ($spreadsheet);
782789$writer- > save("05featuredemo.pdf");
783790```
784791
@@ -810,7 +817,7 @@ This can be slow on large spreadsheets, and maybe even unwanted. You can
810817however disable formula pre-calculation :
811818
812819``` php
813- $writer = new \P hpOffice\P hpSpreadsheet\W riter\P df\M PDF ($spreadsheet);
820+ $writer = new \P hpOffice\P hpSpreadsheet\W riter\P df\M pdf ($spreadsheet);
814821$writer- > setPreCalculateFormulas(false);
815822
816823$writer- > save("05featuredemo.pdf");
0 commit comments