write_facturx.json

The JSON file of the “Factur-X: the electronic invoice” example. The electronic invoice French law has required since September 2026: one file, a page a person reads and the same invoice inside it as XML. Nothing to reconcile afterwards, because there is only ever one invoice.

JSON 89 lines

This file is a request: an application sends it over the network to the server, which creates the PDF and sends it back. It makes the same page as the Rust and Python versions of this example. A request names every file it uses, never its content; the call carries the request and the files together. A font the server already holds, such as DejaVuSans, is named with nothing attached. Send the request to the address the API page gives.

This request names files it does not carry: invoice_xml. Each one travels beside the request, in the same call, as a supplied part named exactly as the request names it here — the description says which name plays which role, so you name your files as you like. A request naming a file the call carries nothing of is refused.

What this example is for

Since 1 September 2026, every business in France registered for VAT has to be able to receive an electronic invoice, and the large and mid-sized ones have to send theirs in that form. Smaller businesses follow on 1 September 2027. An invoice that is only a well-made page stops counting as an invoice, and not issuing one electronically is charged at 50 € an invoice, up to 15 000 € a year.

What this example shows

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
{
  "items": [
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 760.0,
        "urx": 520.0,
        "ury": 779.2
      },
      "content": [
        "Invoice No. 1964413"
      ],
      "font": "DejaVuSans",
      "font_size": 16.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 728.0,
        "urx": 520.0,
        "ury": 741.2
      },
      "content": [
        "Issued 14 July 2026 — due within 30 days"
      ],
      "font": "DejaVuSans",
      "font_size": 11.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 706.0,
        "urx": 520.0,
        "ury": 719.2
      },
      "content": [
        "Rendering engine development .............. 4 250.00 EUR"
      ],
      "font": "DejaVuSans",
      "font_size": 11.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 684.0,
        "urx": 520.0,
        "ury": 697.2
      },
      "content": [
        "VAT at 20 % ................................. 850.00 EUR"
      ],
      "font": "DejaVuSans",
      "font_size": 11.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 662.0,
        "urx": 520.0,
        "ury": 676.4
      },
      "content": [
        "Total due ................................. 5 100.00 EUR"
      ],
      "font": "DejaVuSans",
      "font_size": 12.0
    }
  ],
  "metadata": {
    "title": "Invoice No. 1964413",
    "author": "Olivier Pons",
    "subject": "An electronic invoice, in the Factur-X format",
    "producer": "hqf-pdf",
    "created": "2026-07-14T09:30:00+02:00"
  },
  "archive": "pdfa3b",
  "invoice": {
    "xml": "invoice_xml",
    "profile": "MINIMUM",
    "version": "1.0",
    "relationship": "data",
    "issued": "2026-07-14T09:30:00+02:00"
  }
}