write_flow.json

Le fichier JSON de l'exemple « Découper un paragraphe et l'aligner ». Un paragraphe découpé en lignes, puis composé de quatre façons : à gauche, à droite, centré, justifié.

JSON 136 lignes

Ce fichier est une requête : une application l'envoie par le réseau au serveur, qui crée le PDF et le renvoie. Il donne la même page que les versions Rust et Python de cet exemple. Une requête nomme chaque fichier qu'elle emploie, jamais le contenu de ces fichiers ; l'appel porte la requête et les fichiers ensemble. Une police que le serveur détient déjà, comme DejaVuSans, se nomme sans rien y joindre. Envoyez la requête à l'adresse que donne la page de l'API.

À quoi sert cet exemple

Un texte plus long qu'une légende doit être coupé en lignes. Sa longueur varie, la colonne a une largeur fixe, et c'est la bibliothèque qui décide où chaque ligne s'arrête. La coupure se règle bloc par bloc : la largeur de colonne et l'alignement que vous choisissez valent pour toutes les lignes de ce bloc, sur toutes les pages.

Ce que montre cet exemple

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