write_page_labels.json

The JSON file of the “Custom page labels” example. Pages numbered by their labels rather than their position.

JSON 186 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

The number you type to go to a page ought to be the number printed on that page. In any document with a preface it is not: the reader asks for page 12, reading software counts pages from the front and shows them page 4. On a legal file or a technical manual, that is a reference nobody can follow.

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
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
{
  "renumber": [
    {
      "from_page": 1,
      "value": 1,
      "style": "lower_roman"
    },
    {
      "from_page": 3,
      "value": 1,
      "style": "decimal"
    },
    {
      "from_page": 6,
      "value": 1,
      "style": "decimal",
      "prefix": "A-"
    }
  ],
  "items": [
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 772.0,
        "urx": 560.0,
        "ury": 786.4
      },
      "content": [
        "Page labels number the pages for the reader."
      ],
      "font": "DejaVuSans",
      "font_size": 12.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 752.0,
        "urx": 560.0,
        "ury": 762.8
      },
      "content": [
        "Roman numerals for the front matter, arabic for the body, a prefix for the annex."
      ],
      "font": "DejaVuSans",
      "font_size": 9.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 738.0,
        "urx": 560.0,
        "ury": 748.8
      },
      "content": [
        "The label shows in reading software's page box, not the sheet number below."
      ],
      "font": "DejaVuSans",
      "font_size": 9.0
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 700.0,
        "urx": 560.0,
        "ury": 716.8
      },
      "content": [
        "Sheet 1 of 7"
      ],
      "font": "DejaVuSans",
      "font_size": 14.0,
      "pages": [1]
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 700.0,
        "urx": 560.0,
        "ury": 716.8
      },
      "content": [
        "Sheet 2 of 7"
      ],
      "font": "DejaVuSans",
      "font_size": 14.0,
      "pages": [2]
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 700.0,
        "urx": 560.0,
        "ury": 716.8
      },
      "content": [
        "Sheet 3 of 7"
      ],
      "font": "DejaVuSans",
      "font_size": 14.0,
      "pages": [3]
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 700.0,
        "urx": 560.0,
        "ury": 716.8
      },
      "content": [
        "Sheet 4 of 7"
      ],
      "font": "DejaVuSans",
      "font_size": 14.0,
      "pages": [4]
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 700.0,
        "urx": 560.0,
        "ury": 716.8
      },
      "content": [
        "Sheet 5 of 7"
      ],
      "font": "DejaVuSans",
      "font_size": 14.0,
      "pages": [5]
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 700.0,
        "urx": 560.0,
        "ury": 716.8
      },
      "content": [
        "Sheet 6 of 7"
      ],
      "font": "DejaVuSans",
      "font_size": 14.0,
      "pages": [6]
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 700.0,
        "urx": 560.0,
        "ury": 716.8
      },
      "content": [
        "Sheet 7 of 7"
      ],
      "font": "DejaVuSans",
      "font_size": 14.0,
      "pages": [7]
    },
    {
      "type": "text",
      "rect": {
        "llx": 72.0,
        "lly": 640.0,
        "urx": 560.0,
        "ury": 664.0
      },
      "content": [
        "Reading software shows this page as: {page_label}"
      ],
      "font": "DejaVuSans",
      "font_size": 20.0
    }
  ],
  "metadata": {
    "title": "A document numbered by its labels"
  }
}