Text to PDF Converter
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f2f2f2;
}
.container {
background-color: #ffffff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
max-width: 500px;
width: 100%;
text-align: center;
}
h1 {
color: #007bff;
}
textarea {
width: 100%;
padding: 10px;
margin: 10px 0;
border: 1px solid #ccc;
border-radius: 5px;
}
button {
padding: 10px 20px;
background-color: #007bff;
color: #ffffff;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
a {
margin-top: 10px;
color: #007bff;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
const convertButton = document.getElementById('convert-btn');
const textInput = document.getElementById('text-input');
const downloadLink = document.getElementById('download-link');
convertButton.addEventListener('click', () => {
const text = textInput.value;
if (text.trim() !== '') {
const pdf = new jsPDF();
pdf.text(text, 10, 10);
pdf.save('converted.pdf');
downloadLink.style.display = 'block';
}
});
br<
No comments:
Post a Comment