Hello,
I am evaluating Aspose.Pdf to see if it can be used to generate ZUGFeRD-compatible PDFs.
ZUGFeRD is a German standard for electronic invoices. Basically you attach an XML file (representing an invoice) to a PDF and add various metadata.
My questions are:
1) According to the ZUGFeRD standard, the mime type of the attachment must be set to “text/xml”. There is a MIMEType field on the FileSpecification class, but whenever I try to set it I get a NullReferenceException. I am us the latest evaluation version of Aspose.Pdf.
Document doc = new Document(“in.pdf”);
Stream fs = File.OpenRead(“zugferd-invoice.xml”);
FileSpecification spec = new FileSpecification(fs, “ZUGFeRD invoice in XML format”);
spec.Description = “ZUGFeRD invoice in XML format”;
spec.Name = “ZUGFeRD-invoice.xml”;
spec.Contents = fs;
spec.MIMEType = “text/xml”; // NullReferenceException here
doc.Save(“out.pdf”);
Is it possible to set the mime type with Aspose.Pdf or is this not supported?
2) It is also necessary to specify the relationship between the attached file and the PDF part in the “document dictionary”. Does Aspose.Pdf have support for this? I might be using the wrong terms here since I’m not so well-acquainted with the PDF standard, but if you look at this link:
vb.net - iTextSharp XML ZUGFeRD-invoice.xml attachment - Stack Overflow
What I want to know if Aspose.Pdf has some equivalent for this line:
fileSpec.Put(New PdfName(“AFRelationship”), New PdfName(“Alternative”))
andreas.jonsson:I am evaluating Aspose.Pdf to see if it can be used to generate ZUGFeRD-compatible PDFs.
ZUGFeRD is a German standard for electronic invoices. Basically you attach an XML file (representing an invoice) to a PDF and add various metadata.
My questions are:
1) According to the ZUGFeRD standard, the mime type of the attachment must be set to “text/xml”. There is a MIMEType field on the FileSpecification class, but whenever I try to set it I get a NullReferenceException. I am us the latest evaluation version of Aspose.Pdf.
Document doc = new Document(“in.pdf”);
Stream fs = File.OpenRead(“zugferd-invoice.xml”);
FileSpecification spec = new FileSpecification(fs, “ZUGFeRD invoice in XML format”);
spec.Description = “ZUGFeRD invoice in XML format”;
spec.Name = “ZUGFeRD-invoice.xml”;
spec.Contents = fs;
spec.MIMEType = “text/xml”; // NullReferenceException here
doc.Save(“out.pdf”);
Is it possible to set the mime type with Aspose.Pdf or is this not supported?
I
have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-38577. We
will investigate this issue in details and will keep you updated on the status
of a correction. <o:p></o:p>
We apologize for your inconvenience.
I have an investigation ticket to support the creation of ZUGFeRD attachments as PDFNEWNET-38578. We will further look into the details of this requirement and will keep you posted with our findings.andreas.jonsson:2) It is also necessary to specify the relationship between the attached file and the PDF part in the "document dictionary". Does Aspose.Pdf have support for this? I might be using the wrong terms here since I'm not so well-acquainted with the PDF standard, but if you look at this link:
http://stackoverflow.com/questions/26036852/itextsharp-xml-zugferd-invoice-xml-attachment
What I want to know if Aspose.Pdf has some equivalent for this line:
fileSpec.Put(New PdfName("AFRelationship"), New PdfName("Alternative"))
Hi,
has there been any progress on these tickets?
I’ve also been trying to create a ZUGFeRD-compliant PDF and ran into exactly the same problems as Andreas - after which some googling led me here.
Is there any chance this is going to work in the near future?
Hi Steffen,
Hi,
7 more months gone and still no ZUGFeRD-Support? (Aspose.PDF 11.4.0). I’m evaluating Aspose.PDF but may have to DIspose it, if there is no solution in the near future
Hi Harald,
I’ve to second this request, this requirement becomes more important in future, so at least some informations about the priorization / roadmap of this issue should be given.
Hi Christian,
Hello,
as this topic is serious business in Germany and a requirement for digital invoices in some industry sectors, i attached some official samples of zugferd-documents for review.
The thread was opened one year ago and still it is not even possible to set some simple properties at the embedded file (like the stream mime - it’s only a getter that returns null when adding a xml-stream).
Hi Christian,
I’d like to share some things i found out so far:
it is possible to set the mimetype of the included xml, but you have to add the filespec to the doc before doing so.
A.Document doc = new A.Document(@"D:\temp\in.pdf"); doc.Convert(@"D:\Temp\pdfconvert.xml", A.PdfFormat.PDF_A_3A, A.ConvertErrorAction.None); FileStream fs = File.OpenRead(xmlpath); A.FileSpecification spec = new A.FileSpecification(fs, "ZUGFeRD invoice in XML format"); spec.Name = "ZUGFeRD-invoice.xml"; spec.Description = "ZUGFeRD Rechnung"; doc.EmbeddedFiles.Add(spec); spec.MIMEType = "text/xml"; spec.Params = new A.FileParams(spec) { ModDate = info.LastWriteTime, CreationDate = info.CreationTime };
also it is possible to add the xmp extension schema.
Missing things are:
-
/Type: /EmbeddedFile
(at the Stream) -
/AFRelationship: /Alternative
(at the FileSpecification) -
FileSpecification.Params.Size
is not calculated
Hi Christian,
Hi Matthias,
Hi Matthias,
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px ‘Helvetica Neue’; -webkit-text-stroke: #000000}
span.s1 {font-kerning: none}
span.s2 {text-decoration: underline ; font-kerning: none; color: #9e4b2f; -webkit-text-stroke: 0px #9e4b2f}
Hey Fahadadeel,
Any update on this or an ETA on the implementation?
There is no update regarding the support of ZUGFeRD attachments. Our product team will investigate as per their development schedules. We will let you know once a significant progress has been made in this regard.
Hello,
I am facing the same Problem. we want to switch to Aspose PDF and We have to create PDF-Files for the ZUGFeRD-Format. In the meantime other countries in Europe want to use this too.
the sample Code of Andreas has still the same Problem at Setting the mimetype. Do you have experience in creating ZUGFeRD compliant PDF-files ?
Regards
Jörg
Thanks for your inquiry.
I am afraid that earlier logged ticket regarding ZUGFeRD-Format support is still pending due to other high priority issues in the queue. However, would you please share some more details about this format specifications. It would help us investigating the feasibility of feature and provide our feedback accordingly.