JPG to PDF Converter
JPG to PDF Converter
function convertToPDF() {
const fileInput = document.getElementById('fileInput');
const file = fileInput.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(e) {
const imgData = e.target.result;
const doc = new jsPDF();
doc.addImage(imgData, 'JPEG', 10, 10, 190, 150); // Adjust the positioning and dimensions of the image
doc.save('converted.pdf');
};
reader.readAsDataURL(file);
}
}