write_own_schema.json

Le fichier JSON de l'exemple « Un fichier qui explique ses entrées ». La référence d'un service d'archives, le département dont le document vient, la date jusqu'à laquelle il doit être gardé et sa classification, portés dans un fichier qu'une archive accepte encore. Aucune règle d'archivage ne sait ce qu'est une date de conservation, donc chaque entrée porte une description d'elle-même, et c'est cette description qui fait accepter à un contrôleur un fait que vous seul avez inventé.

JSON 244 lignes

Ce fichier est une requête : une application l'envoie par le réseau au serveur, qui crée le PDF et le renvoie. Il donne la même page que les versions Rust et Python de cet exemple. Une requête nomme chaque fichier qu'elle emploie, jamais le contenu de ces fichiers ; l'appel porte la requête et les fichiers ensemble. Une police que le serveur détient déjà, comme DejaVuSans, se nomme sans rien y joindre. Envoyez la requête à l'adresse que donne la page de l'API.

Cette demande reproduit la page au lieu de la décrire comme le fait l'exemple de la bibliothèque. La bibliothèque compose les deux tableaux avec des taquets et une liste pendante, ce qu'une demande ne sait pas réclamer : les cinq noms du second tableau sont posés ici un par un, chacun sur la ligne où tombe sa description. La page sort identique au point près ; ce qui est demandé, lui, ne se lit pas pareil.

À quoi sert cet exemple

Sur le papier, un service d'archives écrit sur la chemise elle-même : la référence, le bureau d'où elle vient, la date après laquelle elle peut être détruite. Numérisez la chemise et cette écriture n'a plus nulle part où aller. Écrivez-la à l'intérieur du fichier et il arrive pire — le fichier cesse en silence d'obéir aux règles d'archivage qu'il dit suivre, et le jour où quelqu'un le contrôle, il revient refusé.

Ce que montre cet exemple

  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
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
{
  "archive": "pdfa3b",
  "metadata": {
    "title": "Records office cover sheet RO-2026-004318",
    "author": "Olivier Pons",
    "subject": "An archival sheet carrying metadata of its own",
    "producer": "hqf-pdf",
    "created": "2026-07-14T09:30:00+02:00",
    "schemas": [
      {
        "name": "Records Office Schema",
        "namespace": "https://hqf-pdf.example/ns/records/1.0/",
        "prefix": "rec",
        "properties": [
          {
            "name": "Reference",
            "value": "RO-2026-004318",
            "description": "The reference the records office files the dossier under",
            "value_type": "text",
            "category": "external"
          },
          {
            "name": "Department",
            "value": "Planning",
            "description": "The department the dossier came from",
            "value_type": "text",
            "category": "external"
          },
          {
            "name": "RetainUntil",
            "value": "2056-12-31T23:59:59+01:00",
            "description": "The date the dossier may be destroyed, and not before",
            "value_type": "date",
            "category": "internal"
          },
          {
            "name": "Classification",
            "value": "Public",
            "description": "How widely the dossier may be circulated",
            "value_type": "text",
            "category": "external"
          },
          {
            "name": "Sheets",
            "value": "1",
            "description": "How many sheets the dossier holds",
            "value_type": "integer",
            "category": "internal"
          }
        ]
      }
    ]
  },
  "items": [
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 756.0,
        "urx": 523.0,
        "ury": 780.0
      },
      "content": [
        "Records office cover sheet"
      ],
      "font": "DejaVuSans",
      "font_size": 20.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 727.0,
        "urx": 523.0,
        "ury": 742.0
      },
      "content": [
        "The fields below are the records office's own. No part of the PDF standard knows what a retention date is, so the file explains itself: each field arrives in the metadata packet with its name, the way it is to be read, who it is written for, and what it means. An archival validator accepts them on that description, and refuses metadata that turns up without one."
      ],
      "font": "DejaVuSans",
      "font_size": 10.5,
      "leading": 15.0,
      "align": "justify"
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 616.6,
        "urx": 523.0,
        "ury": 631.0
      },
      "content": [
        "What the sheet says"
      ],
      "font": "DejaVuSans",
      "font_size": 12.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 591.6,
        "urx": 523.0,
        "ury": 608.6
      },
      "content": [
        "Reference\nDepartment\nRetainUntil\nClassification\nSheets"
      ],
      "font": "DejaVuSans",
      "font_size": 11.0,
      "leading": 17.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 222.0,
        "lly": 591.6,
        "urx": 523.0,
        "ury": 608.6
      },
      "content": [
        "RO-2026-004318\nPlanning\n2056-12-31T23:59:59+01:00\nPublic\n1"
      ],
      "font": "DejaVuSans",
      "font_size": 11.0,
      "leading": 17.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 489.2,
        "urx": 523.0,
        "ury": 503.6
      },
      "content": [
        "What the packet declares of each of them"
      ],
      "font": "DejaVuSans",
      "font_size": 12.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 222.0,
        "lly": 467.2,
        "urx": 523.0,
        "ury": 481.2
      },
      "content": [
        "Text · external · The reference the records office files the dossier under\nText · external · The department the dossier came from\nDate · internal · The date the dossier may be destroyed, and not before\nText · external · How widely the dossier may be circulated\nInteger · internal · How many sheets the dossier holds"
      ],
      "font": "DejaVuSans",
      "font_size": 9.5,
      "leading": 14.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 467.2,
        "urx": 222.0,
        "ury": 478.6
      },
      "content": [
        "rec:Reference"
      ],
      "font": "DejaVuSans",
      "font_size": 9.5
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 439.2,
        "urx": 222.0,
        "ury": 450.6
      },
      "content": [
        "rec:Department"
      ],
      "font": "DejaVuSans",
      "font_size": 9.5
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 425.2,
        "urx": 222.0,
        "ury": 436.6
      },
      "content": [
        "rec:RetainUntil"
      ],
      "font": "DejaVuSans",
      "font_size": 9.5
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 397.2,
        "urx": 222.0,
        "ury": 408.6
      },
      "content": [
        "rec:Classification"
      ],
      "font": "DejaVuSans",
      "font_size": 9.5
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 383.2,
        "urx": 222.0,
        "ury": 394.6
      },
      "content": [
        "rec:Sheets"
      ],
      "font": "DejaVuSans",
      "font_size": 9.5
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 352.2,
        "urx": 523.0,
        "ury": 365.2
      },
      "content": [
        "Every value above is written twice: once on this page, and once in the packet a machine reads, under the prefix the schema names. Reading the file's metadata gives back this table, field for field."
      ],
      "font": "DejaVuSans",
      "font_size": 9.0,
      "leading": 13.0
    }
  ]
}