Text to PDF Converter
css
Copy code
body {
font-family: Arial, sans-serif;
background-color: #f3f3f3;
}
.container {
max-width: 600px;
margin: 50px auto;
padding: 20px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
}
textarea {
width: 100%;
height: 200px;
margin-bottom: 20px;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
button {
display: block;
width: 100%;
padding: 10px;
margin: 0 auto 20px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
a {
display: block;
width: 100%;
padding: 10px;
margin: 0 auto;
text-align: center;
background-color: #28a745;
color: #fff;
border: none;
border-radius: 5px;
text-decoration: none;
}
a:hover {
background-color: #218838;
}
javascript
Copy code
document.getElementById('convertButton').addEventListener('click', function() {
const text = document.getElementById('textInput').value;
const blob = new Blob([text], { type: 'application/pdf' });
const url = URL.createObjectURL(blob);
const downloadLink = document.getElementById('downloadLink');
downloadLink.href = url;
downloadLink.style.display = 'block';
});