Multi-Tool Pack for drsanakhan.com

PDF to Word Converter

Extract readable text from your PDF document and download as a Word document (.doc).

JPG / Image to PDF Converter

Convert JPG or PNG images into a clean PDF document instantly.

Image Resizer

Resize any image to exact Width and Height dimensions in pixels.

Image Compressor

Reduce image file size while retaining optimal visual quality.

";const blob = new Blob(['' + docContent], { type: 'application/msword' }); const url = URL.createObjectURL(blob); resBox.innerHTML = `✅ Conversion Completed!
📥 Download Word Document (.doc)`; } catch(e) { resBox.innerHTML = '❌ Error processing PDF file.'; } }// 2. JPG to PDF function convertJpgToPdf() { const input = document.getElementById('jpgPdfInput'); const resBox = document.getElementById('jpgPdfResult'); if (!input.files[0]) { alert('Please select an image first.'); return; }resBox.style.display = 'block'; resBox.innerHTML = 'Converting Image to PDF...';const file = input.files[0]; const reader = new FileReader();reader.onload = function(e) { const img = new Image(); img.src = e.target.result; img.onload = function() { const { jsPDF } = window.jspdf; const orientation = img.width > img.height ? 'l' : 'p'; const doc = new jsPDF(orientation, 'px', [img.width, img.height]); doc.addImage(img.src, 'JPEG', 0, 0, img.width, img.height); const pdfBlob = doc.output('blob'); const url = URL.createObjectURL(pdfBlob);resBox.innerHTML = `✅ PDF Generated Successfully!
📥 Download PDF File`; }; }; reader.readAsDataURL(file); }// Auto-load dimensions for resizer function autoLoadDimensions(input) { if (input.files && input.files[0]) { const reader = new FileReader(); reader.onload = function(e) { const img = new Image(); img.src = e.target.result; img.onload = function() { document.getElementById('resizeWidth').value = img.width; document.getElementById('resizeHeight').value = img.height; }; }; reader.readAsDataURL(input.files[0]); } }// 3. Image Resizer function processResizeImage() { const input = document.getElementById('resizeInput'); const width = parseInt(document.getElementById('resizeWidth').value); const height = parseInt(document.getElementById('resizeHeight').value); const resBox = document.getElementById('resizeResult');if (!input.files[0]) { alert('Please select an image file.'); return; } if (!width || !height) { alert('Please specify valid Width and Height.'); return; }resBox.style.display = 'block'; resBox.innerHTML = 'Resizing Image...';const file = input.files[0]; const reader = new FileReader();reader.onload = function(e) { const img = new Image(); img.src = e.target.result; img.onload = function() { const canvas = document.createElement('canvas'); canvas.width = width; canvas.height = height; const ctx = canvas.getContext('2d'); ctx.drawImage(img, 0, 0, width, height);canvas.toBlob(function(blob) { const url = URL.createObjectURL(blob); resBox.innerHTML = `✅ Image Resized (${width}x${height}px)!
📥 Download Resized Image`; }, file.type || 'image/jpeg'); }; }; reader.readAsDataURL(file); }// 4. Image Compressor function processCompressImage() { const input = document.getElementById('compressInput'); const quality = parseFloat(document.getElementById('compressQuality').value); const resBox = document.getElementById('compressResult');if (!input.files[0]) { alert('Please select an image file.'); return; }resBox.style.display = 'block'; resBox.innerHTML = 'Compressing Image...';const file = input.files[0]; const originalSize = (file.size / 1024).toFixed(1); const reader = new FileReader();reader.onload = function(e) { const img = new Image(); img.src = e.target.result; img.onload = function() { const canvas = document.createElement('canvas'); canvas.width = img.width; canvas.height = img.height; const ctx = canvas.getContext('2d'); ctx.drawImage(img, 0, 0);canvas.toBlob(function(blob) { const compressedSize = (blob.size / 1024).toFixed(1); const url = URL.createObjectURL(blob); resBox.innerHTML = `✅ Compressed! Size: ${originalSize} KB ➔ ${compressedSize} KB
📥 Download Compressed Image`; }, 'image/jpeg', quality); }; }; reader.readAsDataURL(file); }