Wednesday, 16 August 2023

FREE JPJ to PDF CONVERTER



Text to PDF Converter body { font-family: Arial, sans-serif; margin: 0; padding: 0; display: flex; justify-content: center; align-items: center; min-height: 100vh; background-color: #f0f0f0; } .container { text-align: center; background-color: #ffffff; padding: 20px; border-radius: 10px; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2); } h1 { color: #333; } textarea { width: 100%; height: 150px; margin: 10px 0; padding: 10px; border: 1px solid #ccc; border-radius: 5px; } button { padding: 10px 20px; font-size: 16px; background-color: #007bff; color: #fff; border: none; border-radius: 5px; cursor: pointer; } a { padding: 10px 20px; font-size: 16px; background-color: #28a745; color: #fff; border: none; border-radius: 5px; cursor: pointer; text-decoration: none; }

Text to PDF Converter



convertBtn.addEventListener("click", async () => { const pdfDoc = await PDFLib.PDFDocument.create(); const page = pdfDoc.addPage([600, 400]); const text = textArea.value; const textWidth = page.getTextWidth(text); const textHeight = page.getTextHeight(text); page.drawText(text, { x: (600 - textWidth) / 2, y: 400 - ((400 - textHeight) / 2), size: 12, }); const pdfBytes = await pdfDoc.save(); const pdfBlob = new Blob([pdfBytes], { type: "application/pdf" }); const pdfUrl = URL.createObjectURL(pdfBlob); downloadLink.href = pdfUrl; downloadLink.download = "text_to_pdf.pdf"; downloadLink.style.display = "block"; });

No comments:

Post a Comment

FREE JPJ to PDF CONVERTER

Text to PDF Converter body { font-family: Arial, sans-serif; margin: 0; padding: 0; display: f...