Skip to content

Home > robinson > printByDom

printByDom() function

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

通过DOM元素打印内容

Signature:

typescript
declare function printByDom(el: HTMLElement, custStyle?: string): void;
declare function printByDom(el: HTMLElement, custStyle?: string): void;

Parameters

ParameterTypeDescription
elHTMLElement要打印的DOM元素
custStylestring(Optional) 自定义CSS样式

Returns:

void

Example

printByDom(document.getElementById('print-content'), 'body { font-size: 12px; }');

Released under the MIT License.