PHPackages                             chachanagov/tcpdi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. chachanagov/tcpdi

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

chachanagov/tcpdi
=================

TCPDI is a PHP class for importing PDF to use with TCPDF

v1.1.0(2mo ago)13.5k↓33.3%Apache-2.0PHPPHP &gt;=7.4 || &gt;=8.0

Since Aug 8Pushed 2mo agoCompare

[ Source](https://github.com/chachanagov/tcpdi)[ Packagist](https://packagist.org/packages/chachanagov/tcpdi)[ RSS](/packages/chachanagov-tcpdi/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

TCPDI
=====

[](#tcpdi)

Composer ready [TCPDI](https://github.com/pauln/tcpdi).

PDF importer for [TCPDF](http://www.tcpdf.org/), based on [FPDI](http://www.setasign.de/products/pdf-php-solutions/fpdi/). Requires [pauln/tcpdi\_parser](https://github.com/pauln/tcpdi_parser) and [FPDF\_TPL](http://www.setasign.de/products/pdf-php-solutions/fpdi/downloads/)which are included in the repository.

Installation
------------

[](#installation)

Link package in composer.json, e.g.

```
composer require chachanagov/tcpdi
```

Usage
-----

[](#usage)

Usage is essentially the same as FPDI, except importing TCPDI rather than FPDI. It also has a "setSourceData()" function which accepts raw PDF data, for cases where the file does not reside on disk or is not readable by TCPDI.

```
// Create new PDF document.
$pdf = new TCPDI(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// Add a page from a PDF by file path.
$pdf->AddPage();
$pdf->setSourceFile('/path/to/file-to-import.pdf');
$idx = $pdf->importPage(1);
$pdf->useTemplate($idx);

$pdfdata = file_get_contents('/path/to/other-file.pdf'); // Simulate only having raw data available.
$pagecount = $pdf->setSourceData($pdfdata);
for ($i = 1; $i importPage($i);
    $pdf->AddPage();
    $pdf->useTemplate($tplidx);
}

// Create new PDF document.
$pdf = new TCPDI(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// Add a page from a PDF by file path.
$pdf->setSourceFile('/path/to/file-to-import.pdf');

// Import the bleed box (default is crop box) for page 1.
$tplidx = $pdf->importPage(1, '/BleedBox');
$size = $pdf->getTemplatesize($tplidx);
$orientation = ($size['w'] > $size['h']) ? 'L' : 'P';

$pdf->AddPage($orientation);

// Set page boxes from imported page 1.
$pdf->setPageFormatFromTemplatePage(1, $orientation);

// Import the content for page 1.
$pdf->useTemplate($tplidx);

// Import the annotations for page 1.
$pdf->importAnnotations(1);
```

TCPDI\_PARSER
=============

[](#tcpdi_parser)

Parser for use with TCPDI, based on TCPDF\_PARSER. Supports PDFs up to v1.7.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance84

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1291 days

Total

2

Last Release

82d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.4

v1.1.0PHP &gt;=7.4 || &gt;=8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/27193641?v=4)[Vladimir Chachanagov](/maintainers/chachanagov)[@chachanagov](https://github.com/chachanagov)

---

Top Contributors

[![kulbakin](https://avatars.githubusercontent.com/u/817433?v=4)](https://github.com/kulbakin "kulbakin (20 commits)")[![pauln](https://avatars.githubusercontent.com/u/574359?v=4)](https://github.com/pauln "pauln (6 commits)")[![wollanup](https://avatars.githubusercontent.com/u/4822805?v=4)](https://github.com/wollanup "wollanup (6 commits)")[![chachanagov](https://avatars.githubusercontent.com/u/27193641?v=4)](https://github.com/chachanagov "chachanagov (4 commits)")[![tugais34](https://avatars.githubusercontent.com/u/7768049?v=4)](https://github.com/tugais34 "tugais34 (4 commits)")[![bpedersen2](https://avatars.githubusercontent.com/u/5336494?v=4)](https://github.com/bpedersen2 "bpedersen2 (2 commits)")[![stiv-pro](https://avatars.githubusercontent.com/u/151028460?v=4)](https://github.com/stiv-pro "stiv-pro (2 commits)")[![lduer](https://avatars.githubusercontent.com/u/3307025?v=4)](https://github.com/lduer "lduer (1 commits)")[![CSalih](https://avatars.githubusercontent.com/u/17460013?v=4)](https://github.com/CSalih "CSalih (1 commits)")[![tgerakitis](https://avatars.githubusercontent.com/u/34158395?v=4)](https://github.com/tgerakitis "tgerakitis (1 commits)")[![fetzi](https://avatars.githubusercontent.com/u/3509426?v=4)](https://github.com/fetzi "fetzi (1 commits)")[![Loki3000](https://avatars.githubusercontent.com/u/12333165?v=4)](https://github.com/Loki3000 "Loki3000 (1 commits)")

---

Tags

pdfTCPDFtcpditcpdi\_parser

### Embed Badge

![Health badge](/badges/chachanagov-tcpdi/health.svg)

```
[![Health](https://phpackages.com/badges/chachanagov-tcpdi/health.svg)](https://phpackages.com/packages/chachanagov-tcpdi)
```

###  Alternatives

[elibyy/tcpdf-laravel

tcpdf support for Laravel 6, 7, 8, 9, 10, 11

3542.7M5](/packages/elibyy-tcpdf-laravel)[propa/tcpdi

TCPDI is a PHP class for importing PDF to use with TCPDF

231.1M1](/packages/propa-tcpdi)[bithost-gmbh/pdfviewhelpers

This is a TYPO3 CMS extension that provides various Fluid ViewHelpers to generate PDF documents.

45242.7k2](/packages/bithost-gmbh-pdfviewhelpers)[qipsius/tcpdf-bundle

A bundle to easily integrate TCPDF into Symfony

22709.1k](/packages/qipsius-tcpdf-bundle)[tarfin-labs/easy-pdf

Makes pdf processing easy.

1718.3k](/packages/tarfin-labs-easy-pdf)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
