Difference between #26 and #27 of
Yii v2 snippet guide II

Revision #27 has been created by rackycz on Oct 1, 2020, 1:23:13 PM with the memo:

TCPDF
« previous (#26) next (#28) »

Changes

Title unchanged

Yii v2 snippet guide II

Category unchanged

Tutorials

Yii version unchanged

2.0

Tags unchanged

tutorial,beginner,yii2,snippets

Content changed

[...]
unlink($tmpFileName);
exit();
```

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

 
**PDF - 1D & 2D Barcodes - TCPDF**
 
---
 
See part I of this guide for other PDF creators:
 
- [https://www.yiiframework.com/wiki/2552/yii-v2-snippet-guide](https://www.yiiframework.com/wiki/2552/yii-v2-snippet-guide)
 
 
TCPDF was created in 2002 (I think) and these days (year 2020) is being rewritten into a modern PHP application. I will describe both, but lets begin with the older version.
 
 
**Older version of TCPDF**
 
- https://github.com/tecnickcom/tcpdf
 
- https://tcpdf.org/examples/
 
 
 
Download it from GitHub and save it into folder 
 
 
```
 
{projectPath}/_tcpdf
 
```
 
 
Into web/index.php add this:
 
 
```php
 
require_once('../_tcpdf/tcpdf.php');
 
```
 
 
 
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: 
 
 
```php
 
$pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
 
```
 
 
 
**New version of TCPDF**
 
 
... to be finished ...
 
 
- https://github.com/tecnickcom/tc-lib-pdf
 
- composer require tecnickcom/tc-lib-pdf:dev-master
 
- use Com\Tecnick\Pdf\TCPDF;
 
- $pdf = new TCPDF();
 
 
 
4 0
3 followers
Viewed: 75 354 times
Version: 2.0
Category: Tutorials
Written by: rackycz
Last updated by: rackycz
Created on: Aug 26, 2020
Last updated: 3 years ago
Update Article

Revisions

View all history