I have a PDF file with a factur-x file joined. This file is not added with Ghostscript 10.07.
I'm trying to make a valid factur-x PDF file. First step : I made the PDF A/3 compliant using this command line :
gswin32c.exe -dNOSAFER -dPDFA=3 --permit-file-read=C:/Users/sylvain/Desktop/gs10.07.0/iccprofiles/default_rgb.icc -sDEVICE=pdfwrite -sColorConversionStrategy=RGB -o "202510033701_PDFA3.pdf" "C:/Users/sylvain/Desktop/gs10.07.0/lib/pdfa_def_sylvain.ps" "202510033701.pdf"
It works fine, i get a valid PDF A/3 file on https://services.fnfe-mpe.org :

Now I'm trying to add the specific Zugferd metadata. I modified the file PDFA_def.ps like this :
%!
% This is a sample prefix file for creating a PDF/A document.
% Users should modify entries marked with "Customize".
% This assumes an ICC profile resides in the file (srgb.icc),
% in the current directory unless the user modifies the corresponding line below.
% Define entries in the document Info dictionary :
[ /Title (Title) % Customise
/DOCINFO pdfmark
% Define an ICC profile :
/ICCProfile (C:/Users/sylvain.cormy/Desktop/gs10.07.0/iccprofiles/default_rgb.icc) % Customise
def
[/_objdef {icc_PDFA} /type /stream /OBJ pdfmark
%% This code attempts to set the /N (number of components) key for the ICC colour space.
%% To do this it checks the ColorConversionStrategy or the device ProcessColorModel if
%% ColorConversionStrategy is not set.
%% This is not 100% reliable. A better solution is for the user to edit this and replace
%% the code between the ---8<--- lines with a simple declaration like:
%% /N 3
%% where the value of N is the number of components from the profile defined in /ICCProfile above.
%%
[{icc_PDFA}
<<
%% ----------8<--------------8<-------------8<--------------8<----------
systemdict /ColorConversionStrategy known {
systemdict /ColorConversionStrategy get cvn dup /Gray eq {
pop /N 1 false
}{
dup /RGB eq {
pop /N 3 false
}{
/CMYK eq {
/N 4 false
}{
(\tColorConversionStrategy not a device space, falling back to ProcessColorModel, output may not be valid PDF/A.\n)=
true
} ifelse
} ifelse
} ifelse
} {
(\tColorConversionStrategy not set, falling back to ProcessColorModel, output may not be valid PDF/A.\n)=
true
} ifelse
{
currentpagedevice /ProcessColorModel get
dup /DeviceGray eq {
pop /N 1
}{
dup /DeviceRGB eq {
pop /N 3
}{
dup /DeviceCMYK eq {
pop /N 4
} {
(\tProcessColorModel not a device space.)=
/ProcessColorModel cvx /rangecheck signalerror
} ifelse
} ifelse
} ifelse
} if
%% ----------8<--------------8<-------------8<--------------8<----------
>> /PUT pdfmark
[
{icc_PDFA}
{ICCProfile (r) file} stopped
{
(\n\tFailed to open the supplied ICCProfile for reading. This may be due to\n) print
(\t an incorrect filename or a failure to add --permit-file-read=\n) print
(\t to the command line. This PostScript program needs to open the file\n) print
(\t and you must explicitly grant it permission to do so.\n\n) print
(\tPDF/A processing aborted, output may not be a PDF/A file.\n\n) print
cleartomark
}
{
/PUT pdfmark
% Define the output intent dictionary :
[/_objdef {OutputIntent_PDFA} /type /dict /OBJ pdfmark
[{OutputIntent_PDFA} <<
/Type /OutputIntent % Must be so (the standard requires).
/S /GTS_PDFA1 % Must be so (the standard requires).
/DestOutputProfile {icc_PDFA} % Must be so (see above).
/OutputConditionIdentifier (sRGB) % Customize
>> /PUT pdfmark
[{Catalog} <> /PUT pdfmark
[
[
/XML
(
ZUGFeRD PDFA Extension Schema
urn:ferd:pdfa:invoice:rc#
zf
!
DocumentFileName
Text
external
name of the embedded xml invoice file
DocumentType
Text
external
INVOICE
Version
Text
external
The actual version of the ZUGFeRD data
ConformanceLevel
Text
external
The conformance level of the ZUGFeRD data
INVOICE
ZUGFeRD-invoice.xml
RC
BASIC
)
/Ext_Metadata pdfmark
} ifelse
But now, when I use the same command line, the PDF is not PDF A/3 compliant :

I'm confused.. what am i doing wrong ?
Any help would be really appreciated : )
Regards.
Sylvain