JPG To PDF Converter

🔄 Universal File Converter

Convert between Images & Documents (Audio/Video removed)

🖼️ Image Converter

JPG · PNG · GIF · WebP · BMP

📸 Tap or drag & drop images here
➜

📄 Document Converter

PDF · Word · Excel · PPT · TXT · HTML · JSON · CSV

📁 Tap or drag & drop file here
➜
' + file.name.slice(0, 8) + ''; container.appendChild(div); }; reader.readAsDataURL(file); }); } // ---- IMAGE HANDLER ---- function handleImg(files) { var valid = []; for (var i = 0; i < files.length; i++) { if (files[i].type.startsWith('image/')) { valid.push(files[i]); } } if (valid.length === 0) { showMsg(imgMsg, '⚠️ Please select valid image files', 'error'); return; } imgFiles = valid; renderImgPreview(); showMsg(imgMsg, '✅ ' + imgFiles.length + ' image(s) ready', 'success'); } // ---- IMAGE EVENTS ---- imgInput.addEventListener('change', function(e) { handleImg(e.target.files); }); imgDrop.addEventListener('dragover', function(e) { e.preventDefault(); imgDrop.style.background = '#e2e8f0'; }); imgDrop.addEventListener('dragleave', function() { imgDrop.style.background = '#f8fafc'; }); imgDrop.addEventListener('drop', function(e) { e.preventDefault(); imgDrop.style.background = '#f8fafc'; if (e.dataTransfer.files.length) { handleImg(e.dataTransfer.files); imgInput.files = e.dataTransfer.files; } }); imgDrop.addEventListener('click', function() { imgInput.click(); }); imgClearBtn.addEventListener('click', function() { imgFiles = []; imgInput.value = ''; renderImgPreview(); clearMsg(imgMsg); }); // ---- IMAGE CONVERT ---- imgConvertBtn.addEventListener('click', function() { if (imgFiles.length === 0) { showMsg(imgMsg, '❌ Please select images first', 'error'); return; } var toFormat = imgToFormat.value; if (!toFormat) { showMsg(imgMsg, '❌ Please select output format', 'error'); return; } showMsg(imgMsg, '⏳ Converting... please wait', 'info'); var converted = 0; var total = imgFiles.length; function processNext(index) { if (index >= total) { showMsg(imgMsg, '✅ All ' + total + ' image(s) converted!', 'success'); return; } var file = imgFiles[index]; var reader = new FileReader(); reader.onload = function(e) { var img = new Image(); img.onload = function() { var canvas = document.createElement('canvas'); canvas.width = img.width; canvas.height = img.height; var ctx = canvas.getContext('2d'); ctx.drawImage(img, 0, 0); var mimeType = 'image/' + toFormat; if (toFormat === 'jpg') mimeType = 'image/jpeg'; var dataUrl = canvas.toDataURL(mimeType, 0.92); var link = document.createElement('a'); var name = file.name.replace(/\.[^.]+$/, '') + '.' + toFormat; link.download = name; link.href = dataUrl; document.body.appendChild(link); link.click(); document.body.removeChild(link); converted++; processNext(index + 1); }; img.src = e.target.result; }; reader.readAsDataURL(file); } processNext(0); }); // ---- DOCUMENT PREVIEW ---- function renderDocPreview(file) { if (!file) { docPreview.className = 'uc-preview'; docPreview.innerHTML = ''; return; } docPreview.className = 'uc-preview show'; var icon = '📄'; if (file.type.includes('pdf')) icon = '📑'; else if (file.type.includes('word')) icon = '📝'; else if (file.type.includes('excel')) icon = '📊'; else if (file.type.includes('powerpoint')) icon = '📽️'; else if (file.type.includes('text')) icon = '📃'; docPreview.innerHTML = '
' + icon + '
' + file.name + ' (' + (file.size/1024).toFixed(1) + ' KB)
'; } // ---- DOCUMENT HANDLER ---- function handleDoc(file) { if (!file) { showMsg(docMsg, '⚠️ Please select a valid file', 'error'); return; } docFile = file; renderDocPreview(file); showMsg(docMsg, '✅ File loaded: ' + file.name, 'success'); } // ---- DOCUMENT EVENTS ---- docInput.addEventListener('change', function(e) { if (e.target.files.length) handleDoc(e.target.files[0]); }); docDrop.addEventListener('dragover', function(e) { e.preventDefault(); docDrop.style.background = '#e2e8f0'; }); docDrop.addEventListener('dragleave', function() { docDrop.style.background = '#f8fafc'; }); docDrop.addEventListener('drop', function(e) { e.preventDefault(); docDrop.style.background = '#f8fafc'; if (e.dataTransfer.files.length) { handleDoc(e.dataTransfer.files[0]); docInput.files = e.dataTransfer.files; } }); docDrop.addEventListener('click', function() { docInput.click(); }); docClearBtn.addEventListener('click', function() { docFile = null; docInput.value = ''; renderDocPreview(null); clearMsg(docMsg); }); // ---- DOCUMENT CONVERT ---- docConvertBtn.addEventListener('click', function() { if (!docFile) { showMsg(docMsg, '❌ Please upload a file first', 'error'); return; } var toFormat = docToFormat.value; if (!toFormat) { showMsg(docMsg, '❌ Please select output format', 'error'); return; } showMsg(docMsg, '⏳ Converting to ' + toFormat.toUpperCase() + '...', 'info'); try { var fileName = docFile.name.replace(/\.[^.]+$/, '') + '.' + toFormat; if (toFormat === 'pdf') { var { jsPDF } = window.jspdf; var pdf = new jsPDF(); pdf.text('Document: ' + docFile.name, 10, 10); pdf.text('Size: ' + (docFile.size/1024).toFixed(1) + ' KB', 10, 20); pdf.text('Converted: ' + new Date().toLocaleString(), 10, 30); pdf.text('--- Basic Conversion ---', 10, 40); var blob = pdf.output('blob'); var url = URL.createObjectURL(blob); var a = document.createElement('a'); a.href = url; a.download = fileName; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); showMsg(docMsg, '✅ Converted to PDF!', 'success'); } else if (toFormat === 'txt') { var text = 'Document: ' + docFile.name + '\nSize: ' + (docFile.size/1024).toFixed(1) + ' KB\nConverted: ' + new Date().toLocaleString(); var blob = new Blob([text], { type: 'text/plain' }); var url = URL.createObjectURL(blob); var a = document.createElement('a'); a.href = url; a.download = fileName; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); showMsg(docMsg, '✅ Converted to TXT!', 'success'); } else if (toFormat === 'html') { var html = 'Converted

