write_picture_cells.json

Die JSON-Datei des Beispiels „Bilder in Tabellenzellen“. Ein Katalog, dessen erste Spalte ein Bild statt Text ist: vier Bilder sehr unterschiedlicher Größe und Proportion, jedes vollständig und unverzerrt in die Zelle eingepasst, die die Tabelle ihm gibt, und an eine andere Ecke davon gerückt, ohne Breite von seiner Spalte oder Höhe von seiner Zeile zu beanspruchen.

JSON 203 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 nennt Dateien, die sie nicht trägt: bilevel.png, hqf_development.png, logo.png, photo.jpg. Jede davon reist neben der Anfrage, im selben Aufruf, als mitgelieferter Teil, genau so benannt, wie die Anfrage sie hier nennt — die Beschreibung sagt, welcher Name welche Rolle spielt, Sie benennen Ihre Dateien also, wie Sie möchten. Eine Anfrage, die eine Datei nennt, von der der Aufruf nichts trägt, wird abgelehnt.

Wofür dieses Beispiel da ist

Ein Produktkatalog bedeutet Fotos, und Fotos kommen von Lieferanten: eines ist neunhundert Pixel breit, das nächste sechzehn, und keine zwei haben dieselben Proportionen. Sie alle auf eine gemeinsame Größe zu bringen, bevor die Seite gesetzt werden kann, ist ein Schritt, den jemand ausführen, im nächsten Quartal wieder ausführen und an dem Tag erklären muss, an dem er ausgelassen wurde.

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
{
  "items": [
    {
      "type": "table",
      "columns": {
        "widths": [
          { "points": 96.0 },
          { "fraction": 1.0 },
          "content",
          "content"
        ],
        "total": 483.27599999999995
      },
      "first": { "llx": 56.0, "lly": 64.0, "urx": 539.276, "ury": 760.0 },
      "next": { "llx": 56.0, "lly": 64.0, "urx": 539.276, "ury": 760.0 },
      "header": 1,
      "rules": [
        { "rule": "frame", "stroke": { "width": 0.8 } },
        {
          "rule": "horizontal_other",
          "stroke": { "width": 0.25, "color": [0.75, 0.75, 0.75] }
        },
        {
          "rule": "vertical_other",
          "stroke": { "width": 0.25, "color": [0.75, 0.75, 0.75] }
        },
        { "rule": { "horizontal": 1 }, "stroke": { "width": 0.8 } }
      ],
      "rows": [
        {
          "min_height": 20.0,
          "cells": [
            {
              "content": ["Picture"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 },
              "fill": [0.86, 0.86, 0.86]
            },
            {
              "content": ["Item"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 },
              "fill": [0.86, 0.86, 0.86]
            },
            {
              "content": ["Reference"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 },
              "fill": [0.86, 0.86, 0.86]
            },
            {
              "content": ["Price, €"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "align": "right",
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 },
              "fill": [0.86, 0.86, 0.86]
            }
          ]
        },
        {
          "min_height": 54.0,
          "cells": [
            {
              "image": "hqf_development.png",
              "align": "left",
              "valign": "top",
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 }
            },
            {
              "content": [
                "Wide banner",
                "Nine hundred pixels across and half as tall, drawn against the top left of its cell."
              ],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 }
            },
            {
              "content": ["BN-900"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 }
            },
            {
              "content": ["148.00"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "align": "right",
              "align_on": ".",
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 }
            }
          ]
        },
        {
          "min_height": 54.0,
          "cells": [
            {
              "image": "photo.jpg",
              "align": "center",
              "valign": "middle",
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 }
            },
            {
              "content": [
                "Photograph",
                "Four to three, in the middle of its cell — the room it does not fill is shared either side."
              ],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 }
            },
            {
              "content": ["PH-160"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 }
            },
            {
              "content": ["24.50"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "align": "right",
              "align_on": ".",
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 }
            }
          ]
        },
        {
          "min_height": 54.0,
          "cells": [
            {
              "image": "logo.png",
              "align": "right",
              "valign": "bottom",
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 }
            },
            {
              "content": [
                "Square mark",
                "As tall as it is wide, against the bottom right. The height runs out first, so nothing is left below it."
              ],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 }
            },
            {
              "content": ["SQ-96"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 }
            },
            {
              "content": ["9.90"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "align": "right",
              "align_on": ".",
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 }
            }
          ]
        },
        {
          "min_height": 54.0,
          "cells": [
            {
              "image": "bilevel.png",
              "align": "center",
              "valign": "middle",
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 }
            },
            {
              "content": [
                "Two-colour rule",
                "Sixteen pixels by eight, drawn as large as the cell allows: a picture is fitted to its cell, not to its own pixels."
              ],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 }
            },
            {
              "content": ["RL-16"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 }
            },
            {
              "content": ["3.75"],
              "font": "DejaVuSans",
              "font_size": 9.0,
              "align": "right",
              "align_on": ".",
              "padding": { "left": 6.0, "right": 6.0, "top": 5.0, "bottom": 5.0 }
            }
          ]
        }
      ]
    }
  ]
}