From 9e5051e541425a79d526f6f6641ffc7355f2e510 Mon Sep 17 00:00:00 2001 From: "Kristof Ringleff, Fooman" Date: Wed, 12 Feb 2025 14:45:22 +1300 Subject: [PATCH] use verapdf for validation of pdfa pdfs fix examples update all references to PDF/A-3b --- .github/workflows/tests.yml | 2 +- examples/example_065.php | 14 +++++++------- examples/example_066.php | 14 +++++++------- examples/index.php | 2 +- tests/launch.sh | 12 ++++++++++++ 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 22e2d4f..6a346aa 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -90,7 +90,7 @@ jobs: # For debugging issues - name: Archive test results if: failure() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: test-run-output-${{ matrix.php-version }}-${{ matrix.os }} retention-days: 1 diff --git a/examples/example_065.php b/examples/example_065.php index 9079480..33c512d 100644 --- a/examples/example_065.php +++ b/examples/example_065.php @@ -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 = <<Example of  TCPDF  document in PDF/A-1b mode. -This document conforms to the standard PDF/A-1b (ISO 19005-1:2005). +

Example of  TCPDF  document in PDF/A-3b mode.

+This document conforms to the standard PDF/A-3b (ISO 19005-3:2012).

Please check the source code documentation and other examples for further information (http://www.tcpdf.org).

TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE MAKE A DONATION!

EOD; diff --git a/examples/example_066.php b/examples/example_066.php index 41b8b47..c31cb79 100644 --- a/examples/example_066.php +++ b/examples/example_066.php @@ -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 * @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 = <<Example of  TCPDF  document in PDF/A-1b mode. -This document conforms to the standard PDF/A-1b (ISO 19005-1:2005). +

Example of  TCPDF  document in PDF/A-3b mode.

+This document conforms to the standard PDF/A-3b (ISO 19005-3:2012).

Please check the source code documentation and other examples for further information (http://www.tcpdf.org).

HTML; diff --git a/examples/index.php b/examples/index.php index d865689..e456e36 100644 --- a/examples/index.php +++ b/examples/index.php @@ -84,7 +84,7 @@ echo '<'.'?'.'xml version="1.0" encoding="UTF-8"'.'?'.'>';
  • XObject Templates: [PDF]
  • Text stretching and spacing (tracking/kerning): [PDF]
  • No-write page regions: [PDF]
  • -
  • PDF/A-1b (ISO 19005-1:2005) document: [PDF]
  • +
  • PDF/A-3b (ISO 19005-3:2012) document: [PDF]
  • Using WriteHTMLCell: [PDF]
  • Shorthand border styles including !important: [PDF]
  • diff --git a/tests/launch.sh b/tests/launch.sh index 3536806..b368446 100755 --- a/tests/launch.sh +++ b/tests/launch.sh @@ -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"