Generate PDF/A files Aspose.PDF for .NET - Cannot find /EF/F/Type and /AFRelationship; PDF/A3 output files fail zugferd/factur-x validation

Hi,

We are using Aspose PDF since couple of weeks now and we need to generate a PDF/A3 meeting standards zugferd/factur-x.

After generat my file with Aspose.pdf I use a pdf validator from this site Factur-X Validator which allows to check the good conformity of the file.

Unfortunatly I have 2 errors after this operation. My first return is :
1 - Missing entry /EF/F/Type
After many research I can’t find the way to enhance this field by Aspose.pdf.
Could you help me for this first request ?

My second error is an known problem with you, it concern the field /AFRelationship.
Here my second error :
2 - Wrong value for /AFRelationship for file factur-x.xml - Accepted values for /AFRelationship are: ‘/Data’, ‘/Source’, ‘/Alternative’. Current value is ‘/Unspecified’.

Apparently this field seems to be valued by your API but with the wrong value and i can’t find the field to change the value.
Could you investigated to help us to value this field ?

It’s very important for us to validate the standard zugferd/factur-x for our clients

Thanks in advance for your reply

@Murphy54,

Thanks for contacting support.

Can you please share source files along with generated result and sample code so that we may further investigate to help you out.

@Adnan.Ahmad

Here my code when i embed a file at my pdf file

var fileToEmbedName = fileToEmbedFullName.FileName;
Stream fileStream = GetStreamFromBytes(fileToEmbedFullName.FileBytes);
FileSpecification fileSpecification = new FileSpecification(fileStream, fileToEmbedFullName.FileName, fileToEmbedFullName.Description)
{
Description = fileToEmbedFullName.Description,
Name = fileToEmbedName,
UnicodeName = fileToEmbedName,
Contents = fileStream,
MIMEType = fileToEmbedFullName.SubType,
IncludeContents = true,
Encoding = FileEncoding.None,
};

sourceDocument.EmbeddedFiles.Add(fileSpecification);

fileSpecification.Params = new FileParams(fileSpecification)
{
ModDate = DateTime.Now,
CreationDate = DateTime.Now
};

//TODO: Set /EF/F/Type
//TODO: Set AFRelationship = Data

I see no fields in FileSpecification Object which could allow me to enhance the fields that i need.

Here a diagram which describe Factur-X struct. You can see that /AFRelatioship and /Type are necessary. We find well some fields in your FileSpecification Object but not the two i need for validate the standard.

/F -> Name property,
/Desc -> Description property,
/Subtype -> MimeType property,
/Params -> Params property
etc

image.png (81.0 KB)

@Murphy54,

Can you please share source PDF and generated result so that we may work on that to help you out.

Sur @Adnan.Ahmad !

Here my source PDF

20200518_Murphy54_Facture.pdf (203.4 KB)

And here the result of the validator that I use (https://services.fnfe-mpe.org/) :

image.png (57.1 KB)

Have a good day

@Murphy54

We are looking into this and will get back to you with feedback soon.

Hi

You have been investigating the problem I have mentioned to you for 1 month now, have you been able to advance on the subject? This point is very important for our company and if this cannot be resolved quickly we will have to turn to another PDF solution.

Have a good day

@Murphy54

We apologize for the delay in response.

We would like to share with you that we already have been working on implementing Zugferd/factur-x validation support in the API to meet the standards and various tasks are under the phase of investigation regarding Zugferd/factur-x compliance for File Specifications in PDF documents.

Another ticket as PDFNET-48415 has been logged in our issue tracking system for your particular scenario. We will also investigate this ticket for implementation feasibility and keep you posted with the status of feature availability. Please spare us some time.

We again apologize for the delay and inconvenience.

@asad.ali

Hello,

I allow myself to relaunch the ticket and I would like to take this opportunity to emphasize another point, when I use an European “factur-x” official file and I want to check that it has been validated correctly using the Aspose “Validate” method. She returns false with an official file. Here is a code snippet and the file in question .

file : Facture_FR_BASICWL.pdf (84.6 KB)

code :

public static bool EstPdfFormatA3(string fichierSource)
{
bool estPDFA3 = false;
Document pdfDocument = new Document(fichierSource);

            if(pdfDocument != null)
            {
                switch (pdfDocument.PdfFormat)
                {
                    case PdfFormat.PDF_A_3A:
                        estPDFA3 = pdfDocument.Validate(new MemoryStream(), PdfFormat.PDF_A_3A);
                        break;

                    case PdfFormat.PDF_A_3B:
                        estPDFA3 = pdfDocument.Validate(new MemoryStream(), PdfFormat.PDF_A_3B);
                        break;

                    case PdfFormat.PDF_A_3U:
                        estPDFA3 = pdfDocument.Validate(new MemoryStream(), PdfFormat.PDF_A_3U);
                        break;

                    default:
                        break;
                }
            }            

            return estPDFA3;
        }

@Murphy54

Thanks for providing further details.

We have updated the information of earlier-logged ticket and will consider it as well during investigation.

Hi @asad.ali,

New relaunch.

Can we have a feedback please? The subject has been open since May 14. Is an ETA possible?

@Murphy54

The issue was logged in June 2020 and sadly, it is pending for analysis due to other tickets logged prior to it. However, we have recorded your concerns and will consider them while issue investigation. We will inform you as soon as we have some definite updates regarding its resolution. Please have patience and give us some time.

@asad.ali

Hi !
Can I have some news about this problem please ?

@Murphy54

The earlier logged ticket is under the process of investigation and due to its nature of complexity, it requires more time to get fully analyzed about its feasibility. We will surely inform you as soon as we make some definite progress towards its implementation. Please spare us some time.

We apologize for your inconvenience.

Any news about this subject ?

@Murphy54

Regretfully, the issue is not yet fully investigated. As soon as it is completely analyzed, we will be able to share some ETA with you regarding its fix. We will surely inform you as soon as additional updates are available. Please have patience and give us some time.

We apologize for your inconvenience.

@Murphy54

We would like to share with you that the logged ticket has been resolved in Aspose.PDF for .NET 20.11 which will be available for download during the current week. Please try the following code to create ZUGFeRD - compatible document (with 20.11v):

Document doc = new Document();
doc.Pages.Add();
string fileName = "zugferd-invoice.xml";
FileSpecification fs = new FileSpecification(fileName);
doc.EmbeddedFiles.Add(fs);
fs.Description = "Zugferd";
doc.Convert(new MemoryStream(), PdfFormat.ZUGFeRD, ConvertErrorAction.Delete);
doc.Save("invoice.pdf");

@asad.ali

Hi, thanks for your reply.

I updated your nuget package and tested your changes. Unfortunately I still have a problem. I don’t know if I forgot something or if there are still errors but here’s my test:
PDFNET-47752.zip (451.3 KB)

You can find :
-myPdf.pdf (the pdf I use)
-factur-x.xml (the xml I generated for my pdf)
-metadata.xml (the metadata generated by my sample)
-Sample.cs (my sample with your correction)
-Report.pdf (the report made by Factur-X Validator when I want to check if the file is correct)
-Works.pdf (My file working with another solution than Aspose (if you want to inspire))

I Don’t know if they have a link but I noticed that when i want to set the fileSpecification Description the value wasn’t set and stay nullable even if I force the value with my spy in Visual Studio it’s impossible to set.

I let you analyse my case and if you need more informations, please contact me.

Best regards

Murphy

@Murphy54

Thanks for your feedback.

We have logged the provided information under the ticket and let you know after investigating it. Please give us some time.

Hello,

Do you have any news about my issue ?

Best regards