Support for Factur-X standard

Hello,

We are using Aspose PDF in order to generate a PDF/A3 that need to meet Factur-X standards.

There is a validator at this address which allows to check the conformity of the file.

Using the validator mentionned above, we currently have 2 errors:
1 - Wrong value for /EF/F/Subtype
Value for /EF/F/Subtype should be ‘/text#2Fxml’. Current value is ‘/application#2Fpdf’.

2 - Missing entry /EF/F/Type

How can we provide those two values with Aspose ?

Here is a schema from the standard
image.png (89.5 KB)

Here a PDF describing the standard
1. FACTUR-X 1.0.06 2022 03 01 EN VF.pdf (1.6 MB)

And here is a snippet of the code that we use to generate our PDF

 public Stream AttachXmlFacturX(Stream pdfStream, Stream xmlStream)
    {
        var pdfDocument = new Document(pdfStream);

        FileSpecification fileSpecification = new FileSpecification(xmlStream, "factur-x.xml", "factur-x xml file");
        pdfDocument.EmbeddedFiles.Add("factur-x.xml", fileSpecification);
        fileSpecification.Name = "factur-x.xml";
        fileSpecification.MIMEType = "text/xml";
        fileSpecification.Params = new FileParams(fileSpecification);
        fileSpecification.Params.ModDate = DateTime.Now;
        fileSpecification.Params.CreationDate = DateTime.Now;

        pdfDocument.SetTitle("mon titre");

        var extensionSchemaDescription = new XmpPdfAExtensionSchemaDescription("fx", "urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#", "Factur-X PDFA Extension Schema");
        var extensionSchema = new XmpPdfAExtensionSchema(extensionSchemaDescription);
        var object1 = new XmpPdfAExtensionProperty("DocumentFileName", "factur-x.xml", "Text", XmpPdfAExtensionCategoryType.External, "The name of the embedded XML document");
        var object2 = new XmpPdfAExtensionProperty("DocumentType", "INVOICE", "Text", XmpPdfAExtensionCategoryType.External, "The type of the hybrid document blablabalbaa");
        var object3 = new XmpPdfAExtensionProperty("Version", "1.0", "Text", XmpPdfAExtensionCategoryType.External, "The actual version of the standard blablabalbaa");
        var object4 = new XmpPdfAExtensionProperty("ConformanceLevel", "MINIMUM", "Text", XmpPdfAExtensionCategoryType.External, "The conformance level blablabalbaa");
        extensionSchema.Objects.Add(object1);
        extensionSchema.Objects.Add(object2);
        extensionSchema.Objects.Add(object3);
        extensionSchema.Objects.Add(object4);
        pdfDocument.Metadata.ExtensionFields.Add("fx", extensionSchema);
        pdfDocument.Metadata.RegisterNamespaceUri("fx", "urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#");
        pdfDocument.Metadata["fx:DocumentType"] = "INVOICE";
        pdfDocument.Metadata["fx:DocumentFileName"] = "factur-x.xml";
        pdfDocument.Metadata["fx:Version"] = "1.0";
        pdfDocument.Metadata["fx:ConformanceLevel"] = "MINIMUM";

        bool convertSuccess = pdfDocument.Convert(new MemoryStream(), PdfFormat.PDF_A_3B, ConvertErrorAction.None);
        if (convertSuccess)
        {
            fileSpecification.SetValue("AFRelationship", "Data");
            fileSpecification.IncludeContents = true;

            Stream outputStream = new MemoryStream();
            pdfDocument.Save(outputStream);
            return outputStream;
        }
        else
        {
            throw new Exception("Erreur de conversion PDF A3");
        }
    }

We know that there is the value PdfFormat.ZUGFeRD in the PdfFormat enum for the Convert method but it looks like it does a lot of things that we don’t want (I would say that it is made for older version of the ZUGFeRD standard, prior to 2.1)

I’ve found a very similar question in an other post but unfortunately there is no answer since almost a year.

Thank you

@ggros123

In case you are using old version of Aspose.PDF for .NET, we suggest you please use the latest version of Aspose.PDF for .NET 22.10. Hope this helps you.

If you still face problem, please share the following resources here for testing:

  • The XML file (xmlStream).
  • Problematic and expected output PDF files.
  • Please share the steps that you are following reproduce the same issue at our end.

We will investigate the issue and provide you more information on it.

Hi tahir,

I’m using the latest version (22.10) and I’m still facing a problem.
I’m not even sure there is a problem with Aspose, it might be a misusage or something I don’t understand in the way to use Aspose.

If you look at the following schema
image.png (83.4 KB)

You will see a description of some properties that I need to add to the PDF doc.
For example I can set the AFRelationship value through the property of the same name in the class FileSpecification.
Now I need to set the value “EF” which is a Dictionary containing the values “UF” and “F”.

Would you be able to tell how I can achieve this with Aspose ? Do I have to use the method SetValue in the FileSpecification class ?

Thank you

1 Like

@ggros123

We have logged a ticket for your case as PDFNET-53096 in our issue tracking system. We will inform you once there is an update available on it. We apologize for your inconvenience.

Hello,

I also have the same problem in Java (version 22.10)
And I also have the impression that the UF and F values are missing for everything to work…

image.jpg (95.8 KB)

I think it misses the /Names dictionary too.

@gtrryu

The issue is logged for .NET API and as soon as its resolved. The fix will be available in the equivalent version of Java API. We will let you know once its resolved. Please spare us some time. We are sorry for the inconvenience.

2 Likes

Hi Asad,

Thank you for your answer.

Would you be able to give an estimate, even a rough one, for this ?
We recently purchase a license for Aspose and we really need this for one of our project.

Do you think it can prioritized if we go through the paid support ?

Thanks

@ggros123

The ticket has recently been logged in our issue tracking system and issues are resolved on a first come first serve basis in free support model. We are afraid that at this point we are unable to share any rough ETA. However, yes, the ticket priority will be changed and escalated to the highest if its reported in paid support forum. We’ve logged a dedicated ticket as PDFJAVA-42252 for Java API too.

Hi @asad.ali,

Just saw the Aspose.PDF for .NET 23.5 Release Notes and there is a line referencing “PDFNET-53220 Add support for Factur-X format for electronic Invoices”. It might solve our issues mentioned in this post. Is there any documentation with some details regarding this new “feature” ?

Thanks

@ggros123

That issue was a bit different where the conversion was broken due to presence of the signatures inside source PDF document. It was resolved after removing the signatures. Your issue however of different nature where you want a different/newer version of the Factur-X standard and unnecessary things should not be part of it. The ticket is currently under the phase of the investigation and we will surely inform you once we make some progress towards its correction.

We apologize for your inconvenience.