Untitled
unknown
plain_text
a year ago
4.6 kB
17
Indexable
import pdfkit
options = {
'page-size': 'A4',
'margin-top': '0in',
'margin-bottom': '0in',
'margin-left': '0in',
'margin-right': '0in',
'page-height': '11.69in'
}
html_s = """
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Certificate</title>
<style type="text/css">
body, html {
margin: 0;
padding: 0;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background-color: #000;
font-family: 'Raleway', sans-serif;
color: #fff;
}
.certificate {
width: 100vw;
height: 100vh;
position: relative;
overflow: hidden;
background: linear-gradient(135deg, #1c1c1c 0%, #2d2d2d 50%, #1c1c1c 100%);
}
.content {
position: relative;
z-index: 1;
width: 90%;
height: 90%;
margin: auto;
padding: 40px;
border: 2px solid #d4af37;
box-shadow: 0 0 50px rgba(212, 175, 55, 0.2);
display: flex;
flex-direction: column;
justify-content: space-between;
background: linear-gradient(135deg, rgba(30,30,30,0.9) 0%, rgba(45,45,45,0.9) 100%);
backdrop-filter: blur(10px);
}
header {
text-align: center;
}
.logo {
width: 150px;
margin-bottom: 20px;
filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.5));
}
h1 {
font-family: 'Cinzel', serif;
font-size: 36px;
color: #d4af37;
margin: 0;
letter-spacing: 2px;
text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}
main {
text-align: center;
flex-grow: 1;
display: flex;
flex-direction: column;
justify-content: center;
}
.honor, .accomplishment {
font-size: 18px;
margin: 10px 0;
color: #e0e0e0;
}
.name {
font-family: 'Cinzel', serif;
font-size: 48px;
margin: 20px 0;
color: #d4af37;
text-shadow: 0 0 15px rgba(212, 175, 55, 0.5);
}
.program {
font-size: 24px;
margin: 20px 0;
color: #fff;
text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}
.details {
margin: 20px 0;
font-size: 16px;
}
.details span {
color: #d4af37;
font-weight: 600;
}
.score-badge {
margin: 30px auto;
width: 100px;
height: 100px;
}
.score-badge svg {
width: 100%;
height: 100%;
filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.5));
}
.score-badge text {
fill: #d4af37;
font-family: 'Cinzel', serif;
font-weight: bold;
}
footer {
display: flex;
justify-content: space-between;
align-items: flex-end;
}
.signature, .company-info {
text-align: center;
}
.signature img {
width: 150px;
margin-bottom: 10px;
filter: brightness(1.2) contrast(1.2);
}
.title {
font-style: italic;
color: #d4af37;
}
.company-info p {
margin: 5px 0;
font-size: 14px;
color: #e0e0e0;
}
.cert-id {
color: #d4af37;
font-size: 12px;
}
@media (max-width: 768px) {
.content {
padding: 20px;
}
h1 {
font-size: 28px;
}
.name {
font-size: 36px;
}
.program {
font-size: 20px;
}
.details, .honor, .accomplishment {
font-size: 14px;
}
}
</style>
</head>
<body>
<div class="certificate">
<div class="content">
<main>
<p class="honor">With great distinction, we hereby recognize</p>
<h2 class="name">Aubdur Rob Anik</h2>
<p class="accomplishment">for demonstrating unparalleled expertise in</p>
<h3 class="program">Python Learning</h3>
<div class="details">
<p>Program Completed: <span>June 30, 2024</span></p>
<p>Achievement Level: <span>Passed</span></p>
</div>
<div class="score-badge">
<svg viewBox="0 0 100 100">
<circle cx="50" cy="50" r="45" fill="none" stroke="#d4af37" stroke-width="5"/>
<text x="50" y="50" text-anchor="middle" dy=".3em" font-size="24">70%</text>
</svg>
</div>
</main>
<footer>
<div class="signature">
<p>Dr. Iqbal Ahmed Fakhrul Hasan</p>
<p class="title">Chief Technology Officer</p>
</div>
<div class="company-info">
<p>Divine IT Limited</p>
<p>Customer.Commitment.Technology</p>
</div>
</footer>
</div>
</div>
</body>
</html>
"""
pdfkit.from_string(html_s, 'output1.pdf', options=options)
Editor is loading...
Leave a Comment