Is it possible to embed a (German) "elektronische Rechnung" in the "ZugFerD"-Format (XML) into the PDF with WPPDF? (PDF/A-3)
Embed XML for "elektronische Rechnung" (ZugFerD)
-
-
- Official Post
Yes. You need to activate PDFA mode
https://www.wpcubed.com/manuals/wpdf/m…eattachment.htm
https://www.wpcubed.com/manuals/wpdf/method_addxmpextra.htm -
Yes. You need to activate PDFA mode
Is this PDF/A-3? If I put the file into a validator it says it's PDF/A-1B. But I may use the validator wrong.
There is some discussion in the Delphi-PRAXIS board that the example may be outdated: Delphi-PRAXiS - Einzelnen Beitrag anzeigen - Wie sieht die Zukunft mit XRechnung, ZUGFerD, Peppol und Co. aus ? (delphipraxis.net)
wPDFMan.pdf that comes with wPDF 5 differs a bit. -
- Official Post
A new version with invoice embedding is currently beeing developed.
The mode wpdfaLevel3B should be set for ZUGFeRD.
-
- New
- Official Post
Now available:
WPXOrder, a collection of Delphi units to create X-Factur (ZUGFeRD) XML data.
Please see WPXOrder - create and read X-Factur/ZUGFeRD XML
the source code and also an example is available on GitHub wpcubed/xorder
Also see here:
WPXOrder - X-Factur (ZUGFeRD) XML Daten lesen und erzeugen - Delphi-PRAXiS
-
- New
- Official Post
To embed the created XML with wPDF you can use this code.
The example assumes the XML code has been already saved to the database in the blob field OrdersINVOICEXML.
The Invoice has been created with WPTools and is exported using the WPPDFExport1 component.
Code
Display Moreprocedure TForm1.btnCreatePDF(Sender: TObject); var mem : TMemoryStream; lst : TStringList; s : string; begin mem := TMemoryStream.Create; try WPPDFExport1.Info.Producer := 'wPDF - https://www.wpcubed.com'; if FileExists(PDFName.Text) then begin if MessageDlg('PDF Datei existiert. Überschreiben?',mtConfirmation, [mbYes, mbNo],0)=ID_NO then begin PDFName.SelectAll; PDFName.SetFocus; exit; end; end; WPPDFExport1.FileName := PDFName.Text; WPPDFExport1.AutoLaunch := false; WPPDFExport1.CompressStreamMethod := wpCompressFlate; WPPDFExport1.Source.ReformatAll(true); WPPDFExport1.Source.ReformatAll(true); WPPDFExport1.FontMode := wpEmbedCIDFonts; OrdersINVOICEXML.SaveToStream(mem); mem.Position := 0; if mem.Size>0 then begin WPPDFExport1.PDFAMode := wpdfaLevel3B; lst := TStringList.Create; s := Format( pdfa_xfactur_info, [pdfa_xfactur_filename,'EXTENDED'] ); WPPDFExport1.AddXMPExtra( pdfa_xfactur_schema, s ); lst.Free; end; WPPDFExport1.BeginDoc; try if mem.Size>0 then WPPDFExport1.AddFileAttachment( pdfa_xfactur_filename, pdfa_xfactur_description, mem, 'text/xml', now, [wpDontCompressData]) else ShowMessage('Keine XML Daten für X-Factur vorhanden, erzeuge reguläres PDF'); WPPDFExport1.Print; finally WPPDFExport1.EndDoc; end; PDFName.SelectAll; PDFName.SetFocus; finally mem.Free; end; end;