write_flow.json

Die JSON-Datei des Beispiels „Einen Absatz umbrechen und ausrichten“. Ein in Zeilen umbrochener Absatz, dann auf vier Arten gesetzt: links, rechts, zentriert, Blocksatz.

JSON 136 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.

Wofür dieses Beispiel da ist

Text, der länger ist als eine Beschriftung, muss in Zeilen umbrochen werden. Seine Länge schwankt, die Spalte hat eine feste Breite, und die Bibliothek entscheidet, wo jede Zeile endet. Der Umbruch wird Block für Block eingestellt: Die gewählte Spaltenbreite und Ausrichtung gelten für jede Zeile dieses Blocks, auf jeder Seite.

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
{
  "items": [
    {
      "type": "text",
      "rect": {
        "llx": 80.0,
        "lly": 720.0,
        "urx": 480.0,
        "ury": 780.0
      },
      "content": [
        "This library lays text out by breaking a paragraph into lines that fit a column, then placing each line according to an alignment. The same words are shown below flush left, flush right, centred, and justified, so the difference between them is plain to see at a glance."
      ],
      "font": "DejaVuSans",
      "font_size": 11.0,
      "align": "left",
      "leading": 15.0
    },
    {
      "type": "rect",
      "rect": {
        "llx": 72.0,
        "lly": 712.0,
        "urx": 488.0,
        "ury": 788.0
      },
      "stroke": {
        "width": 0.5,
        "color": [
          0.8,
          0.8,
          0.8
        ]
      }
    },
    {
      "type": "text",
      "rect": {
        "llx": 80.0,
        "lly": 630.0,
        "urx": 480.0,
        "ury": 690.0
      },
      "content": [
        "This library lays text out by breaking a paragraph into lines that fit a column, then placing each line according to an alignment. The same words are shown below flush left, flush right, centred, and justified, so the difference between them is plain to see at a glance."
      ],
      "font": "DejaVuSans",
      "font_size": 11.0,
      "align": "right",
      "leading": 15.0
    },
    {
      "type": "rect",
      "rect": {
        "llx": 72.0,
        "lly": 622.0,
        "urx": 488.0,
        "ury": 698.0
      },
      "stroke": {
        "width": 0.5,
        "color": [
          0.8,
          0.8,
          0.8
        ]
      }
    },
    {
      "type": "text",
      "rect": {
        "llx": 80.0,
        "lly": 540.0,
        "urx": 480.0,
        "ury": 600.0
      },
      "content": [
        "This library lays text out by breaking a paragraph into lines that fit a column, then placing each line according to an alignment. The same words are shown below flush left, flush right, centred, and justified, so the difference between them is plain to see at a glance."
      ],
      "font": "DejaVuSans",
      "font_size": 11.0,
      "align": "center",
      "leading": 15.0
    },
    {
      "type": "rect",
      "rect": {
        "llx": 72.0,
        "lly": 532.0,
        "urx": 488.0,
        "ury": 608.0
      },
      "stroke": {
        "width": 0.5,
        "color": [
          0.8,
          0.8,
          0.8
        ]
      }
    },
    {
      "type": "text",
      "rect": {
        "llx": 80.0,
        "lly": 450.0,
        "urx": 480.0,
        "ury": 510.0
      },
      "content": [
        "This library lays text out by breaking a paragraph into lines that fit a column, then placing each line according to an alignment. The same words are shown below flush left, flush right, centred, and justified, so the difference between them is plain to see at a glance."
      ],
      "font": "DejaVuSans",
      "font_size": 11.0,
      "align": "justify",
      "leading": 15.0
    },
    {
      "type": "rect",
      "rect": {
        "llx": 72.0,
        "lly": 442.0,
        "urx": 488.0,
        "ury": 518.0
      },
      "stroke": {
        "width": 0.5,
        "color": [
          0.8,
          0.8,
          0.8
        ]
      }
    }
  ]
}