Add TDM Reservation Protocol (TDMRep) Properties
This demo shows you how you can add some special metadata to your PDFs to block AI models from scraping your PDFs.
These entries are defined in the TDM Reservation Protocol (TDMRep) specification which most recent version can be found here.
Note: You need to create and host your own policy file.
PHP
<?php
use setasign\SetaPDF2\Core\Document;
use setasign\SetaPDF2\Core\Writer\HttpWriter;
// load and register the autoload function
require_once '../../../../../bootstrap.php';
$writer = new HttpWriter('Fact-Sheet-TDM.pdf', true);
$document = Document::loadByFilename($assetsDirectory . '/pdfs/camtown/Fact-Sheet.pdf', $writer);
$ns = 'http://www.w3.org/ns/tdmrep/';
$alias = 'tdm';
$info = $document->getInfo();
$xmp = $info->getXmp();
$xmp->xmlAliases[$ns] = $alias;
$info->updateXmp($ns, 'reservation', 1);
$info->updateXmp($ns, 'policy', 'https://www.example.com/policies/tdm-policy.json');
$info->syncMetadata();
$document->save()->finish();
