Skip to content

API reference / Common / DocumentLayout

Interface: DocumentLayout ​

A snapshot of a document's layout: composed page count and total scrollable size.

Both are dynamic — editing can add/remove pages or grow/shrink the content — so this is a snapshot the worker reports (on open, and again after any re-layout), never a constant captured once at open time.

Properties ​

PropertyDescription
composedPageCount
number
Pages composed so far (0 for doc types without pagination) — not the document's total, which is unknown until composition finishes: a page is known only once composed. It grows as the compose-ahead pump advances, and is the document's page count once a compose step reports DocumentLayout.complete.
scrollSize
Size
Total scrollable size in document space.
complete?
boolean
Whether the document is now fully composed — composedPageCount is its final page count and there is nothing left to compose ahead. Set only on the updateLayout reply, absent on open and re-layout reports.
docType?
UDocType
The open document's doc type — the host's cue for a doc-type-appropriate default fit. Set only on the open reply, absent on re-layout reports.
sourceFormat?
FileFormat
The file format the document came from — what saving it back means. Set only on the open reply, and absent there too for a package that recorded none.
needsPassword?
boolean
Whether the document opened needs a password before it can be read — a PDF encrypted with a user password — the rest of this layout then being an empty document's. Set only on the open and authenticate replies, and only while it does.