An archival sheet carrying fields of its own

A records office's reference, the department it came from, the date until which the document must be kept and its classification, in a PDF/A-3 file. No standard knows what a retention date is, so each field arrives with a description of itself — its type, who it is written for, what it means — which is what makes checking software accept information you invented. The page prints the same list, so what a person reads and what a machine reads cannot drift apart.

JSON write_own_schema.json 244 lines

This one is not a program. It is the request the document server is sent: the same page, asked for over the network by an application that writes no PDF code at all.

This request reproduces the page rather than describing it the way the library example does. The library sets the two tables with a tab ruler and a hanging list, which a request cannot ask for: the five names of the second table are placed here one by one, each on the line its description falls on. The page comes out the same to the dot; what is being asked for does not read the same.

  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
    }
  ]
}