How i create the print button in JSX code of ReactJs for printing a page or PDF files direct print from the printer onClick without asking any Destination, pages, layout, color or any setting throw the window popup?
I'm expecting full example of JSX code to print the bus ticket or movie ricket directfrom the printer I Don't want this window popup for printing my page or any fileswithout asking by window popup!
// import { useRef } from "react";
import React from "react";
import styles from "../Components/ReactPdfPrint.module.css";
import "bootstrap/dist/css/bootstrap.min.css";
const handlePrint = () => {
};
const ReactPdfPrint = () => {
return (
<>
<div className={styles.ticket}>
<img src="./ticketLogo.jpg" alt="Logo" height="30px" width="30px" />
<p className={styles.centered}>
RECEIPT EXAMPLE
<br />
Address line 1
<br />
Address line 2
</p>
<table>
<thead>
<tr>
<th className={styles.quantity}>Q.</th>
<th className={styles.description}>Description</th>
<th className={styles.price}>$$</th>
</tr>
</thead>
<tbody>
<tr>
<td className={styles.quantity}>1.00</td>
<td className={styles.description}>ARDUINO UNO R3</td>
<td className={styles.price}>$25.00</td>
</tr>
<tr>
<td className={styles.quantity}>2.00</td>
<td className={styles.description}>JAVASCRIPT BOOK</td>
<td className={styles.price}>$10.00</td>
</tr>
<tr>
<td className={styles.quantity}>1.00</td>
<td className={styles.description}>STICKER PACK</td>
<td className={styles.price}>$10.00</td>
</tr>
<tr>
<td className={styles.quantity} />
<td className={styles.description}>TOTAL</td>
<td className={styles.price}>$55.00</td>
</tr>
</tbody>
</table>
</div>
<p className="centered">
Thanks for your purchase!
<br />
partible.me/blog
</p>
<button id="btnPrint" className={styles.container} onClick={handlePrint}>
Print
</button>
</>
);
};
export default ReactPdfPrint;