Business Card Generator
`);
});downloadPngBtn.addEventListener('click', () => downloadImage('png'));
downloadJpgBtn.addEventListener('click', () => downloadImage('jpg'));
downloadPdfBtn.addEventListener('click', downloadPDF);// Reset function
resetBtn.addEventListener('click', function() {
nameInput.value = '';
titleInput.value = '';
companyInput.value = '';
emailInput.value = '';
phoneInput.value = '';
websiteInput.value = '';
logoInput.value = '';
logoSrc = '';
logoSizeInput.value = '40';
bgColorPicker.value = '#1e3c72';
textColorPicker.value = '#ffffff';
colorOptions.forEach((option, index) => {
option.classList.toggle('active', index === 0);
if (index === 0) cardFront.style.background = option.getAttribute('data-gradient');
});
layoutOptions.forEach((option, index) => {
if (index === 1) { // Second layout (horizontal) as default
option.classList.add('active');
cardPreview.className = 'bc-card-preview bc-card-horizontal';
cardFront.innerHTML = '';
const logoImg = document.createElement('img');
logoImg.id = 'bc-logo-preview';
logoImg.className = 'bc-card-logo-img';
logoImg.alt = 'Company Logo';
cardFront.appendChild(logoImg);
const infoSection = document.createElement('div');
infoSection.className = 'bc-card-info';
infoSection.appendChild(cardName);
infoSection.appendChild(cardTitle);
const contactInfo = document.createElement('div');
contactInfo.className = 'bc-card-contact';
contactInfo.appendChild(cardEmail);
contactInfo.appendChild(cardPhone);
contactInfo.appendChild(cardWebsite);
infoSection.appendChild(contactInfo);
cardFront.appendChild(infoSection);
cardFront.appendChild(cardWatermark);
} else {
option.classList.remove('active');
}
});
updatePreview();
document.getElementById('bc-name-error').style.display = 'none';
});// Initial preview (horizontal layout as default)
updatePreview();
layoutOptions[1].click(); // Trigger horizontal layout on load
});