Text to PDF Converter
body {
font-family: Arial, sans-serif;
}
header {
background-color: #333;
color: white;
text-align: center;
padding: 20px;
}
h1 {
margin: 0;
}
main {
max-width: 800px;
margin: 20px auto;
padding: 20px;
background-color: #f0f0f0;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
.converter-container {
text-align: center;
}
textarea {
width: 100%;
height: 200px;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
background-color: #007bff;
color: white;
border: none;
padding: 10px 20px;
cursor: pointer;
border-radius: 4px;
}
button:hover {
background-color: #0056b3;
}
#pdf-container {
display: none;
}
document.getElementById('convert-button').addEventListener('click', () => {
const inputText = document.getElementById('input-text').value;
// Create a new PDF document
const pdf = new jsPDF();
// Add text to the PDF
pdf.text(inputText, 10, 10);
// Save the PDF to a file
pdf.save('converted-text.pdf');
// Show the PDF container
document.getElementById('pdf-container').style.display = 'block';
});
No comments:
Post a Comment