Document Conversion

Original: ' + docFile.name + '

Size: ' + (docFile.size/1024).toFixed(1) + ' KB

Converted: ' + new Date().toLocaleString() + '

'; var blob = new Blob([html], { type: 'text/html' }); var url = URL.createObjectURL(blob); var a = document.createElement('a'); a.href = url; a.download = fileName; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); showMsg(docMsg, '✅ Converted to HTML!', 'success'); } else if (toFormat === 'json') { var json = { original: docFile.name, size: docFile.size, converted: new Date().toISOString() }; var blob = new Blob([JSON.stringify(json, null, 2)], { type: 'application/json' }); var url = URL.createObjectURL(blob); var a = document.createElement('a'); a.href = url; a.download = fileName; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); showMsg(docMsg, '✅ Converted to JSON!', 'success'); } else if (toFormat === 'csv') { var csv = 'Document Name,Size (KB),Converted Date\n"' + docFile.name + '",' + (docFile.size/1024).toFixed(1) + ',"' + new Date().toLocaleString() + '"'; var blob = new Blob([csv], { type: 'text/csv' }); var url = URL.createObjectURL(blob); var a = document.createElement('a'); a.href = url; a.download = fileName; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); showMsg(docMsg, '✅ Converted to CSV!', 'success'); } else { showMsg(docMsg, '⚠️ ' + toFormat.toUpperCase() + ' conversion coming soon!', 'error'); } } catch (err) { showMsg(docMsg, '❌ Error: ' + err.message, 'error'); } }); // ---- INIT MSG ---- showMsg(imgMsg, '📸 Select images to convert', 'info'); showMsg(docMsg, '📄 Upload document to convert', 'info'); return {}; })();

JPG To PDF Converter – Single Ya Multiple Photos Ko PDF Me Convert Karein! 📄⚡

Aksar official work, school assignments, ya online document submission ke liye photos ko PDF format me upload karna hota hai. Hamara JPG To PDF Converter Tool aapki sabhi JPG, PNG aur JPEG images ko instant high-quality PDF me convert kar deta hai!

Is tool ki madad se aap single image ya multiple images ko ek sath select karke ek clean PDF file me merge kar sakte hain.

Key Features:

  • Instant Conversion: Photos upload karein aur 1-click me PDF download karein.
  • Multiple Images Support: Multiple images ko ek hi PDF document me merge karein.
  • Original Quality Intact: Images ki quality aur resolution bilkul safe rehti hai.
  • 100% Secure & Free: Aapke documents browser me hi process hote hain aur bilkul safe rehte hain.

Aaj hi is JPG To PDF Converter tool ko try karein aur apni photos ko seconds me professional PDF me convert karein!

JPG To PDF Converter

Leave a Comment