Back to Home
Smart CSC Tools

Multiple ID Cards Print Tool

Upload different ID cards (Aadhaar, PAN, Voter ID, Driving License, Passport) and print them all on one A4 page with exact dimensions

Click to add multiple cards (max 4 cards per page)

Your Cards (0/4)

No cards added yet. Click "Add New Card" to start.

Print Settings

How to Use:

  • Add cards using "Add New Card" button
  • Select card type (dimensions auto-set)
  • Upload front and back images
  • Use editor to adjust image position (live preview)
  • Set print settings (gaps, margins)
  • Preview layout on right panel
  • Click "Print Now" or "Download PDF"

Live Print Preview

A4 (210mm × 297mm)

Preview is scaled down. Actual print will be exact size (85.6×54mm for standard cards).

0 Total Cards
0 Front Images
0 Back Images
`; } // ==================== DOWNLOAD PDF ==================== function downloadPDF() { if (cards.length === 0) { alert('Please add at least one card'); return; } toggleLoading(true); // Get all card slots const slots = getAllCardSlots(); if (slots.length === 0) { alert('No images to export'); toggleLoading(false); return; } // Calculate grid layout const cols = printSettings.cardsPerRow; // Calculate exact card dimensions const availableWidth = 210 - (2 * printSettings.marginH); const totalGapWidth = (cols - 1) * printSettings.hGap; const cardWidth = (availableWidth - totalGapWidth) / cols; // Create container with exact A4 dimensions const container = document.createElement('div'); container.style.width = '210mm'; container.style.minHeight = '297mm'; container.style.backgroundColor = 'white'; container.style.position = 'relative'; container.style.margin = '0'; container.style.padding = '0'; container.style.boxSizing = 'border-box'; // Create grid const gridDiv = document.createElement('div'); gridDiv.style.display = 'grid'; gridDiv.style.gridTemplateColumns = `repeat(${cols}, ${cardWidth}mm)`; gridDiv.style.gap = `${printSettings.vGap}mm ${printSettings.hGap}mm`; gridDiv.style.padding = `${printSettings.marginV}mm ${printSettings.marginH}mm`; gridDiv.style.width = '210mm'; gridDiv.style.minHeight = '297mm'; gridDiv.style.boxSizing = 'border-box'; gridDiv.style.backgroundColor = 'white'; gridDiv.style.alignContent = 'start'; // Add cards slots.forEach((slot) => { const typeInfo = cardTypes[slot.type]; const width = slot.type === 'custom' ? slot.customWidth : typeInfo.width; const height = slot.type === 'custom' ? slot.customHeight : typeInfo.height; const ratio = width / height; const cardHeight = cardWidth / ratio; const cardDiv = document.createElement('div'); cardDiv.style.width = `${cardWidth}mm`; cardDiv.style.height = `${cardHeight}mm`; cardDiv.style.backgroundColor = 'white'; cardDiv.style.border = '1px solid #ccc'; cardDiv.style.borderRadius = '4px'; cardDiv.style.overflow = 'hidden'; cardDiv.style.position = 'relative'; // Get correct image and transformations const imgSrc = slot.side === 'front' ? slot.frontImage : slot.backImage; if (imgSrc) { const trans = slot.side === 'front' ? slot.transformations.front : slot.transformations.back; const img = document.createElement('img'); img.src = imgSrc; img.style.width = '100%'; img.style.height = '100%'; img.style.objectFit = 'contain'; // Scale transformations to card size const scaleX = cardWidth / width; const scaleY = cardHeight / height; const avgScale = (scaleX + scaleY) / 2; img.style.transform = `translate(${trans.x * avgScale}px, ${trans.y * avgScale}px) scale(${trans.scale}) rotate(${trans.rotate}deg) scaleX(${trans.flipH}) scaleY(${trans.flipV})`; cardDiv.appendChild(img); } else { cardDiv.style.backgroundColor = '#f5f5f5'; cardDiv.style.display = 'flex'; cardDiv.style.alignItems = 'center'; cardDiv.style.justifyContent = 'center'; cardDiv.style.color = '#999'; cardDiv.style.fontSize = '10px'; cardDiv.textContent = 'No Image'; } gridDiv.appendChild(cardDiv); }); container.appendChild(gridDiv); document.body.appendChild(container); // Capture with html2canvas at high resolution html2canvas(container, { scale: 3, backgroundColor: '#ffffff', logging: false, allowTaint: true, useCORS: true, windowWidth: 210, windowHeight: 297 }).then(canvas => { const { jsPDF } = window.jspdf; const pdf = new jsPDF({ orientation: 'portrait', unit: 'mm', format: 'a4' }); const imgData = canvas.toDataURL('image/jpeg', 0.95); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); pdf.addImage(imgData, 'JPEG', 0, 0, pdfWidth, pdfHeight, undefined, 'FAST'); const totalSlots = slots.length; const cardText = totalSlots === 1 ? '1-card' : `${totalSlots}-cards`; pdf.save(`smart-csc-tools-id-cards-${cardText}.pdf`); document.body.removeChild(container); toggleLoading(false); }).catch(error => { console.error('PDF Error:', error); document.body.removeChild(container); toggleLoading(false); alert('Error generating PDF. Please try again.'); }); } // ==================== TOAST NOTIFICATION ==================== function showToast(message, type = 'success') { // Create toast element const toast = document.createElement('div'); toast.className = `fixed bottom-4 right-4 px-6 py-3 rounded-lg text-white ${type === 'success' ? 'bg-green-500' : 'bg-blue-500'} shadow-lg z-50 animate-bounce`; toast.textContent = message; document.body.appendChild(toast); // Remove after 3 seconds setTimeout(() => { toast.remove(); }, 3000); } // ==================== UTILITIES ==================== function toggleLoading(show) { document.getElementById('loading').classList.toggle('hidden', !show); }