feat: printf as pdf in wiki
print-internals
Changes to - Expose puppeteers
PDFOptions
as optionaloptions
, this allows the insertion of footerTemplate/headerTemplate/margins and so on.
/**
* Valid options to configure PDF generation via {@link Page.pdf}.
* @public
*/
export declare interface PDFOptions {
scale?: number;
displayHeaderFooter?: boolean;
headerTemplate?: string;
footerTemplate?: string;
printBackground?: boolean;
landscape?: boolean;
pageRanges?: string;
format?: PaperFormat;
width?: string | number;
height?: string | number;
preferCSSPageSize?: boolean;
margin?: PDFMargin;
path?: string;
omitBackground?: boolean;
tagged?: boolean;
outline?: boolean;
timeout?: number;
}
All the createPDF functions have options
as last optional param now:
export const createPDFFromUrl = (url: string, timeoutMS: number = 5000, sessionID?: string, options?: PDFOptions)
export const createPDFFromContent = (html: string, timeoutMS: number = 5000, options?: PDFOptions)
export const createPDFBufferFromComponent = async ({
component,
queryParams = '',
timeout,
sessionID,
options,
}: {
component: string;
queryParams?: string;
timeout?: number;
sessionID?: string;
options?: PDFOptions;
})
export const createPDFFromComponent = async ({
component,
queryParams = '',
timeout,
fileName,
sessionID,
options,
}: {
component: string;
queryParams?: string;
timeout?: number;
fileName?: string;
sessionID?: string;
options?: PDFOptions;
})
Edited by Daniel Schmidt