tecnickcom/tc-lib-pdf-page

PHP library containing PDF page formats and definitions

Maintainers

Package info

github.com/tecnickcom/tc-lib-pdf-page

Homepage

pkg:composer/tecnickcom/tc-lib-pdf-page

Fund package maintenance!

tecnickcom

Statistics

Installs: 676 619

Dependents: 1

Suggesters: 0

Stars: 7

Open Issues: 0


README

Page geometry, boxes, and format definitions for PDF documents.

Latest Stable Version Build Coverage License Downloads

Sponsor on GitHub

If this project is useful to you, please consider supporting development via GitHub Sponsors.

Overview

tc-lib-pdf-page manages page sizing, orientation, box definitions, and related geometry metadata.

It provides the structural model that document builders use to define media boxes, orientation changes, and page-level defaults consistently. Centralizing these rules improves correctness in multi-page layouts and simplifies downstream rendering code.

Namespace \Com\Tecnick\Pdf\Page
Author Nicola Asuni info@tecnick.com
License GNU LGPL v3 - see LICENSE
API docs https://tcpdf.org/docs/srcdoc/tc-lib-pdf-page
Packagist https://packagist.org/packages/tecnickcom/tc-lib-pdf-page

Features

Page Model

  • Standard and custom page size handling
  • Orientation and unit conversion helpers
  • Region and box definitions (CropBox, TrimBox, and related metadata)

Integration

  • Supports PDF composition stacks that need deterministic page geometry
  • Pairs with color/encryption libraries for complete page objects
  • Typed exceptions for invalid layout parameters

Requirements

  • PHP 8.2 or later
  • Extensions: date, zlib
  • Composer

Installation

composer require tecnickcom/tc-lib-pdf-page

Quick Start

<?php

require_once __DIR__ . '/vendor/autoload.php';

$page = new \Com\Tecnick\Pdf\Page\Page(
    'mm',
    new \Com\Tecnick\Color\Pdf(),
    new \Com\Tecnick\Pdf\Encrypt\Encrypt(false),
    false,
    false
);

$dims = $page->setBox([], 'CropBox', 0, 0, 210, 297);
var_dump($dims['CropBox']);

Development

make deps
make help
make qa

Packaging

make rpm
make deb

For system packages, bootstrap with:

require_once '/usr/share/php/Com/Tecnick/Pdf/Page/autoload.php';

Contributing

Contributions are welcome. Please review CONTRIBUTING.md, CODE_OF_CONDUCT.md, and SECURITY.md.

Contact

Nicola Asuni - info@tecnick.com