Layers reading software shows or hides

Sort what is drawn into named layers, shown or hidden in one click, and which reading software shows by the magnification or by the language.

Summary

An architect works with transparent sheets stacked up: the walls on one, the furniture on another, the dimensions on a third. Lifting one takes it out of view, and here it is exactly the same gesture. You can also decide a layer shows on screen but stays off the print — a draft watermark, for instance. And a layer can raise its own hand: the fine dimensions of a plan appear once a reader has come close enough to read them, and a legend written twice, in two languages, shows each reader the one they set their program to. Layers that go together — the walls, the roof and the openings of one building — are gathered under a heading, which the panel shows as one group a reader folds away in a single click.

Technically

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

layers writes one /OCG per layer into /OCProperties, each under the name an item says it is drawn on, and wraps the marks drawn on a layer in the content stream so reading software switches them together. Reading software lists them in its panel, in the order the request declares them, and shows or hides everything on one of them at once. A layer stating a heading is listed under it rather than on its own: /Order then holds a nested array opening on that heading, standing where the first layer stating it was declared, with every layer stating the same heading inside it. /Usage carries the rest. Screen display and printing are set apart: naming them opposite answers builds a layer that is only ever looked at, or only ever printed. A layer can also show itself without the panel: a zoom shows it between two magnifications, and a language shows it to reading software set to that language and hides it from the layers of every other. A layer the panel refuses to switch is locked, and still starts where visible puts it. Four entries say what the layer is rather than when it shows: intent is written beside the name, on the group itself, and the set the document opens under carries the list of intents it is read under; made_by, purpose and role are three more headings of /Usage, the second of them written beside the print state in the one entry.

Request schema

  • layers — array, optional, empty by default.
  • layers[].name — string, required. The name items name this layer by, and the name reading software shows in its panel.
  • layers[].visible — boolean, optional. Whether the layer starts shown. Absent, it starts shown.
  • layers[].printed — boolean, optional. Whether printing shows the layer, whatever the panel says. Absent, printing follows the panel.
  • layers[].on_screen — boolean, optional. Whether looking at the document shows the layer, whatever the panel says. Absent, the screen follows the panel.
  • layers[].locked — boolean, optional, false by default. Whether reading software refuses to switch the layer in its panel. A locked layer keeps its entry, showing the state it starts under, and still starts where visible puts it.
  • layers[].zoom — object, optional. The magnifications the layer shows itself between, whatever the panel says. Absent shows it at every magnification, and an object naming neither bound is refused.
  • layers[].zoom.from — number, optional. The magnification the layer is shown from, that one counted in. Absent leaves it no floor, which is 0.
  • layers[].zoom.to — number, optional. The magnification the layer is shown below, that one left out. Absent leaves it no ceiling. A pair nothing can satisfy — a from at or above the to, or a from below zero — is refused.
  • layers[].language — string, optional, no language by default. A language tag, fr-FR or en-GB. Reading software set to that language shows this layer and hides the layers of every other language, which is how one sheet carries its wording twice and shows one of them.
  • layers[].preferred — boolean, optional, false by default. Whether this is the layer reading software falls back on when no layer states the language it is set to exactly. Stating it without a language is refused.
  • layers[].heading — string, optional, no heading by default. The heading reading software gathers the layer under in its panel. Every layer declared under the same heading is shown under it, as one group a reader folds and unfolds, and the group stands where the first layer stating it was declared. A layer stating none stands on its own at the top level of the panel.
  • layers[].intent — string, optional, view by default. Whether the layer carries content of the document, view, or an aid for whoever made it, design: a grid, a guide, a margin box. Reading software applies only the layers whose intent the set it is reading under names. The set a document opens under names the viewing intent alone, which the PDF standard (ISO 32000) asks of it, so a design layer is switched from a layer_configurations set: each of those names both intents where one layer is a design one.
  • layers[].made_by — object, optional. The program that made the layer and the kind of work it holds, stated together; one without the other is refused.
  • layers[].made_by.application — string, required. The program, under the name it calls itself by.
  • layers[].made_by.work — string, required. The kind of work the layer holds: artwork, the content of a graphic-design or publishing application, or technical, the content of a technical design such as a building plan or a schematic.
  • layers[].purpose — string, optional. What the layer is on the printed sheet: watermark, a mark laid over or under what the page says; trapping, the overlap the press needs where two inks meet; or printers_marks, what the press reads rather than the reader. Stated apart from printed: saying what a layer is says nothing about whether it is printed, and a layer that only says what it is is switched by no printing event.
  • layers[].role — string, optional. What of the page the layer holds: header_footer (a running head or foot), background (drawn behind what the page says), foreground (drawn over it) or logo. A program taking a page apart reads it to put what it takes back together.
  • An item sits on a layer through its layer key, carrying the name declared here. An item with no layer is always there, under every layer.
  • Layers want PDF 1.5 at least.
  • A document stating an archive standard refuses a layer that states printed, on_screen, zoom or language: an archival file leaves that decision to the reading software. The layer itself is fine, and so is locked, which makes nothing on the page depend on what the page is being looked at for.

A whole request that creates a PDF

{
  "layers": [
    {
      "name": "Dimensions",
      "made_by": { "application": "Plan Studio", "work": "technical" }
    },
    { "name": "Draft", "on_screen": true, "printed": false },
    { "name": "Crop marks", "locked": true },
    { "name": "Fine print", "zoom": { "from": 2 } },
    {
      "name": "French wording",
      "language": "fr-FR",
      "heading": "Wording"
    },
    {
      "name": "English wording",
      "language": "en-GB",
      "preferred": true,
      "heading": "Wording"
    },
    { "name": "Grid", "intent": "design" },
    { "name": "Draft mark", "purpose": "watermark" },
    { "name": "Badge", "role": "logo" }
  ],
  "standard_fonts": [{ "name": "sans", "face": "helvetica" }],
  "items": [
    {
      "type": "rect",
      "rect": { "llx": 80, "lly": 560, "urx": 380, "ury": 760 },
      "stroke": { "width": 2 }
    },
    {
      "type": "text",
      "rect": { "llx": 80, "lly": 540, "urx": 380, "ury": 556 },
      "content": ["300 by 200"],
      "font": "sans",
      "font_size": 10,
      "layer": "Dimensions"
    },
    {
      "type": "text",
      "rect": { "llx": 80, "lly": 700, "urx": 380, "ury": 740 },
      "content": ["DRAFT"],
      "font": "sans",
      "font_size": 36,
      "color": [0.85, 0.85, 0.85],
      "layer": "Draft"
    },
    {
      "type": "text",
      "rect": { "llx": 80, "lly": 520, "urx": 380, "ury": 534 },
      "content": ["Shown from twice the page size upwards"],
      "font": "sans",
      "font_size": 7,
      "layer": "Fine print"
    },
    {
      "type": "text",
      "rect": { "llx": 80, "lly": 480, "urx": 380, "ury": 496 },
      "content": ["Plan du premier etage"],
      "font": "sans",
      "font_size": 11,
      "layer": "French wording"
    },
    {
      "type": "text",
      "rect": { "llx": 80, "lly": 480, "urx": 380, "ury": 496 },
      "content": ["First floor plan"],
      "font": "sans",
      "font_size": 11,
      "layer": "English wording"
    }
  ]
}

The line that sends it, in three languages

What is drawn, and how it comes out

Everything that can be drawn on a page The file's weight and the time it takes The first page, shown while the rest arrives A name that stands for several layers at once A drawing made once, shown by a button The sets of layers reading software offers Layers reading software shows one of at a time

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