react-print-tool
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

react-print-tool

Provides methods to open print preview for a specific component

Installation

if you're using react version >= 16.8.0

npm install react-print-tool@latest

else

npm install react-print-tool@2.0.0

Usage

Version 3.0.0

 
import {
  printComponent,
  printExistingElement,
  printHtml
} from "react-print-tool";
 
//use your own react component
await printComponent(<TheBestReactComponent prop={data} />);
 
// use html in a string
await printHtml("<div>Hello world</div>");
 
// use selector to print an existing html element
await printExistingElement("div.elementClass #elementID");
 

Version 2.0.0

Import the react tool object and use one of the provided methods

Example

 
 import { PrintTool } from "react-print-tool"
 
//use your own react component
 PrintTool.printFromReactComponent(<TheBestReactComponent prop={data} /> )
 
 // use html in a string
 PrintTool.printFromString("<div>Hello world</div>" )
 
// use selector to print an existing html element
 PrintTool.printExistingElement("div.elementClass #elementID")
 

Package Sidebar

Install

npm i react-print-tool

Weekly Downloads

203

Version

3.0.0

License

MIT

Unpacked Size

8.42 kB

Total Files

19

Last publish

Collaborators

  • amine_bchir