write_portfolio.json

The JSON file of the “A tender pack of three lots” example. Three lots, each travelling as a file of its own, under the columns the document itself states — lot, day sent, total — sorted on the day, newest first. The cover sheet lays the same columns out for reading software that shows no pack.

JSON 388 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: lot_a, lot_b, lot_c. 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

Three firms answer a call for tenders, and what arrives is three sets of figures that have to stay apart and travel together. Each lot goes into this document as a file of its own, whole, in the shape it was sent in. What turns that from a bag of attachments into a pack somebody can work through is the rest: the document names the columns the files are shown under — the lot, the day it was sent, what it comes to — says what each file puts in each of them, and says the list is sorted on the day, newest first.

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
 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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
{
  "items": [
    {
      "type": "text",
      "rect": {
        "llx": 56.0,
        "lly": 780.0,
        "urx": 539.0,
        "ury": 799.2
      },
      "content": [
        "Tender pack: three lots"
      ],
      "font": "DejaVuSans",
      "font_size": 16.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 56.0,
        "lly": 638.0,
        "urx": 539.0,
        "ury": 750.0
      },
      "content": [
        "Every lot of this tender travels in the pack as a file of its own. The document states the columns the files are shown in, what each file holds for each of them, and that the list is sorted on the day it was sent, newest first."
      ],
      "font": "DejaVuSans",
      "font_size": 10.0,
      "leading": 14.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 56.0,
        "lly": 676.0,
        "urx": 539.0,
        "ury": 686.8
      },
      "content": [
        "File"
      ],
      "font": "DejaVuSans",
      "font_size": 9.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 152.0,
        "lly": 676.0,
        "urx": 539.0,
        "ury": 686.8
      },
      "content": [
        "Lot"
      ],
      "font": "DejaVuSans",
      "font_size": 9.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 356.0,
        "lly": 676.0,
        "urx": 539.0,
        "ury": 686.8
      },
      "content": [
        "Sent"
      ],
      "font": "DejaVuSans",
      "font_size": 9.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 448.0,
        "lly": 676.0,
        "urx": 539.0,
        "ury": 686.8
      },
      "content": [
        "Total"
      ],
      "font": "DejaVuSans",
      "font_size": 9.0
    },
    {
      "type": "line",
      "from": {
        "x": 56.0,
        "y": 670.0
      },
      "to": {
        "x": 539.0,
        "y": 670.0
      },
      "stroke": {
        "width": 0.5,
        "color": [
          0.75,
          0.75,
          0.75
        ]
      }
    },
    {
      "type": "text",
      "rect": {
        "llx": 56.0,
        "lly": 648.0,
        "urx": 539.0,
        "ury": 660.0
      },
      "content": [
        "lot-a.xml"
      ],
      "font": "DejaVuSans",
      "font_size": 10.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 152.0,
        "lly": 648.0,
        "urx": 539.0,
        "ury": 660.0
      },
      "content": [
        "Earthworks and site clearance"
      ],
      "font": "DejaVuSans",
      "font_size": 10.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 356.0,
        "lly": 648.0,
        "urx": 539.0,
        "ury": 660.0
      },
      "content": [
        "2026-07-14"
      ],
      "font": "DejaVuSans",
      "font_size": 10.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 448.0,
        "lly": 648.0,
        "urx": 539.0,
        "ury": 660.0
      },
      "content": [
        "EUR 18,400.00"
      ],
      "font": "DejaVuSans",
      "font_size": 10.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 56.0,
        "lly": 626.0,
        "urx": 539.0,
        "ury": 638.0
      },
      "content": [
        "lot-b.xml"
      ],
      "font": "DejaVuSans",
      "font_size": 10.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 152.0,
        "lly": 626.0,
        "urx": 539.0,
        "ury": 638.0
      },
      "content": [
        "Drainage and services"
      ],
      "font": "DejaVuSans",
      "font_size": 10.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 356.0,
        "lly": 626.0,
        "urx": 539.0,
        "ury": 638.0
      },
      "content": [
        "2026-08-03"
      ],
      "font": "DejaVuSans",
      "font_size": 10.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 448.0,
        "lly": 626.0,
        "urx": 539.0,
        "ury": 638.0
      },
      "content": [
        "EUR 9,250.00"
      ],
      "font": "DejaVuSans",
      "font_size": 10.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 56.0,
        "lly": 604.0,
        "urx": 539.0,
        "ury": 616.0
      },
      "content": [
        "lot-c.xml"
      ],
      "font": "DejaVuSans",
      "font_size": 10.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 152.0,
        "lly": 604.0,
        "urx": 539.0,
        "ury": 616.0
      },
      "content": [
        "Surfacing and lining"
      ],
      "font": "DejaVuSans",
      "font_size": 10.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 356.0,
        "lly": 604.0,
        "urx": 539.0,
        "ury": 616.0
      },
      "content": [
        "2026-06-28"
      ],
      "font": "DejaVuSans",
      "font_size": 10.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 448.0,
        "lly": 604.0,
        "urx": 539.0,
        "ury": 616.0
      },
      "content": [
        "EUR 31,700.00"
      ],
      "font": "DejaVuSans",
      "font_size": 10.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 56.0,
        "lly": 470.8,
        "urx": 539.0,
        "ury": 566.0
      },
      "content": [
        "A reading software that shows a portfolio lays the three files out in these columns. One that does not still opens the pack and lists the files, which is why they are named on this sheet too."
      ],
      "font": "DejaVuSans",
      "font_size": 8.5,
      "leading": 11.899999999999999,
      "color": [
        0.35,
        0.35,
        0.35
      ]
    }
  ],
  "collection": {
    "view": "rows",
    "columns": [
      {
        "key": "lot",
        "title": "Lot",
        "data": "text"
      },
      {
        "key": "sent",
        "title": "Sent",
        "data": "date"
      },
      {
        "key": "total",
        "title": "Total",
        "data": "number"
      }
    ],
    "sort": {
      "key": "sent",
      "ascending": false
    }
  },
  "attachments": [
    {
      "name": "lot_a",
      "file_name": "lot-a.xml",
      "description": "Earthworks and site clearance",
      "media_type": "application/xml",
      "relationship": "source",
      "modified": "2026-07-14T09:30:00+02:00",
      "columns": [
        {
          "key": "lot",
          "text": "Earthworks and site clearance"
        },
        {
          "key": "sent",
          "date": "2026-07-14T09:30:00+02:00"
        },
        {
          "key": "total",
          "number": 18400.0
        }
      ]
    },
    {
      "name": "lot_b",
      "file_name": "lot-b.xml",
      "description": "Drainage and services",
      "media_type": "application/xml",
      "relationship": "source",
      "modified": "2026-08-03T16:05:00+02:00",
      "columns": [
        {
          "key": "lot",
          "text": "Drainage and services"
        },
        {
          "key": "sent",
          "date": "2026-08-03T16:05:00+02:00"
        },
        {
          "key": "total",
          "number": 9250.0
        }
      ]
    },
    {
      "name": "lot_c",
      "file_name": "lot-c.xml",
      "description": "Surfacing and lining",
      "media_type": "application/xml",
      "relationship": "source",
      "modified": "2026-06-28T11:20:00+02:00",
      "columns": [
        {
          "key": "lot",
          "text": "Surfacing and lining"
        },
        {
          "key": "sent",
          "date": "2026-06-28T11:20:00+02:00"
        },
        {
          "key": "total",
          "number": 31700.0
        }
      ]
    }
  ]
}