-
Notifications
You must be signed in to change notification settings - Fork 0
/
pdf.html
37 lines (34 loc) · 2.53 KB
/
pdf.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.2/html2pdf.bundle.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3" crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
<div class="mt-5 card col-8 offset-2 pl-4" id="makepdf" style="background-color: rgb(215, 185, 185); padding-left: 15px; padding-right: 15px;">
<h1 style="text-align: center;">London</h1>
<p class="pl-4">London is the capital city of England. It is the most populous city in the United
Kingdom, with a metropolitan area of over 13 million inhabitants. Standing on the River Thames, London has been a major settlement for two millennia, its history going back to its founding by the Romans, who named it Londinium </p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Obcaecati, itaque esse saepe placeat aperiam excepturi libero cum voluptatibus modi. Architecto voluptatem totam perspiciatis itaque sit ad suscipit at hic dolores. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolores, ex? Similique rerum ratione quisquam labore, dolore nemo nulla voluptas eaque, a sint illo quibusdam maiores voluptate laborum, possimus magnam reiciendis. Lorem ipsum dolor sit amet consectetur, adipisicing elit. Dolorum voluptates exercitationem dolore aliquam nulla repellat odio architecto labore ipsam praesentium, quasi molestiae, molestias illo provident commodi accusamus quas reiciendis. Eveniet.</p>
</div>
<div class="row">
<button id="button" type="button" class="btn btn-dark btn-lg mt-4 col-2 offset-5">Generate PDF</button>
</div>
</div>
<script>
var button = document.getElementById("button");
var makepdf = document.getElementById("makepdf");
button.addEventListener("click", function () {
var mywindow = window.open("", "PRINT", "height=400,width=600");
mywindow.document.write(makepdf.innerHTML);
mywindow.document.close();
mywindow.focus();
mywindow.print();
mywindow.close();
return true;
});
</script>
</body>
</html>