Skip to content

PDF Accessibile

Pro — Commercial License Required
Funzionalità PDF/UA richiedono il pacchetto Pro.

Crea PDF accessibili per screen reader e tecnologie assistive conformi PDF/UA (ISO 14289).

Abilitare Tagged PDF

php
use Yeeefang\TcpdfNext\Core\Document;
use Yeeefang\TcpdfNext\Pro\Accessibility\StructureTreeManager;

$pdf = Document::create()
    ->setTaggedPdf(true)
    ->setLanguage('it-IT')
    ->setTitle('Documento Accessibile');

Struttura Documento

php
$pdf->addPage();

// Intestazione documento
$pdf->openTag('H1')
    ->setFont('Helvetica', 'B', 18)
    ->cell(0, 12, 'Rapporto Annuale 2026', newLine: true)
    ->closeTag('H1');

// Paragrafo
$pdf->openTag('P')
    ->setFont('Helvetica', '', 11)
    ->multiCell(0, 6, 'Questo è il rapporto annuale...')
    ->closeTag('P');

// Lista
$pdf->openTag('L');
foreach (['Punto 1', 'Punto 2'] as $item) {
    $pdf->openTag('LI')
        ->cell(0, 6, '• ' . $item, newLine: true)
        ->closeTag('LI');
}
$pdf->closeTag('L');

Immagini con Alt Text

php
$pdf->image(
    file: '/path/to/chart.png',
    x: 10,
    y: 50,
    width: 100,
    height: 80,
    alt: 'Grafico a barre mostrando crescita ricavi 2020-2026'
);

Tabelle Accessibili

php
$pdf->openTag('Table');

// Header
$pdf->openTag('TR');
$pdf->openTag('TH')->cell(60, 8, 'Prodotto')->closeTag('TH');
$pdf->openTag('TH')->cell(40, 8, 'Prezzo', newLine: true)->closeTag('TH');
$pdf->closeTag('TR');

// Righe dati
foreach ($products as $product) {
    $pdf->openTag('TR');
    $pdf->openTag('TD')->cell(60, 7, $product->name)->closeTag('TD');
    $pdf->openTag('TD')->cell(40, 7, $product->price, newLine: true)->closeTag('TD');
    $pdf->closeTag('TR');
}

$pdf->closeTag('Table');

Validazione

Valida conformità PDF/UA con Adobe Acrobat Pro o strumenti online PAC (PDF Accessibility Checker).

Rilasciato sotto licenza LGPL-3.0-or-later.