import { Context, ContextParams, Element, Renderable } from "./base"; import { Background, ElementBackground, Image, ImageBackground, ImageStyle, LineBreak, Padding, Paragraph } from "./elements"; import { AutoFlex, Block, FixedFlex, FlexBlock, FlexFloat, FlexItem, RatioFlex, Table } from "./layouts"; import { ColorValue, CSSMargins, FontStyle } from "./utils"; export interface RowParams { ratios?: number[]; elements: FlexItem[]; } /** * Factory function for creating a new flex layout. * @param elements list of elements to layout with their flex configuration */ export declare function row(params: RowParams): RatioFlex | FixedFlex; /** * Factory function for creating a new flex layout with automatic width. * @param elements list of elements to layout with their flex configuration */ export declare function autoRow(elements: FlexItem[]): AutoFlex; /** * Factory function for creating a new flex item. * @param style flex configuration of the itme * @param element element being wrapped */ export declare function col(element: Element, float?: FlexFloat[], itemWidth?: number): FlexItem; /** * Create a background drawable or give an element * some background * @param color the background color */ export declare function bg(color: ColorValue, element?: Element): Background | ElementBackground; /** * Create an image background * @param src path to the image */ export declare function imgBg(src: string): ImageBackground; /** * Add margins to an element * @param margins CSS Margins * @param element The element being wrapped */ export declare function pad(margins: CSSMargins, element: Element): Padding; /** * Factory function for creating tables * @param header table header * @param data items to put in rows * @param mapper converts an item to a row element */ export declare function table(header: Element, data: T[], mapper: (t: T) => Element): Table; /** * Factory function for creating a new block layout. * @param elements list of elements to layout */ export declare function div(elements: Element[]): Block; /** * Factory function for creating a new block layout that can reside * in an `AutoFlex` layout. * @param elements list of elements to layout */ export declare function flexDiv(elements: Element[]): FlexBlock; /** * Factory function for images * @param src path to the source image. For the sake of everyone involved please use an * absolute path * @param style configuration for the image */ export declare function img(src: string, style: ImageStyle): Image; /** * Factory function to create a new line break * @param height height of vertical space in px */ export declare function br(height: number): LineBreak; /** * Factory function for `Paragraph` * @param text string to be written * @param style font and color to use. Note that the font and font * size affect the `real` width and height of the text element */ export declare function p(text: string, style?: FontStyle): Paragraph; /** * Creates a new renderer that calculates the boxes * needed to draw items and actually draws them. * * @param context the global state of the PDF Document * @param renderables list of elements or layouts to render */ export declare function render(context: Context, renderables: Renderable[]): void; /** * Creates a new Context * @param params context config params */ export declare function configure(params: ContextParams): Context;