Découper un paragraphe et l'aligner

Un paragraphe découpé en lignes, composé de quatre façons : aligné à gauche, à droite, centré, justifié.

JSON write_flow.json 136 lignes

Celui-ci n'est pas un programme. C'est la requête envoyée au serveur de documents : la même page, demandée par le réseau, par une application qui n'écrit pas une ligne de code PDF.

  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 box, 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 box, 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 box, 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 box, 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
        ]
      }
    }
  ]
}