Skip to content

PDF/A-4 lưu trữ

Pro — Commercial License Required
Tính năng tuân thủ PDF/A-4 yêu cầu package Pro.

TCPDF-Next Pro implement tuân thủ PDF/A-4 (ISO 19005-4:2020), chuẩn lưu trữ mới nhất dựa trên PDF 2.0.

Class Archive

ClassMục đích
PdfAManagerBật, xác thực và thực thi tuân thủ PDF/A-4
PdfAVersionEnum: A4, A4f, A4e
XmpMetadataDublin Core, XMP Basic, PDF/A identification
OutputIntentsRGB và ICC color profile tùy chỉnh
IccProfilesRGB.icc đi kèm và tải profile tùy chỉnh

PdfAVersion

CấpTrường hợp sử dụngFile nhúng3D / Rich Media
A4Lưu trữ chuẩnKhôngKhông
A4fDocument có đính kèmKhông
A4eDocument kỹ thuật

Bật PDF/A-4

php
use Yeeefang\TcpdfNext\Core\Document;
use Yeeefang\TcpdfNext\Pro\Archive\{PdfAManager, PdfAVersion, OutputIntent};

$pdf = Document::create()
    ->metadata(title: 'Annual Report 2026', author: 'Finance')
    ->addPage()
    ->font('NotoSans', size: 12)
    ->text('PDF/A-4 compliant document.');

PdfAManager::enable($pdf, PdfAVersion::A4)
    ->outputIntent(OutputIntent::srgb());

$pdf->save('/archive/report.pdf');

OutputIntent và IccProfile

PDF/A yêu cầu ít nhất một output intent. Dùng factory method tích hợp hoặc tải ICC profile tùy chỉnh:

php
use Yeeefang\TcpdfNext\Pro\Archive\{OutputIntent, IccProfile};

OutputIntent::srgb();       // hiển thị màn hình (phổ biến nhất)
OutputIntent::fogra39();    // in offset phủ châu Âu
OutputIntent::gracol2006(); // in thương mại Mỹ

// ICC profile tùy chỉnh
$custom = new OutputIntent(
    subtype: 'GTS_PDFA1', outputConditionIdentifier: 'Custom_CMYK',
    info: 'Internal press profile', registryName: 'https://printing.example.com/profiles',
    iccProfile: IccProfile::load('/profiles/custom.icc')->bytes(),
);

XmpMetadata

XMP metadata được tạo tự động khi bật PDF/A. Thêm thuộc tính tùy chỉnh:

php
$xmp = $pdf->xmpMetadata();
$xmp->set('dc:rights', 'Copyright 2026 Acme Corporation');
$xmp->registerNamespace('acme', 'https://acme.example.com/xmp/1.0/');
$xmp->set('acme:DocumentId', 'DOC-2026-0042');

Quy tắc Validation

Quy tắcYêu cầu
Output intentYêu cầu ít nhất một
Nhúng fontMọi font phải được nhúng (không base-14)
Mã hóaKhông cho phép
JavaScriptKhông cho phép
Không gian màuDevice-independent hoặc được bao phủ bởi output intent
XMP metadataPhải có mặt và nhất quán

Chế độ thực thi

Bắt vi phạm ngay khi xảy ra:

php
$manager = PdfAManager::enable($pdf, PdfAVersion::A4);
$manager->enforce(true);

$pdf->javascript(trigger: 'open', script: 'app.alert("Hello");');
// -> PdfAException: "PDF/A-4 violation: JavaScript actions are not permitted."

Validation thủ công

php
$result = $manager->validate();
foreach ($result->violations() as $v) {
    echo "{$v->severity()}: {$v->message()} [{$v->clause()}]\n";
}

Kết hợp PDF/A-4 với PAdES B-LTA

php
use Yeeefang\TcpdfNext\Pro\Security\Signature\{DigitalSigner, CertificateInfo};
use Yeeefang\TcpdfNext\Pro\Security\Timestamp\TsaClient;
use Yeeefang\TcpdfNext\Contracts\Enums\SignatureLevel;

PdfAManager::enable($pdf, PdfAVersion::A4)
    ->outputIntent(OutputIntent::srgb());

$signer = new DigitalSigner(
    CertificateInfo::fromPkcs12('/certs/archive.p12', 'pw')
);
$signer->level(SignatureLevel::PAdES_B_LTA);
$signer->timestampAuthority(new TsaClient('https://tsa.example.com/timestamp'));

$signer->sign($pdf);
$pdf->save('/archive/signed-archival.pdf');

Bước tiếp theo

Phân phối theo giấy phép LGPL-3.0-or-later.