Merge branch 'pdfa-validation'

This commit is contained in:
nicolaasuni 2025-03-30 15:23:32 +01:00
commit fb4e14e871
4 changed files with 27 additions and 15 deletions

View File

@ -5,7 +5,7 @@
// Last Update : 2013-05-14
//
// Description : Example 065 for TCPDF class
// Creates an example PDF/A-1b document using TCPDF
// Creates an example PDF/A-3b document using TCPDF
//
// Author: Nicola Asuni
//
@ -17,12 +17,12 @@
//============================================================+
/**
* Creates an example PDF/A-1b document using TCPDF
* Creates an example PDF/A-3b document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: PDF/A-1b mode
* @abstract TCPDF - Example: PDF/A-3b mode
* @author Nicola Asuni
* @since 2011-09-28
* @group A-1b
* @group A-3b
* @group pdf
*/
@ -30,7 +30,7 @@
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false, true);
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false, 3);
// set document information
$pdf->setCreator(PDF_CREATOR);
@ -80,8 +80,8 @@ $pdf->AddPage();
// Set some content to print
$html = <<<EOD
<h1>Example of <a href="http://www.tcpdf.org" style="text-decoration:none;background-color:#CC0000;color:black;">&nbsp;<span style="color:black;">TC</span><span style="color:white;">PDF</span>&nbsp;</a> document in <span style="background-color:#99ccff;color:black;"> PDF/A-1b </span> mode.</h1>
<i>This document conforms to the standard <b>PDF/A-1b (ISO 19005-1:2005)</b>.</i>
<h1>Example of <a href="http://www.tcpdf.org" style="text-decoration:none;background-color:#CC0000;color:black;">&nbsp;<span style="color:black;">TC</span><span style="color:white;">PDF</span>&nbsp;</a> document in <span style="background-color:#99ccff;color:black;"> PDF/A-3b </span> mode.</h1>
<i>This document conforms to the standard <b>PDF/A-3b (ISO 19005-3:2012)</b>.</i>
<p>Please check the source code documentation and other examples for further information (<a href="http://www.tcpdf.org">http://www.tcpdf.org</a>).</p>
<p style="color:#CC0000;">TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE <a href="http://sourceforge.net/donate/index.php?group_id=128076">MAKE A DONATION!</a></p>
EOD;

View File

@ -3,18 +3,18 @@
/**
* Example 066 for TCPDF library
*
* @description Creates an example PDF/A-1b document using TCPDF
* @description Creates an example PDF/A-3b document using TCPDF
* @author Nicola Asuni - Tecnick.com LTD <info@tecnick.com>
* @license LGPL-3.0
*/
/**
* Creates an example PDF/A-1b document using TCPDF
* Creates an example PDF/A-3b document using TCPDF
*
* @abstract TCPDF - Example: PDF/A-1b mode
* @abstract TCPDF - Example: PDF/A-3b mode
* @author Nicola Asuni
* @since 2021-03-26
* @group A-1b
* @group A-3b
* @group pdf
*/
@ -22,7 +22,7 @@
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false, true);
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false, 3);
// set document information
$pdf->setCreator(PDF_CREATOR);
@ -73,8 +73,8 @@ $pdf->AddPage();
// Set some content to print
$html = <<<HTML
<h1>Example of <a href="http://www.tcpdf.org" style="text-decoration:none;background-color:#CC0000;color:black;">&nbsp;<span style="color:black;">TC</span><span style="color:white;">PDF</span>&nbsp;</a> document in <span style="background-color:#99ccff;color:black;"> PDF/A-1b </span> mode.</h1>
<i>This document conforms to the standard <b>PDF/A-1b (ISO 19005-1:2005)</b>.</i>
<h1>Example of <a href="http://www.tcpdf.org" style="text-decoration:none;background-color:#CC0000;color:black;">&nbsp;<span style="color:black;">TC</span><span style="color:white;">PDF</span>&nbsp;</a> document in <span style="background-color:#99ccff;color:black;"> PDF/A-3b </span> mode.</h1>
<i>This document conforms to the standard <b>PDF/A-3b (ISO 19005-3:2012)</b>.</i>
<p>Please check the source code documentation and other examples for further information (<a href="http://www.tcpdf.org">http://www.tcpdf.org</a>).</p>
HTML;

View File

@ -84,7 +84,7 @@ echo '<'.'?'.'xml version="1.0" encoding="UTF-8"'.'?'.'>';
<li>XObject Templates: [<a href="example_062.php" title="PDF [new window]" target="_blank">PDF</a>]</li>
<li>Text stretching and spacing (tracking/kerning): [<a href="example_063.php" title="PDF [new window]" target="_blank">PDF</a>]</li>
<li>No-write page regions: [<a href="example_064.php" title="PDF [new window]" target="_blank">PDF</a>]</li>
<li>PDF/A-1b (ISO 19005-1:2005) document: [<a href="example_065.php" title="PDF [new window]" target="_blank">PDF</a>]</li>
<li>PDF/A-3b (ISO 19005-3:2012) document: [<a href="example_065.php" title="PDF [new window]" target="_blank">PDF</a>]</li>
<li>Using WriteHTMLCell: [<a href="example_066.php" title="PDF [new window]" target="_blank">PDF</a>]</li>
<li>Shorthand border styles including !important: [<a href="example_067.php" title="PDF [new window]" target="_blank">PDF</a>]</li>
</ol>

View File

@ -125,6 +125,18 @@ for file in $EXAMPLE_FILES; do
FAILED_FLAG=1
echo "Generated-invalid-file: $file"
fi
if [ "$file" = "examples/example_065.php" ] || [ "$file" = "examples/example_066.php" ]; then
VALIDATION_OUTPUT="$(docker run -v $TEMP_FOLDER:/data --quiet --rm -w /data/ pdfix/verapdf-validation:latest validate --format 'json' -i 'output.pdf')"
VALIDATION_RESULT="$(echo $VALIDATION_OUTPUT | jq '.report.jobs[0].validationResult[0].compliant')"
if [ "$VALIDATION_RESULT" = "false" ]; then
FAILED_FLAG=1
echo "Generated pdf file failed validation: $file"
echo $VALIDATION_OUTPUT
else
VALIDATION_PROFILE="$(echo $VALIDATION_OUTPUT | jq '.report.jobs[0].validationResult[0].profileName')"
echo "Pdf validated with $VALIDATION_PROFILE: $file"
fi
fi
else
FAILED_FLAG=1
echo "File-run-failed: $file"