Bug 703861 - lib\zugferd.ps creates pdf that is not compliant to PDF/A-3b standard
Summary: lib\zugferd.ps creates pdf that is not compliant to PDF/A-3b standard
Status: RESOLVED WONTFIX
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Writer (show other bugs)
Version: 9.54.0
Hardware: PC Windows 10
: P4 normal
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-18 16:14 UTC by Adrian Devries
Modified: 2021-08-18 13:05 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
Archive of files that have been referenced (53.68 KB, application/x-gzip)
2021-05-18 16:14 UTC, Adrian Devries
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Devries 2021-05-18 16:14:55 UTC
Created attachment 20993 [details]
Archive of files that have been referenced

In step 7 the script lib\zugferd.ps contains a string with two rdf:Description elements. The first element contains an exclamation mark that should not be there. That exclamation mark is responsible that the generated pdf is not compliant to PDF/A-3b standard.

--- "/mnt/c/Program Files/gs/gs9.54.0/lib/zugferd.ps"	2021-03-30 09:36:32.000000000 +0200
+++ /mnt/c/Temp/zugferd/zugferd-patched.ps	2021-05-16 04:36:35.345000000 +0200
@@ -242,7 +242,7 @@
 
             <!-- Description of schema properties -->
             <pdfaSchema:property>
-            <rdf:Seq>!
+            <rdf:Seq>
                 <rdf:li rdf:parseType="Resource">
                 <!-- DocumentFileName: Name of the embedded file;
                     must be equal with the value of the /F tag in the /EF  

Steps to reproduce the issue:

1. Execute the following command line:

gswin64c.exe -q -dBATCH -dNOPAUSE -dSAFER -dDELAYSAFER -dESTACKPRINT 
-sZUGFeRDXMLFile#"C:\Temp\zugferd\ZUGFeRD-invoice.xml"
-sZUGFeRDProfile#"C:\Program Files\gs\gs9.54.0\iccprofiles\srgb.icc"
-dPDFA#3 -sColorConversionStrategy#RGB -dPDFACompatibilityPolicy#2 
-sDEVICE#pdfwrite -dFastWebView#true -sPAPERSIZE#a4
-sOutputFile#"C:\Temp\zugferd\Sample-ZUGFeRD-buggy.pdf" 
-f "C:\Program Files\gs\gs9.54.0\lib\zugferd.ps" "C:\Temp\zugferd\Sample.ps"

2. Check the output file with VeraPDF (https://verapdf.org/home/)

3. Copy "lib\zugferd.ps" to a local folder, e.g., "C:\Temp\zugferd"

4. Apply the patch to the copied file

5. Execute the following modified command line:

gswin64c.exe -q -dBATCH -dNOPAUSE -dSAFER -dDELAYSAFER -dESTACKPRINT 
-sZUGFeRDXMLFile#"C:\Temp\zugferd\ZUGFeRD-invoice.xml"
-sZUGFeRDProfile#"C:\Program Files\gs\gs9.54.0\iccprofiles\srgb.icc"
-dPDFA#3 -sColorConversionStrategy#RGB -dPDFACompatibilityPolicy#2 
-sDEVICE#pdfwrite -dFastWebView#true -sPAPERSIZE#a4
-sOutputFile#"C:\Temp\zugferd\Sample-ZUGFeRD-patched.pdf" 
-f "C:\Temp\zugferd\zugferd-patched.ps" "C:\Temp\zugferd\Sample.ps"

6. Check the output file with VeraPDF

Find the following files attached:

a) Sample document: Sample.ps
b) Sample ZUGFeRD XML instance: ZUGFeRD-invoice.xml
c) Script: zugferd-patched.ps
d) Patch: zugferd.patch
e) Output file: Sample-ZUGFeRD-buggy.pdf
f) Compliance report: Sample-ZUGFeRD-buggy.mrr
g) Output file: Sample-ZUGFeRD-patched.pdf
h) Compliance report: Sample-ZUGFeRD-patched.mrr
Comment 1 spambin 2021-05-21 19:56:27 UTC
Observation
If the above case is confirmed, then the culprit boilerplate code is now over time in more than one place, and worth a site search or two?

e.g. see
https://ghostscript.com/zugferd.html
Comment 2 Ken Sharp 2021-08-18 13:05:44 UTC
I'm closing this (for now at least) as Adrian has provided a much more comprehensive solution in bug #703862, and I would prefer to use that code rather than fix the existing program.