The Areas of a Page a Reader Measures In

Mark the part of a page that is a plan drawn to scale, or a map tied to the earth, so a reader's measuring tool reads metres, not points.

Summary

A site plan drawn at one to a hundred is useless to measure in points: the reader wants metres. A map wants latitude and longitude. A viewport says which rectangle of the page is the plan or the map, and in what units a reader's measuring tool reads inside it; outside every viewport it measures the page itself.

Technically

Written at the top level of a request, under "page_viewports"

page_viewports writes /VP on the pages it names, each viewport a rectangle, a name and a measure. rectilinear is a drawing to scale: ratio, the scale in words, and the units lengths, distances and areas are read in, each list of units largest first, each unit a label and a factor. geospatial is a map: the coordinate system, by EPSG code or Well Known Text, and at least three points tying the viewport to the earth. A page named twice carries the viewports of the last entry given for it. A viewport needs PDF 1.6, a map PDF 2.0.

Request Schema

  • page_viewports — array, optional, empty by default.
  • page_viewports[].page — integer, required, counting from 1, as every page number in a request counts.
  • page_viewports[].viewports — array, required. Each viewport has llx, lly, urx and ury, and optionally a name, a measure, rectilinear or geospatial, and point_data, sets of measured points, each with names, the name of each column — LAT, LON and ALT for a latitude, a longitude and an altitude, or names the customer chooses — and points, one row of numbers per point. Point data needs a geospatial measure and PDF 2.0.
  • Units: each list of units — x, distance, area, and y's units beside y_in_x, what one y unit is worth in x units, with angles and slopes — holds the largest first, each unit a label and a factor, and may state fraction ({"decimals": 2}, {"fraction": 8}, "rounded" or "truncated"), exact, thousands_separator, decimal_mark, label_spacing and label_first. origin is the point measured from. A map states its system, {"geographic": {"epsg": 4326}} or {"projected": {"wkt": "…"}}, its points, each {"at": [x, y], "latitude": …, "longitude": …} or {"at": [x, y], "easting": …, "northing": …}, and may state shown_in, neatline and display_units, {"length", "area", "angle"}: metre, kilometre, foot, us_survey_foot, mile or nautical_mile; square_metre, hectare, square_kilometre, square_foot, acre or square_mile; degree or grad.

A list of no unit is refused, and so are a factor that is not a number above nought, a viewport of no width, a control point outside its viewport, and a latitude or a longitude out of range.

A Whole Request That Creates a PDF

{
  "page_viewports": [
    {
      "page": 1,
      "viewports": [
        {
          "llx": 72, "lly": 300, "urx": 523, "ury": 680,
          "name": "Ground floor plan",
          "measure": {
            "rectilinear": {
              "ratio": "1 cm = 1 m",
              "x": [{ "label": "m", "factor": 0.0352778 }],
              "distance": [{ "label": "m", "factor": 1 }],
              "area": [{ "label": "m²", "factor": 1 }]
            }
          }
        }
      ]
    }
  ],
  "standard_fonts": [{ "name": "sans", "face": "helvetica" }],
  "items": [
    {
      "type": "text",
      "rect": { "llx": 72, "lly": 700, "urx": 523, "ury": 740 },
      "content": ["A plan a reader measures in metres"],
      "font": "sans",
      "font_size": 12
    }
  ]
}

The line that sends it, in three languages

The document as a whole

The Numbers Reading Software Shows A Hundred Letters in a Single File What the Document Says about Itself What the Document Says about Itself, Said Once Text Nobody Can Copy The Notes a Program Leaves in the File for Itself The Notes a Program Leaves on One Page The Data a Program Hangs on a Run of Ink A File Still Readable Decades from Now The Print Standard the Document Claims The Variable Print Standard the Document Claims The Password That Opens It, and What May Be Done with It An Invoice a Person and a Machine Both Read The Address Relative Links Are Read Against The PDF Version the File Declares The Extensions to PDF the File Says It Uses What a Picture Says about Itself, and How It Is Read The Attachments the Document Carries Beside Its Pages Files the Document Names without Carrying The Attachments Shown as a Portfolio Which Attachments a Page Claims Which Attachments a Font Claims The Identity Card a Single Font Carries Which Attachments the Document's Card Claims A Document Card Written Elsewhere The Identity Card a Single Page Carries The Accessibility Standard the Document Claims The Standards the Finished Document Is Measured Against

Where to Go Next

Every JSON key of a request, in one page The other forty-one settings of a request

See the Prices See the Examples