Tuesday, February 25, 2025
}
}
Text to PDF Converter
/* General Styles */
body {
font-family: 'Arial', sans-serif;
background: linear-gradient(135deg, #ff9a9e, #fad0c4, #fad0c4, #ffdde1);
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
margin: 0;
}
/* Container */
.container {
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.2);
max-width: 400px;
width: 100%;
}
/* Heading */
h1 {
color: #ff6b81;
font-size: 24px;
}
function generatePDF() {
const { jsPDF } = window.jspdf;
let doc = new jsPDF();
let text = document.getElementById("textInput").value;
if (text.trim() === "") {
alert("Please enter some text!");
return;
}
doc.setFont("helvetica", "bold");
doc.setFontSize(14);
doc.text("Converted Text to PDF", 10, 10);
doc.setFont("times", "normal");
doc.setFontSize(12);
doc.text(text, 10, 20, { maxWidth: 180 });
doc.save("converted.pdf");
}
/* Textarea */
textarea {
width: 100%;
height: 150px;
padding: 10px;
border: 2px solid #ff6b81;
border-radius: 5px;
resize: none;
font-size: 16px;
outline: none;
}
/* Button */
button {
background: #ff6b81;
color: white;
border: none;
padding: 10px 15px;
font-size: 16px;
cursor: pointer;
border-radius: 5px;
margin-top: 10px;
transition: 0.3s;
}
button:hover {
background: #ff4757;
}
/* Responsive */
@media (max-width: 500px) {
.container {
width: 90%;
}
}
Subscribe to:
Post Comments (Atom)
} } Responsive Text Editor Responsive Text Editor B ...

No comments:
Post a Comment