PHPackages                             vincentvete/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. vincentvete/tcpdi

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

vincentvete/tcpdi
=================

PDF importer for TCPDF based on FPDI (supports optimized PDF 1.5+)

1.0.2(8y ago)01.3k↓60%MITPHP

Since Feb 10Pushed 8y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (3)Used By (0)

Note: This is a clone of [pauln/tcpdi](https://github.com/pauln/tcpdi) for Composer

TCPDI
=====

[](#tcpdi)

If you got stuck with FPDI cannot parse PDF version 1.5+, then try this Perfect for PDF Merge, Combine or Layer Overlapping

### Installation

[](#installation)

Clone this git &amp; copy it directory contains [TCPDF](https://github.com/tecnickcom/tcpdf)

```
git clone https://github.com/lthh89vt/tcpdi
```

Via Composer

```
composer require lthh89vt/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);
}
```

As of version 1.1, TCPDI also includes additional functionality for handling PDF Annotations. As annotations are positioned relative to the bleed box rather than the crop box, you'll need to ensure that you're importing the full bleed box; a new function has also been introduced to set the page format (the various boxes, including the crop box) from the imported page, so that the imported page matches the original better. The following example demonstrates this:

```
// 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);
```

Note: tcpdi\_parser v1.1 is required in order to import annotations, though setPageFormatFromTemplatePage() should work with older versions of tcpdi\_parser.

### Credits

[](#credits)

> [pauln/tcpdi](https://github.com/pauln/tcpdi)[pauln/tcpdi\_parser](https://github.com/pauln/tcpdi_parser)[fdpf\_tpl](https://www.setasign.com/products/fpdi/downloads/#package-10102)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

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 ~309 days

Total

2

Last Release

3075d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5bcf79f0d06d5e6b46715b0e7a52ba8bff666ec3a3c58a05720826b71b14be43?d=identicon)[vete](/maintainers/vete)

---

Top Contributors

[![kat3su](https://avatars.githubusercontent.com/u/2160182?v=4)](https://github.com/kat3su "kat3su (4 commits)")[![vincentvete](https://avatars.githubusercontent.com/u/6637518?v=4)](https://github.com/vincentvete "vincentvete (4 commits)")

---

Tags

pdfTCPDFfpditcpdi

### Embed Badge

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

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

###  Alternatives

[tecnickcom/tcpdf

TCPDF is a PHP class for generating PDF documents and barcodes.

4.5k101.8M473](/packages/tecnickcom-tcpdf)[setasign/fpdi

FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.

1.2k142.4M231](/packages/setasign-fpdi)[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)

PHPackages © 2026

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