You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+62-9Lines changed: 62 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,28 @@ If this library saves you time, please consider [supporting its development via
14
14
15
15
---
16
16
17
+
## Contents
18
+
19
+
-[Overview](#overview)
20
+
-[Description](#description)
21
+
-[For TCPDF Users](#for-tcpdf-users)
22
+
-[Features](#features)
23
+
-[Requirements](#requirements)
24
+
-[Installation](#installation)
25
+
-[Font Setup](#font-setup)
26
+
-[Quick Start](#quick-start)
27
+
-[Digital Signatures](#digital-signatures)
28
+
-[PDF/X Conformance](#pdfx-conformance)
29
+
-[PDF/UA Accessibility](#pdfua-accessibility)
30
+
-[Development](#development)
31
+
-[Packaging](#packaging)
32
+
-[Contributing](#contributing)
33
+
-[Third-Party Fonts](#third-party-fonts)
34
+
-[ICC Profile](#icc-profile)
35
+
-[Contact](#contact)
36
+
37
+
---
38
+
17
39
## Overview
18
40
19
41
`tc-lib-pdf` is a pure-PHP library for dynamically generating PDF documents.
@@ -48,6 +70,16 @@ The library is particularly well suited to backend-driven document workflows suc
48
70
49
71
Because it is part of the broader `tc-lib-*` ecosystem, `tc-lib-pdf` can coordinate fonts, images, page geometry, graphics primitives, and optional features such as barcodes and encryption through dedicated companion packages. That modular design makes the project easier to evolve over time while still delivering the all-in-one capabilities PHP developers expect from a serious PDF engine.
50
72
73
+
## For TCPDF Users
74
+
75
+
If you already know TCPDF, `tc-lib-pdf` will feel familiar in purpose but it is not positioned as a drop-in replacement.
76
+
77
+
- The codebase is split across focused Composer packages instead of a single monolithic distribution.
78
+
- The API surface is more strongly typed and organized around companion services such as fonts, pages, graphics, and images.
79
+
- Setup is Composer-first, which means asset preparation such as font generation is part of project bootstrap rather than an implicit bundled step.
80
+
81
+
The fastest way to evaluate the library is to follow the installation and font setup steps below, then compare the runnable examples in [examples/index.md](examples/index.md) with the equivalent workflows you already maintain in TCPDF.
82
+
51
83
## Features
52
84
53
85
### Text & Fonts
@@ -104,14 +136,26 @@ Because it is part of the broader `tc-lib-*` ecosystem, `tc-lib-pdf` can coordin
104
136
## Requirements
105
137
106
138
-**PHP 8.1** or later
139
+
- Required PHP extensions: `date`, `pcre` (enforced by Composer)
107
140
- Composer
108
141
109
142
Optional PHP extensions for extended functionality: `gd`, `zlib`.
110
143
144
+
Feature-specific prerequisites:
145
+
146
+
- Digital signatures, timestamps, and LTV workflows require signing certificates/keys and any external TSA or revocation endpoints your configuration references.
147
+
-`make preflight` depends on external validation tools when you want standards validation beyond the built-in sample generation.
148
+
111
149
---
112
150
113
151
## Installation
114
152
153
+
For a clean first run:
154
+
155
+
1. Install the package with Composer.
156
+
2. Generate the companion font files.
157
+
3. Run the minimal script using the generated `K_PATH_FONTS` path.
158
+
115
159
```bash
116
160
composer require tecnickcom/tc-lib-pdf
117
161
```
@@ -132,7 +176,7 @@ Or add to your `composer.json`:
132
176
133
177
When you install `tc-lib-pdf` as a dependency in your project (via `composer require` or `composer install`), the fonts from the companion package [`tc-lib-pdf-font`](https://github.com/tecnickcom/tc-lib-pdf-font) must be generated before they can be used.
134
178
135
-
Since Composer does not execute dependency scripts during installation, you need to add the font generation step to your **consuming project's**`composer.json` file:
179
+
Composer does not execute scripts declared by dependencies, so you need to add the font generation step to your **consuming project's**`composer.json` file:
136
180
137
181
```json
138
182
{
@@ -185,12 +229,14 @@ This avoids regenerating fonts on every dependency reinstall and lets multiple d
185
229
186
230
## Quick Start
187
231
232
+
The following example assumes the script lives in your project root. If you place it elsewhere, adjust the `autoload.php` and `K_PATH_FONTS` paths accordingly.
`getOutPDFString()` returns the raw PDF bytes. `renderPDF()` streams those bytes to the browser; if you need file storage or an email attachment, keep the returned string and write or hand it off yourself.
259
+
212
260
For more complete examples — including invoices, images, barcodes, HTML tables, dedicated HTML selector/form/table showcases, PDF/X, and PDF/UA — see the [examples](examples) directory.
-[examples/E009_signature_ltv.php](examples/E009_signature_ltv.php) : detached CMS signature with LTV validation material embedding.
235
288
236
289
### Basic signature
237
290
@@ -328,7 +381,7 @@ Each variant automatically applies the appropriate conformance constraints:
328
381
329
382
All PDF/X modes suppress encryption and JavaScript (not permitted by the ISO 15930 standard).
330
383
331
-
Runnable examples: [examples/010_example_pdfx.php](examples/010_example_pdfx.php) through [examples/014_example_pdfx5.php](examples/014_example_pdfx5.php).
384
+
Runnable examples: [examples/E010_pdfx.php](examples/E010_pdfx.php) through [examples/E014_pdfx5.php](examples/E014_pdfx5.php).
332
385
333
386
---
334
387
@@ -362,7 +415,7 @@ To provide the document language explicitly:
362
415
$pdf->setDocInfo(['a_meta_language' => 'de-DE']);
363
416
```
364
417
365
-
Runnable examples: [examples/015_example_pdfua.php](examples/015_example_pdfua.php) through [examples/017_example_pdfua2.php](examples/017_example_pdfua2.php).
418
+
Runnable examples: [examples/E015_pdfua.php](examples/E015_pdfua.php) through [examples/E017_pdfua2.php](examples/E017_pdfua2.php).
0 commit comments