Skip to content

Releases: kallefrombosnia/tinypdf-php

Clickable Links Support

05 Jan 10:52

Choose a tag to compare

Clickable PDF Links

Added support for clickable URLs in PDF documents with optional underline styling.

use TinyPdf\LinkOptions;

$pdf->page(function ($ctx) {
    // Link with blue underline
    $ctx->text('Visit GitHub', 50, 700, 12, new TextOptions(color: '#0066cc'));
    $ctx->link('https://github.com', 50, 695, 80, 20, new LinkOptions(underline: '#0066cc'));

    // Link without underline
    $ctx->text('Documentation', 50, 650, 12);
    $ctx->link('https://example.com/docs', 50, 645, 100, 20);
});

What's New

- link() method added to PageContextInterface
- New LinkOptions class for configuring link appearance
- Optional underline styling with custom colors
- Full PDF annotation support with URI actions
- Multiple links per page supported

Technical Details

- Implements proper PDF link annotations
- Invisible borders by default (PDF standard)
- Backwards compatible - no breaking changes
- 8 new tests with full coverage

Updated Examples

- Basic example now demonstrates clickable links

Credits

Thanks to https://github.com/Lulzx for the original https://github.com/Lulzx/tinypdf implementation.

Initial release

05 Jan 10:29

Choose a tag to compare

v1.0.0

chore: clean composer package