write_shrink_and_turn.json

The JSON file of the “Shrunk headings and a turned label” example. Headings of different lengths shrunk to share one column, and a label turned a quarter turn up the page's spine.

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

A heading whose length you do not control is a small crisis: a product name, a customer's company, a title that grew by a third on its way into German. Choose a size small enough for the worst case and the ordinary one looks timid; choose one that suits the ordinary case and the worst runs off the page. Neither is a decision anybody should be making by hand, document after document.

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
{
  "page": {
    "width": 595.276,
    "height": 841.89
  },
  "items": [
    {
      "type": "line",
      "from": {
        "x": 531.276,
        "y": 760.0
      },
      "to": {
        "x": 531.276,
        "y": 560.0
      },
      "stroke": {
        "color": [
          0.85,
          0.85,
          0.85
        ],
        "width": 0.5
      }
    },
    {
      "type": "text",
      "rect": {
        "llx": 120.0,
        "lly": 740.0,
        "urx": 531.276,
        "ury": 754.192206
      },
      "content": [
        "Consolidated statement of professional services rendered"
      ],
      "font": "DejaVuSans",
      "font_size": 14.192206,
      "leading": 14.192206,
      "align": "right"
    },
    {
      "type": "text",
      "rect": {
        "llx": 120.0,
        "lly": 684.0,
        "urx": 531.276,
        "ury": 714.0
      },
      "content": [
        "Summary of accounts"
      ],
      "font": "DejaVuSans",
      "font_size": 30.0,
      "leading": 30.0,
      "align": "right"
    },
    {
      "type": "text",
      "rect": {
        "llx": 120.0,
        "lly": 628.0,
        "urx": 531.276,
        "ury": 658.0
      },
      "content": [
        "Total due"
      ],
      "font": "DejaVuSans",
      "font_size": 30.0,
      "leading": 30.0,
      "align": "right"
    },
    {
      "type": "text",
      "rect": {
        "llx": 64.0,
        "lly": 64.0,
        "urx": 780.0,
        "ury": 76.0
      },
      "content": [
        "ACME LTD — ANNUAL STATEMENT"
      ],
      "font": "DejaVuSans",
      "font_size": 12.0,
      "leading": 12.0,
      "color": [
        0.55,
        0.55,
        0.55
      ],
      "transform": [
        0.0,
        1.0,
        -1.0,
        0.0,
        128.0,
        0.0
      ]
    }
  ]
}