Last change
on this file was 347, checked in by roby, 4 years ago |
Aggiornamento per compatibilità con php7.4
|
File size:
1.7 KB
|
Rev | Line | |
---|
[347] | 1 | # Output
|
---|
| 2 |
|
---|
| 3 | [back](./README.md)
|
---|
| 4 |
|
---|
| 5 | The main method to use is `output`.
|
---|
| 6 |
|
---|
| 7 | It takes two not required parameters.
|
---|
| 8 |
|
---|
| 9 | ## Parameters
|
---|
| 10 |
|
---|
| 11 | Parameter| Default | Description
|
---|
| 12 | ---------|---------|-------------
|
---|
| 13 | $name | document.pdf | The name of the file when saved. Note that special characters are removed and blanks characters are replaced with the underscore character.
|
---|
| 14 | $dest | I | Destination where to send the document. It can take one of the following values:<ul><li>I: send the file inline to the browser (default). The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.</li><li>D: send to the browser and force a file download with the name given by name.</li><li>F: save to a local server file with the name given by name.</li><li>S: return the document as a string (name is ignored).</li><li>FI: equivalent to F + I option</li><li>FD: equivalent to F + D option</li><li>E: return the document as base64 mime multi-part email attachment (RFC 2045)</li></ul>
|
---|
| 15 |
|
---|
| 16 | ## Examples
|
---|
| 17 |
|
---|
| 18 | ### Send PDF to browser without specifying a name
|
---|
| 19 |
|
---|
| 20 | ```php
|
---|
| 21 | $html2pdf->output();
|
---|
| 22 | ```
|
---|
| 23 |
|
---|
| 24 | ### Send the PDF document in browser with a specific name
|
---|
| 25 |
|
---|
| 26 | ```php
|
---|
| 27 | $html2pdf->output('my_doc.pdf');
|
---|
| 28 | ```
|
---|
| 29 |
|
---|
| 30 | ### Forcing the download of PDF via web browser, with a specific name
|
---|
| 31 |
|
---|
| 32 | ```php
|
---|
| 33 | $html2pdf->output('my_doc.pdf', 'D');
|
---|
| 34 | ```
|
---|
| 35 |
|
---|
| 36 | ### Write the contents of a PDF file on the server
|
---|
| 37 |
|
---|
| 38 | ```php
|
---|
| 39 | $html2pdf->output('/absolute/path/file_xxxx.pdf', 'F');
|
---|
| 40 | ```
|
---|
| 41 |
|
---|
| 42 | ### Retrieve the contents of the PDF and then do whatever you want
|
---|
| 43 |
|
---|
| 44 | ```php
|
---|
| 45 | $pdfContent = $html2pdf->output('my_doc.pdf', 'S');
|
---|
| 46 | ```
|
---|
| 47 |
|
---|
| 48 | Then, you can send it by email, using a Bin Attachment document.
|
---|
| 49 |
|
---|
| 50 | [back](./README.md)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.