Skip to content

leason-wan/print_html_js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

a mini tool for print html page with browser.

Installation

You can download the latest version of print_html_js.js from the GitHub releases or use the npm.

To install via npm:

npm install print_html_js --save
yarn add print_html_js

When installing via npm or yarn, import the library into your project:

import print from 'print_html_js'

Use

<html>
<body>
<div id="print">print this</div>

<script src="https://unpkg.com/print_html_js@0.0.1/dist/print_html.min.js"></script>
<script>
    // const print = document.querySelector('#print');
    // const printHtml = new printHtml(print);
    // or
    const printHtml = new PrintHtml('#print'); // you can add options: {dev: true} enable print css debugger
    printHtml.print();
</script>
</body>
</html>

Detail

accept two arguments elementOrSelector and options

elementOrSelector

arguments type default
dom elementOrSelector -

Options

arguments type default
dev Boolean false
style string ''
printFrameId string 'print-html-id'

Please make sure printFrameId only one in this page

Suport Browser

Chrome | Firefox | IE | Edge | Safari

About

a mini tool for print html page with browser.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published