pdf-creator
by velo_ninja
HTML
<!DOCTYPE html>
<html>
<head>
<title>Print JS Example</title>
<script src="https://printjs-4de6.kxcdn.com/print.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f4f4f4;
}
.container {
max-width: 800px;
margin: 0 auto;
background-color: #fff;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.item {
margin-bottom: 20px;
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
background-color: #f9f9f9;
}
.item-title {
font-size: 22px;
font-weight: bold;
color: #333;
margin-bottom: 10px;
}
.item-detail {
font-size: 16px;
margin-left: 20px;
color: #555;
}
button {
display: block;
width: 100%;
padding: 10px;
font-size: 18px;
color: #fff;
background-color: #007BFF;
border: none;
border-radius: 5px;
cursor: pointer;
margin-top: 20px;
}
button:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="container">
<div id="printable-content"></div>
<button onclick="printContent()">Print Content</button>
</div>
<script>
const jsonData = [
{
"productID": "1001",
"productName": "Wireless Mouse",
"productCategory": "Electronics",
"productPrice": 29.99,
"productStock": 100,
"productDescription": "A high-precision wireless mouse with ergonomic design."
},
{
"productID": "1002",
"productName": "Bluetooth Headphones",
"productCategory": "Electronics",
"productPrice": 59.99,
"productStock": 50,
"productDescription": "Noise-cancelling over-ear Bluetooth headphones with long battery life."
},
{
"productID": "1003",
"productName": "Yoga Mat",
"productCategory": "Fitness",
"productPrice":...