/** * Print preflight (#605): what a printer would reject in a laid-out * document, found on the VDT so it runs as soon as a page is laid out — * the Sandbox shows it in Review, and a Node pipeline can fail a build on * it. * * - Pictures whose effective resolution at their printed size (pixels per * inch, crop included) falls under `print.preflight.minImageResolution` * (critical under `criticalImageResolution`): figures, table-cell * pictures, design images, comic panels. The pixels are the file's when * the host knows them (`imageSize`), else the resource's declaration. * - Bitmaps whose declared pixel size and file disagree (#631). * - RGB pictures in a CMYK job (converted on export, or kept RGB by a * PDF/X-4 that does not convert them), when the host says which * pictures are RGB (`imageColor`). * - Rules, borders and strokes thinner than `minRuleWidth`. * - Text under `smallTextSize` set with more than one ink. * - Colours whose separation exceeds the ink limit. * - Text inside the safe zone near the trim (a figure's labels too, #902), and boxes or pictures that * stop short of the trim by less than `bleedSnap` without bleeding. */ import type { ResolvedPrintConfig, Resource } from './types.js'; import type { BoundingBox, VDTDocument } from './vdt.js'; import type { OutputTransform } from './color/transform.js'; export type PreflightSeverity = 'critical' | 'warning' | 'info'; export type PreflightIssue = { severity: PreflightSeverity; /** Book-absolute page index (`pageIndexOffset` counted in). */ pageIndex: number; /** The offending area, page px. */ rect?: BoundingBox; /** Source range in the chapter markdown, when the element has one. */ sourceStart?: number; sourceEnd?: number; } & ({ kind: 'lowImageResolution'; fileId: string; resourceId?: string; ppi: number; minimum: number; } /** A bitmap that declares a pixel size its file does not have (more * than a pixel off either way): its print size and resolution are * worked out from the declaration. Reported once, where it is first * placed; `warning` when the declaration exceeds the file. */ | { kind: 'declaredPixelsMismatch'; fileId: string; resourceId?: string; declared: { width: number; height: number; }; actual: { width: number; height: number; }; } | { kind: 'rgbImage'; fileId: string; resourceId?: string; converted: boolean; } | { kind: 'thinRule'; widthPt: number; minimumPt: number; color: string; } | { kind: 'smallProcessText'; sizePt: number; inks: number; color: string; text: string; } | { kind: 'inkLimit'; color: string; coverage: number; limit: number; } | { kind: 'safeZone'; distanceMm: number; safeZoneMm: number; text: string; } | { kind: 'nearTrim'; gapMm: number; edge: 'top' | 'right' | 'bottom' | 'left'; }); export type PreflightKind = PreflightIssue['kind']; export interface PreflightOptions { /** The print settings to check against; the document's `config.print` * (else the defaults) when omitted. */ print?: ResolvedPrintConfig; /** Pixel sizes of pictures by resource (a bitmap's `width`/`height`); * the resource a figure carries is used when present. */ resources?: readonly Resource[]; /** The separation of the job's output profile: counts inks and checks * coverage exactly. Without it a neutral counts one ink and any other * colour three, and coverage is not checked. */ transform?: OutputTransform; /** The real pixel size of a bitmap's file (the decoded image, or * `bitmapInfo` on its bytes), when the host knows it: the resolution is * worked out from it, and a declaration that disagrees is reported * (`declaredPixelsMismatch`). */ imageSize?: (fileId: string) => { width: number; height: number; } | undefined; /** Whether a picture's file is RGB, CMYK or gray (from its bytes). */ imageColor?: (fileId: string) => 'rgb' | 'cmyk' | 'gray' | undefined; /** The job is CMYK (a PDF/X standard, or a CMYK PDF). Defaults to true * when a PDF/X standard is set. */ cmyk?: boolean; } /** One placed bitmap and its effective resolution there (#631): the * file's pixels shown (crop and safe area counted) over its printed size * in inches, the smaller of the two axes. */ export interface PlacedImageResolution { fileId: string; resourceId?: string; /** Book-absolute page index. */ pageIndex: number; ppi: number; /** Printed size, layout px. */ width: number; height: number; } /** Every bitmap placed in `doc` with its effective resolution: figures, * table-cell pictures, design images and comic panels, one entry per * placement. Uses `options.resources` and `options.imageSize` as * {@link preflightDocument} does; runs whether or not preflight is on. */ export declare function placedImageResolutions(doc: VDTDocument, options?: Pick): PlacedImageResolution[]; export declare function preflightDocument(doc: VDTDocument, options?: PreflightOptions): PreflightIssue[]; //# sourceMappingURL=preflight.d.ts.map