underlayStyle is raw string for css. like background-color: black; This needed when you printscreen the element whithout background. So with this prop you can provide style for parent div.
fontFaceTemplate is template function for attaching fonts listed in fonts by default it looks like:
functioncreateFontFace(fontCfg: FontCfg){const{ name, format, uri }=fontCfg;return` @font-face { font-family: "${name}"; src: url(${uri}) format("${format}"); font-weight: normal; font-style: normal; } `;}
Usage
npm install @builat/printscreen
importlogofrom"./logo.svg";import"./App.css";import{printScreen}from"@builat/printscreen";functionappendImg(src){constimg=document.createElement("img");img.src=src;document.getElementById("root").appendChild(img);}functionApp(){return(<divclassName="App"><headerclassName="App-header"><imgsrc={logo}className="App-logo"alt="logo"/><p>
Edit <code>src/App.js</code> and save to reload.
</p><aclassName="App-link"href="https://reactjs.org"target="_blank"rel="noopener noreferrer">
Learn React
</a><buttononClick={()=>printScreen("#root").then(appendImg)}>
print screen
</button></header></div>);}exportdefaultApp;