The file's weight and the time it takes

Set how hard the document compresses: the fastest, the smallest, or a file readable in a plain text editor.

Summary

When you pack clothes into a suitcase, you can fold them quickly or press them down at length. The result fits in the same bag, but not in the same space and not in the same time — and that is the whole trade here. The mode that presses nothing at all is the odd one out: it is there for the day you want to open the file in a plain text editor and read what is inside.

Technically

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

compression sets how hard the document's streams are deflated. Three settings exist: whether to compress at all, the level from 1 to 9, and the gathering of the objects that are not streams into /ObjStm object streams behind an /XRef cross-reference stream. That last one cuts a document rich in small objects down markedly, and asks for reading software that knows PDF 1.5; it stays off by default, so a file meant for older reading software comes out as it is.

Request schema

  • compression — object, optional, absent by default.
  • compression.enabled — boolean, optional, true by default. A request naming the block and saying nothing about it compresses all the same, as every document does. Set to false, the file opens in a text editor.
  • compression.level — integer, optional, from 1 to 9. 1 is the fastest and leaves the most behind, 9 the smallest and the slowest. Absent, the engine keeps its own level. A number outside 1 to 9 is refused, and the answer names it.
  • compression.object_streams — boolean, optional, false by default. Gathers the objects that are not streams themselves into compressed streams, and writes the cross-reference table the same way. Wants PDF 1.5 at least.

A whole request that creates a PDF

{
  "compression": { "level": 9, "object_streams": true },
  "standard_fonts": [{ "name": "sans", "face": "helvetica" }],
  "items": [
    {
      "type": "text",
      "rect": { "llx": 60, "lly": 740, "urx": 535, "ury": 762 },
      "content": ["Packed as small as it goes"],
      "font": "sans",
      "font_size": 14
    }
  ]
}

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 first page, shown while the rest arrives Layers reading software shows or hides 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