write_dotted_rules.json

Die JSON-Datei des Beispiels „Gestrichelte und gepunktete Linien“. Striche und Punkte, die Form der Linienenden, die Form ihrer Ecken: jedes als eine Linie unter diesen Einstellungen gezeichnet. Der Auszug unten ist mit Punkten liniert, und seine Summe ist durch eine gestrichelte Linie abgesetzt.

JSON 361 Zeilen

Diese Datei ist eine Anfrage: Eine Anwendung sendet sie über das Netz an den Server, der das PDF erzeugt und zurücksendet. Sie erzeugt dieselbe Seite wie die Rust- und die Python-Fassung dieses Beispiels. Eine Anfrage nennt jede Datei, die sie verwendet, nie ihren Inhalt; der Aufruf trägt die Anfrage und die Dateien zusammen. Eine Schrift, die der Server bereits vorhält, etwa DejaVuSans, wird ohne Anhang genannt. Senden Sie die Anfrage an die Adresse, die die API-Seite angibt.

Diese Anfrage schreibt die Höhe aus, auf der jede Überschrift und jedes Muster beginnt, wo die Bibliothek jede davon dort ansetzt, wo der Block darüber geendet hat. Die Linien selbst sind auf beiden Seiten derselbe Strich; setzen Sie die Seite in einer anderen Schrift, würde die Bibliothek alles mit nach unten nehmen, während es hier stehen bliebe.

Wofür dieses Beispiel da ist

Der Abschluss eines Buchhalters liest sich leichter, wenn die Linien zwischen seinen Zeilen zurückhaltend sind: eine Haarlinie aus Punkten statt einer durchgezogenen Linie und eine gestrichelte Linie über der Summe. Der übliche Weg dahin ist, sehr viele kurze Striche zu zeichnen und zu hoffen, dass die Abstände eine Änderung der Spaltenbreite überstehen — was sie nicht tun, und an dem Tag, an dem die Tabelle eine Zeile dazubekommt, zählt jemand Punkte von Hand.

