Yii v2 snippet guide II

Comparing #28 with #29

Revision #29 was created by rackycz rackycz on Oct 2, 2020, 8:53:13 AM.

TCPDF

Content

[...]
exit();
```

Note: But exit() or die() should not be called. Read the "DbCreator" link above.

**PDF -
 UTF + 1D & 2D Barcodes - TCPDF**
---
See part I of this guide for other PDF creators:
[...]
```


 
Now you can use any Example to test TCPDF. For example: https://tcpdf.org/examples/example_001/

**Note:** You have to call constructor with backslash:
[...]
```

**Note that t:** Texts are printed using more methods - see file tcpdf.php for details:
- writeHTMLCell()
- Multicell()
[...]
- Text()

**Note:** Store your files in UTF8 no BOM format so diacritics is correct in PDF.
 
 
Importing new TTF fonts is done like this:
 
 
```php
 
// this command creates filed in folder _tcpdf\fonts. Use the filename as the fontname in other commands.
 
$fontname = \TCPDF_FONTS::addTTFfont("path to TTF file", 'TrueTypeUnicode', '', 96);
 
```
 
 
Now you can use it in PHP like this:
 
 
```php
 
$pdf->SetFont($fontname, '', 24, '', true);
 
```
 
 
Or in HTML:
 
 
```html
 
<font size="9" face="fontName" style="color: rgb(128, 128, 128);">ABC</font>
 
```
 
 
Rendering is done like this:
 
 
```php
 
$pdf->writeHTML($html);
 
```
 
 
 
 
 
**New version of TCPDF**

... to be finished ...

- https://github.com/tecnickcom/tc-lib-pdf
- composer require tecnickcom/tc-lib-pdf:dev-master
[...]