How to make PDF invoice with embeded XML compatible with UBL standard

Hey Guys,

I am working on Saudi Arabia Fatoora system which is the same of UBL standard and I created a PDF invoice by using mPDF library but I could not understand how to make it in XML format with UBL standard.

Any one can explain it to me please


Hello @Cisco_Saeed,

I have, after a long time, come back to this forum and noticed by chance your post.
If I interpret your post correctly then I think I can help you quite a bit.
You might want to read these posts from a few years (4/5) ago on this very subject you are apparently looking for.

At the moment, using my modifications in IP, I can:

  • send a UBL invoice via email to a customer including a separate pdf and an xml invoice in UBL 2.1 format (with an embedded pdf in the xml file if necessary).
  • If the customer for example wants an invoice in the specific Saudi Arabia Fatoora format (EN 16931 format) then this can also be set.
  • A prerequisite is that a specific xml template must be created so that the correct format can be chosen for that customer.

May I know the purpose of your question and what you would like to achieve/do with this?
Are you a developer who would like to further modify or extend IP?

Kind regards,


Hello @VeRony ,

Many thanks for reply and very useful information, I am working on PHP invoice system as developer and I created and QR code base64 and PDF invoice but want to embed the UBL XML as Saudi Arabia standard which is I think is the same Europe standard and I have sample for their needs.

Hi @Cisco_Saeed,

Just for your information:
If I see it correctly then your intention is, using IP, to create a pdf invoice and embed an xml file in it.
This is the way Germany formats its e-invoices (zugferd or xrechnung). The rest of Europe takes a different (and much better/future) approach, namely they create an xml file (in a UBL - EN16931 or PEPPOL format) where they can “optionally” embed a pdf.
The formatting of an xrechnung/zugferd xml file is also completely different. They use different tags than the ones you see in the “normal” UBL 2.1 format. Looking at the Fatoora format I noticed that it is a copy (with some modifications) of the European EN 16931 format.
So it seems to me that it would be better to go for an external XML file with (embedding or not) PDF.

Having said that and in response to your post I would like to suggest that:

  • I provide you with my customizations (in PHP and with examples)
  • I explain to you; how, what and why I did it this way
  • ‘in return and for the IP community’ I do expect you to add this code into the GitHub IP repository…

Perhaps it would be better, if you wish, that we continue this communication via email…?

Have a nice day,

1 Like

Can we contact by email:

Hi @Cisco_Saeed,

Two months ago I forwarded you a detailed explanation and several php examples to your email address.
Unfortunately, I have not heard from you since then :disappointed:.

I am still curious if you have done anything with my examples or help…?

Hello VeRony,

I am so busy these days and I send you email :slight_smile:

Regarding UBL standard I have an idea to make a standard XML file with invoice variables and variables can read from PHP invoice file.