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

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

flarone/tcpdi
=============

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

1.0.3(2y ago)0507MITPHP

Since Dec 11Pushed 2y agoCompare

[ Source](https://github.com/flarone/tcpdi)[ Packagist](https://packagist.org/packages/flarone/tcpdi)[ Docs](https://github.com/flarone/tcpdi)[ RSS](/packages/flarone-tcpdi/feed)WikiDiscussions development Synced yesterday

READMEChangelogDependenciesVersions (4)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/flarone/tcpdi
```

Via Composer

```
composer require flarone/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

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

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

Total

2

Last Release

935d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/51fd7905d0acba590e8e161f4c10f91eef023650ec78751bb7885ce4e9664df0?d=identicon)[Flarone](/maintainers/Flarone)

---

Tags

pdfTCPDFfpditcpdi

### Embed Badge

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

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

###  Alternatives

[tecnickcom/tcpdf

Deprecated legacy PDF engine for PHP. Use instead tecnickcom/tc-lib-pdf.

4.5k109.8M579](/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.2k155.8M286](/packages/setasign-fpdi)[propa/tcpdi

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

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

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

45262.7k3](/packages/bithost-gmbh-pdfviewhelpers)

PHPackages © 2026

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