html-element-print

1.0.2 • Public • Published

HTML Element Print

demo

安装

npm install html-element-print

引入方式

CommonJS 或者 es6引入方式

  import htmlElementPrint from 'html-element-print';

原始引入方式

    <script type="text/javascript" src="print-html-element.js"></script> 

element 支持 text html或者 dom对象.

examples

  const element = document.querySelector('#printElement');
  htmlElementPrint(element, {sourceType: 'dom'});

使用

    htmlElementPrint(element, options);

api

参数说明

    1. element: 原生dom对象或html字符串
    1. options: 配置说明, 类似为object
成员 说明 类型 默认值
htmlType 设置element类型(domObjtext) string domObj
printMode 打印的方式 string(popup) string
pageTitle 打印标题 string -
templateString 打印的模板 见:example
popupProperties 设置新开窗口window.open参数 string ''
stylesheets 设置打印的外部样式表 ''
styles 设置打印的内部样式表 ''

Package Sidebar

Install

npm i html-element-print

Weekly Downloads

11

Version

1.0.2

License

MIT

Unpacked Size

158 kB

Total Files

11

Last publish

Collaborators

  • edmund_chen