TCPDF icon indicating copy to clipboard operation
TCPDF copied to clipboard

Fix/xmp description subject

Open joebordes opened this issue 5 months ago • 2 comments

PR for issue #817

joe:~/TCPDF$ php examples/example_001.php  > example001.pdf
joe:~/TCPDF$ exiftool -XMP:All example001.pdf 
XMP Toolkit                     : Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:08:04
Format                          : application/pdf
Title                           : TCPDF Example 001
Creator                         : Nicola Asuni
Description                     : TCPDF Tutorial
Subject                         : TCPDF, PDF, example, test, guide
Create Date                     : 2025:10:01 18:35:53+00:00
Creator Tool                    : TCPDF
Modify Date                     : 2025:10:01 18:35:53+00:00
Metadata Date                   : 2025:10:01 18:35:53+00:00
Producer                        : TCPDF 6.10.0 (http://www.tcpdf.org)
Document ID                     : uuid:0cba4c67-099e-fe74-fea7-a279fb39678d
Instance ID                     : uuid:0cba4c67-099e-fe74-fea7-a279fb39678d
Schemas Namespace URI           : http://ns.adobe.com/pdf/1.3/
Schemas Prefix                  : pdf
Schemas Schema                  : Adobe PDF Schema
Schemas Property Category       : internal
Schemas Property Description    : Adobe PDF Schema
Schemas Property Name           : InstanceID
Schemas Property Value Type     : URI

The code that generates that is

$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 001');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');

We can see here that

  • Description contains the Subject
  • Subject contains the keywords

With this PR the code to create the PDF is now

$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 001');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setDescription('TCPDF Tutorial Description');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');

and the output is

joe:~/TCPDF$ php examples/example_001.php  > example001.pdf
joe:~/TCPDF$ exiftool -XMP:All example001.pdf 
XMP Toolkit                     : Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:08:04
Format                          : application/pdf
Title                           : TCPDF Example 001
Creator                         : Nicola Asuni
Description                     : TCPDF Tutorial Description
Subject                         : TCPDF Tutorial
Create Date                     : 2025:10:01 18:54:34+00:00
Creator Tool                    : TCPDF
Modify Date                     : 2025:10:01 18:54:34+00:00
Metadata Date                   : 2025:10:01 18:54:34+00:00
Producer                        : TCPDF 6.10.0 (http://www.tcpdf.org)
Document ID                     : uuid:91da612c-5ad4-9b90-89fb-aa6525362f2f
Instance ID                     : uuid:91da612c-5ad4-9b90-89fb-aa6525362f2f
Schemas Namespace URI           : http://ns.adobe.com/pdf/1.3/
Schemas Prefix                  : pdf
Schemas Schema                  : Adobe PDF Schema
Schemas Property Category       : internal
Schemas Property Description    : Adobe PDF Schema
Schemas Property Name           : InstanceID
Schemas Property Value Type     : URI

where you can see that we have description and subject as per the methods.

joebordes avatar Oct 01 '25 19:10 joebordes

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Oct 01 '25 19:10 CLAassistant

please add the hacktoberfest tag

joebordes avatar Oct 01 '25 19:10 joebordes