/// import { CSSMargins, FontStyle, Margins } from "../utils"; import { Drawable } from "./drawable"; /** * This is a state manager for a PDFKit document. It helps us track the PDFKit * document's state */ export declare class Context { /** * PDFKit document it's managing */ readonly raw: PDFKit.PDFDocument; /** * Established margins for the document */ readonly margins: Margins; private defaultFont; /** * Create a new context for managing a document * @param margins CSS style margins * @param config default font configuration */ constructor(params: ContextParams); addPage(): void; onNewPage(fn: () => void): void; /** * Run the action using `config` font settings and reset once done. If the config * doesn't exist just return the action's result. * @param config pdfmills `FontConfig` * @param action action to use `config` */ withFont(config: FontStyle, action: () => T): T; } /** * DTO for initializing a Cotent */ export interface ContextParams { backgroundColor?: Drawable; fontStyle: FontStyle; margins: CSSMargins; }