import { ImageCrop } from '../core/document-model/types.js'; import { Loss } from '../core/ir/index.js'; import { PdfFile, PdfPage } from './document.js'; /** * One raster image lifted off a page (E-PDF EP6): the standalone image file * (`png`/`jpeg`/`jpeg2000`), its page-space rectangle (computed from the CTM * that maps the unit square) and the enclosing marked-content id so the tagged * path can attach it to a `/Figure`. */ export interface PdfImage { readonly bytes: Uint8Array; readonly format: 'png' | 'jpeg' | 'jpeg2000'; /** Display size in page points (from the CTM). */ readonly widthPt: number; readonly heightPt: number; /** Page-space lower-left corner (points, y-up). */ readonly x: number; readonly y: number; /** * §8.9.5 — how far the CTM turns the picture, in degrees counter-clockwise. * The box above is the picture's own, unturned; a turn spins it about its * centre, which is what every downstream format does with one. */ readonly rotationDeg?: number; /** * §8.5.4 — the fraction of each of the picture's OWN edges a clip cut away, * where one bounded it: `a:srcRect` in DrawingML terms. Absent is whole. */ readonly crop?: ImageCrop; /** Enclosing marked-content id, if the placement was inside a `/Figure`. */ readonly mcid?: number; /** * §11.6.4.4 `/ca` — how opaque the picture is drawn, `0..1`. Absent is * opaque. alphatrans.pdf lays a photograph in at half strength over three * coloured squares, and drawn full-strength it hid all three. */ readonly alpha?: number; /** * §8.5.3 — where this was painted, as the chain of positions leading to it. * The same key a lifted path carries, so the two can be ordered against each * other: a picture drawn over a filled box has the larger key. */ readonly orderKey: ReadonlyArray; } /** The images lifted off one page plus any losses for images that could not be reconstructed. */ export interface PageImages { readonly images: Array; readonly losses: Array; } /** * Lift the raster images off a page (E-PDF EP6). Runs the content interpreter * (EP2) for its `Do` placements, resolves each name against the page's * `/Resources` `/XObject`, and either decodes an `/Image` (via `decodePdfImage`) * or recurses into a `/Form` XObject — composing the form's `/Matrix` onto the * placement CTM, depth-guarded against cyclic forms. Each surviving image * carries its page-space rectangle and enclosing structure id. Unsupported * images become {@link Loss} entries rather than broken pictures. */ export declare function collectPageImages(file: PdfFile, page: PdfPage): PageImages;