write_flow.json

The JSON file of the “Breaking a paragraph up, and aligning it” example. A paragraph broken into lines, then laid out four ways: left, right, centred, justified.

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

What this example is for

Text longer than a caption has to be broken into lines. Its length varies, the column has a fixed width, and the library decides where each line ends. The break is set block by block: the column width and the alignment you choose hold for every line of that block, on every page.

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