Every export of @deckyard/escl. The guide is Scanning.
jennifer
import"@deckyard/escl/"as escl;
Lengths are in 1/300 inch. Every error the deck raises is kind "escl"; a scanEach handler's own error keeps its kind (a failed cancel is added to its message). Text from a scanner comes back with control, bidirectional-text and invisible format characters as ?. A login belongs in Options; an address holding @ is refused.
scanners answering an mDNS query for _uscan._tcp / _uscans._tcp within timeoutMs (1 to 60000); names with control characters as ?; stops reading after 2000 records
escl.scanner(address as string)
Scanner
the scanner at host, host:port or an http(s):// URL, default options; the eSCL root defaults to /eSCL
escl.scannerWith(address as string, options as Options)
Scanner
the same, with options; zero fields take the defaults
escl.scanEach(s as Scanner, st as Settings, handler as func)
int
the whole job, calling handler(page as Page, n as int) per page instead of keeping it; returns the page count
escl.scan(s as Scanner, st as Settings)
list of Page
the whole job, in memory; cancels it on failure; no pages, more than maxPages / maxJobBytes or an aborted job is an error; a finished job is deleted on the scanner
escl.scanToFiles(s as Scanner, st as Settings, dir as string, stem as string)
list of string
the whole job into <dir>/<stem>-001.<ext>, ... (more digits when maxPages needs them), the extension from the page's type or, failing that, its first bytes; files are created exclusively, never overwritten or written through a link; an error names the files already written
escl.start(s as Scanner, caps as Capabilities, st as Settings)
Job
check the settings and create a job; a feeder job is refused when the feeder reports empty, jammed, open or misfed
escl.nextPage(job as Job)
Page
the next page, or done at the end (404); a platen job is done after one counted page, without asking again
escl.countPage(job as Job, p as Page)
Job
the job with the page counted, for a loop of your own; past maxPages or maxJobBytes is an error
escl.finish(job as Job)
null
after the last page: fails if the status lists the job aborted or cancelled, or it gave no pages (an unreadable status does not fail it), then deletes the job on the scanner
escl.cancel(job as Job)
null
delete the job; one the scanner no longer knows counts as cancelled
escl.imageInfo(job as Job)
ImageInfo
ScanImageInfo of the page last fetched, where the scanner offers it
escl.extension(contentType as string)
string
jpg, png, pdf, tif, else bin
escl.pageExtension(p as Page)
string
the extension from the page's type or, failing that, its first bytes
scanpdf.build(pages as list of escl.Page, resolution as int)
bytes
one PDF of JPEG / PNG pages, each page the size scanned at resolution dpi; images embedded unchanged; PNGs with transparency or interlacing refused
scanpdf.scanToPdf(s as escl.Scanner, st as escl.Settings, path as string)
int
scan (format image/jpeg or image/png) and write one PDF, created exclusively; the name is taken before the scan, and the pages of a failed job, or pages that cannot be bound or written, are kept as <path without .pdf>-001.<ext>, ... (-2-001, ... when taken); peak memory about seven times the job's size; returns the page count