Was dieses Beispiel zeigt

  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
{
  "items": [
    {
      "type": "text",
      "rect": {"llx": 72, "lly": 761.6, "urx": 523, "ury": 782},
      "content": ["Lines that are not solid"],
      "font": "DejaVuSans",
      "font_size": 17
    },
    {
      "type": "text",
      "rect": {"llx": 72, "lly": 704, "urx": 523, "ury": 749.6},
      "content": ["A stroke says how thick it is and what colour it is drawn in, and it may also say how the ink is laid down: the dashes and gaps it follows, the shape at its two ends, and the shape where two of its segments meet. Nothing below is drawn twice — each line is one stroke, told what to look like."],
      "font": "DejaVuSans",
      "font_size": 9.5
    },

    {
      "type": "text",
      "rect": {"llx": 72, "lly": 668.8, "urx": 523, "ury": 682},
      "content": ["Four patterns"],
      "font": "DejaVuSans",
      "font_size": 11
    },
    {
      "type": "line",
      "from": {"x": 72, "y": 652.8},
      "to": {"x": 222, "y": 652.8},
      "stroke": {"width": 1.5, "color": [0, 0, 0]}
    },
    {
      "type": "text",
      "rect": {"llx": 238, "lly": 644.4, "urx": 523, "ury": 655.8},
      "content": ["Solid, which is what a stroke does when it is told nothing"],
      "font": "DejaVuSans",
      "font_size": 9.5
    },
    {
      "type": "line",
      "from": {"x": 72, "y": 632.8},
      "to": {"x": 222, "y": 632.8},
      "stroke": {"width": 1.5, "color": [0, 0, 0], "dash": {"lengths": [4, 2]}}
    },
    {
      "type": "text",
      "rect": {"llx": 238, "lly": 624.4, "urx": 523, "ury": 635.8},
      "content": ["Dashes of four points, gaps of two"],
      "font": "DejaVuSans",
      "font_size": 9.5
    },
    {
      "type": "line",
      "from": {"x": 72, "y": 612.8},
      "to": {"x": 222, "y": 612.8},
      "stroke": {"width": 1.5, "color": [0, 0, 0], "dash": {"lengths": [3]}}
    },
    {
      "type": "text",
      "rect": {"llx": 238, "lly": 604.4, "urx": 523, "ury": 615.8},
      "content": ["Dashes and gaps of the same three points"],
      "font": "DejaVuSans",
      "font_size": 9.5
    },
    {
      "type": "line",
      "from": {"x": 72, "y": 592.8},
      "to": {"x": 222, "y": 592.8},
      "stroke": {"width": 1.5, "color": [0, 0, 0], "dash": {"lengths": [0, 4]}, "cap": "round"}
    },
    {
      "type": "text",
      "rect": {"llx": 238, "lly": 584.4, "urx": 523, "ury": 595.8},
      "content": ["Dots, which are dashes of no length at all"],
      "font": "DejaVuSans",
      "font_size": 9.5
    },

    {
      "type": "text",
      "rect": {"llx": 72, "lly": 549.6, "urx": 523, "ury": 562.8},
      "content": ["Three ends"],
      "font": "DejaVuSans",
      "font_size": 11
    },
    {
      "type": "line",
      "from": {"x": 84, "y": 531.6},
      "to": {"x": 162, "y": 531.6},
      "stroke": {"width": 9, "color": [0.45, 0.45, 0.45], "cap": "butt"}
    },
    {
      "type": "line",
      "from": {"x": 162, "y": 521.6},
      "to": {"x": 162, "y": 541.6},
      "stroke": {"width": 0.4, "color": [0.75, 0.1, 0.1]}
    },
    {
      "type": "text",
      "rect": {"llx": 190, "lly": 523.2, "urx": 511, "ury": 534.6},
      "content": ["Squared off"],
      "font": "DejaVuSans",
      "font_size": 9.5
    },
    {
      "type": "line",
      "from": {"x": 84, "y": 505.6},
      "to": {"x": 162, "y": 505.6},
      "stroke": {"width": 9, "color": [0.45, 0.45, 0.45], "cap": "round"}
    },
    {
      "type": "line",
      "from": {"x": 162, "y": 495.6},
      "to": {"x": 162, "y": 515.6},
      "stroke": {"width": 0.4, "color": [0.75, 0.1, 0.1]}
    },
    {
      "type": "text",
      "rect": {"llx": 190, "lly": 497.2, "urx": 511, "ury": 508.6},
      "content": ["Rounded"],
      "font": "DejaVuSans",
      "font_size": 9.5
    },
    {
      "type": "line",
      "from": {"x": 84, "y": 479.6},
      "to": {"x": 162, "y": 479.6},
      "stroke": {"width": 9, "color": [0.45, 0.45, 0.45], "cap": "projecting"}
    },
    {
      "type": "line",
      "from": {"x": 162, "y": 469.6},
      "to": {"x": 162, "y": 489.6},
      "stroke": {"width": 0.4, "color": [0.75, 0.1, 0.1]}
    },
    {
      "type": "text",
      "rect": {"llx": 190, "lly": 471.2, "urx": 511, "ury": 482.6},
      "content": ["Squared off past the end"],
      "font": "DejaVuSans",
      "font_size": 9.5
    },

    {
      "type": "text",
      "rect": {"llx": 72, "lly": 434.4, "urx": 523, "ury": 447.6},
      "content": ["Three corners"],
      "font": "DejaVuSans",
      "font_size": 11
    },
    {
      "type": "path",
      "segments": [
        {"move_to": {"x": 72, "y": 388.4}},
        {"line_to": {"x": 96, "y": 422.4}},
        {"line_to": {"x": 120, "y": 388.4}}
      ],
      "stroke": {"width": 9, "color": [0, 0, 0], "join": "miter"}
    },
    {
      "type": "text",
      "rect": {"llx": 72, "lly": 370.2, "urx": 168, "ury": 380.4},
      "content": ["Pointed"],
      "font": "DejaVuSans",
      "font_size": 8.5
    },
    {
      "type": "path",
      "segments": [
        {"move_to": {"x": 222, "y": 388.4}},
        {"line_to": {"x": 246, "y": 422.4}},
        {"line_to": {"x": 270, "y": 388.4}}
      ],
      "stroke": {"width": 9, "color": [0, 0, 0], "join": "round"}
    },
    {
      "type": "text",
      "rect": {"llx": 222, "lly": 370.2, "urx": 318, "ury": 380.4},
      "content": ["Rounded"],
      "font": "DejaVuSans",
      "font_size": 8.5
    },
    {
      "type": "path",
      "segments": [
        {"move_to": {"x": 372, "y": 388.4}},
        {"line_to": {"x": 396, "y": 422.4}},
        {"line_to": {"x": 420, "y": 388.4}}
      ],
      "stroke": {"width": 9, "color": [0, 0, 0], "join": "bevel"}
    },
    {
      "type": "text",
      "rect": {"llx": 372, "lly": 370.2, "urx": 468, "ury": 380.4},
      "content": ["Cut off"],
      "font": "DejaVuSans",
      "font_size": 8.5
    },

    {
      "type": "text",
      "rect": {"llx": 72, "lly": 341.2, "urx": 523, "ury": 354.4},
      "content": ["A statement ruled with dots"],
      "font": "DejaVuSans",
      "font_size": 11
    },
    {
      "type": "table",
      "columns": {"widths": [{"fraction": 1.0}, {"points": 110.0}], "total": 451.0},
      "first": {"llx": 72, "lly": 96, "urx": 523, "ury": 329.2},
      "next": {"llx": 72, "lly": 96, "urx": 523, "ury": 329.2},
      "header": 1,
      "rules": [
        {"rule": "frame", "stroke": {"width": 0.75, "color": [0, 0, 0]}},
        {
          "rule": "horizontal_other",
          "stroke": {
            "width": 0.6,
            "color": [0.45, 0.45, 0.45],
            "dash": {"lengths": [0, 2.5]},
            "cap": "round"
          }
        },
        {
          "rule": {"vertical": 1},
          "stroke": {
            "width": 0.6,
            "color": [0.45, 0.45, 0.45],
            "dash": {"lengths": [0, 2.5]},
            "cap": "round"
          }
        }
      ],
      "rows": [
        {
          "cells": [
            {
              "content": ["Description"],
              "font": "DejaVuSans",
              "font_size": 9.5,
              "padding": {"left": 5, "right": 5, "top": 4, "bottom": 4},
              "fill": [0.93, 0.94, 0.97]
            },
            {
              "content": ["Amount"],
              "font": "DejaVuSans",
              "font_size": 9.5,
              "align": "right",
              "padding": {"left": 5, "right": 5, "top": 4, "bottom": 4},
              "fill": [0.93, 0.94, 0.97]
            }
          ],
          "min_height": 19.0
        },
        {
          "cells": [
            {
              "content": ["Drawing office, February"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "padding": {"left": 5, "right": 5, "top": 4, "bottom": 4}
            },
            {
              "content": ["1\u00a0250.00\u00a0EUR"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "align": "right",
              "padding": {"left": 5, "right": 5, "top": 4, "bottom": 4}
            }
          ],
          "min_height": 16.0
        },
        {
          "cells": [
            {
              "content": ["Plates and proofs"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "padding": {"left": 5, "right": 5, "top": 4, "bottom": 4}
            },
            {
              "content": ["480.50\u00a0EUR"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "align": "right",
              "padding": {"left": 5, "right": 5, "top": 4, "bottom": 4}
            }
          ],
          "min_height": 16.0
        },
        {
          "cells": [
            {
              "content": ["Delivery, two crates"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "padding": {"left": 5, "right": 5, "top": 4, "bottom": 4}
            },
            {
              "content": ["96.00\u00a0EUR"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "align": "right",
              "padding": {"left": 5, "right": 5, "top": 4, "bottom": 4}
            }
          ],
          "min_height": 16.0
        },
        {
          "cells": [
            {
              "content": ["Storage, one month"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "padding": {"left": 5, "right": 5, "top": 4, "bottom": 4}
            },
            {
              "content": ["210.25\u00a0EUR"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "align": "right",
              "padding": {"left": 5, "right": 5, "top": 4, "bottom": 4}
            }
          ],
          "min_height": 16.0
        },
        {
          "cells": [
            {
              "content": ["Total"],
              "font": "DejaVuSans",
              "font_size": 9.5,
              "padding": {"left": 5, "right": 5, "top": 4, "bottom": 4},
              "border": {
                "top": {"width": 0.8, "color": [0, 0, 0], "dash": {"lengths": [3, 2]}}
              }
            },
            {
              "content": ["2\u00a0036.75\u00a0EUR"],
              "font": "DejaVuSans",
              "font_size": 9.5,
              "align": "right",
              "padding": {"left": 5, "right": 5, "top": 4, "bottom": 4},
              "border": {
                "top": {"width": 0.8, "color": [0, 0, 0], "dash": {"lengths": [3, 2]}}
              }
            }
          ],
          "min_height": 18.0
        }
      ]
    },

    {
      "type": "text",
      "rect": {"llx": 72, "lly": 170.8, "urx": 523, "ury": 191.2},
      "content": ["A dot is a dash of no length, so it puts ink down only under a rounded end: told to square its ends off, the same pattern draws nothing at all. That is why the dotted lines here ask for both."],
      "font": "DejaVuSans",
      "font_size": 8.5
    }
  ]
}