π»Professional Barcode Generator
Generate enterprise-grade barcodes instantly - Code128, EAN-13, UPC-A, Code39 and more. Professional quality for retail, inventory, shipping, and product identification with advanced validation.
π€ What Is a Barcode Generator?
Think of barcodes as the unique fingerprints for products that scanners can read - that's how stores track inventory instantly! Our professional generator creates Code128, EAN-13, UPC-A, Code39, and more formats with customizable options. Generate, download, and print barcodes in seconds - no signup needed!
Advanced Options
π Try Sample Barcodes
π¦ Product Code
1234567890123
π Text Data
HELLO WORLD
π Website URL
https://wiapincode.com
π Batch Processing
Multiple codes at once
π Auto Check Digit
Automatic validation
π Advanced Features
Barcode Analysis:
Format: ${currentBarcode.type}
Dimensions: ${width}Γ${height}px
Data Length: ${currentBarcode.data.length} characters
Compliance: Industry Standard β
`;
if (issues.length > 0) {
html += `
Format: ${currentBarcode.type}
Dimensions: ${width}Γ${height}px
Data Length: ${currentBarcode.data.length} characters
Compliance: Industry Standard β
Potential Issues:
${issues.map(issue => `β’ ${issue}`).join('
')}
`;
}
if (recommendations.length > 0) {
html += `
${issues.map(issue => `β’ ${issue}`).join('
')}
Recommendations:
${recommendations.map(rec => `β’ ${rec}`).join('
')}
`;
} else {
html += `
${recommendations.map(rec => `β’ ${rec}`).join('
')}
β Excellent: Your barcode meets all quality standards for professional use.
`;
}
contentContainer.innerHTML = html;
resultsContainer.style.display = 'block';
resultsContainer.scrollIntoView({ behavior: 'smooth', block: 'center' });
trackEvent('barcode_validated', { quality_score: qualityScore, readability_score: readabilityScore });
}
// ========== UTILITY FUNCTIONS ==========
// Copy to clipboard
function copyToClipboard(text) {
navigator.clipboard.writeText(text).then(() => {
showNotification('Copied to clipboard!', 'success');
}).catch(() => {
// Fallback for older browsers
const textArea = document.createElement('textarea');
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
document.execCommand('copy');
document.body.removeChild(textArea);
showNotification('Copied to clipboard!', 'success');
});
}
// Show error
function showError(elementId, message) {
const errorElement = document.getElementById(elementId);
if (errorElement) {
errorElement.textContent = message;
}
}
// Clear errors
function clearErrors() {
document.querySelectorAll('.error').forEach(el => el.textContent = '');
}
// Show notification toast
function showNotification(message, type = 'success') {
const toast = document.createElement('div');
toast.className = `toast ${type}`;
toast.textContent = message;
document.body.appendChild(toast);
setTimeout(() => {
toast.remove();
}, 3000);
}
// Show OTA section (dynamic)
function showOTA() {
const otaContainer = document.getElementById('otaContainer');
if (otaContainer && (otaContainer.style.display === 'none' || !otaContainer.style.display)) {
// Customize OTA message for barcode context
const header = otaContainer.querySelector('.ota-header h3');
const subtext = otaContainer.querySelector('.ota-header p');
header.textContent = 'π’ Need Business Travel Services?';
subtext.textContent = 'Find the best deals for business trips, conferences, and corporate events';
otaContainer.style.display = 'block';
// Attention-grabbing pulse effect
setTimeout(() => {
if (header) {
header.style.animation = 'pulse 1s ease-in-out';
}
}, 100);
}
}
// Analytics tracking
function trackEvent(eventName, data = {}) {
if (typeof gtag !== 'undefined') {
gtag('event', eventName, {
'event_category': TOOL_CONFIG.category,
'event_label': TOOL_CONFIG.name,
...data
});
}
}
// ========== AI ASSISTANT FUNCTIONS ==========
// AI λͺ¨λ¬ μ΄κΈ°
function openAIModal() {
const modal = document.getElementById('aiModal');
if(modal) modal.classList.add('show');
// νμ¬ μνμ λ°λΌ μ μ ν νλ©΄ νμ
if (aiModalState.apiKey && aiModalState.currentView === 'gemini') {
showGeminiChat();
} else {
showAISelector();
}
updateAPIKeyStatus();
}
// AI λͺ¨λ¬ λ«κΈ°
function closeAIModal() {
const modal = document.getElementById('aiModal');
if(modal) modal.classList.remove('show');
// 300ms ν μν 리μ
(μ λλ©μ΄μ
μλ£ ν)
setTimeout(() => {
aiModalState.currentView = 'selector';
showAISelector();
}, 300);
}
// AI μ ν νλ©΄ νμ
function showAISelector() {
document.getElementById('aiModalTitle').textContent = 'Choose Your AI Assistant';
document.getElementById('aiSelector').style.display = 'flex';
document.getElementById('geminiChat').style.display = 'none';
document.getElementById('apiKeySetup').style.display = 'none';
aiModalState.currentView = 'selector';
}
// Gemini μ±ν
νλ©΄ νμ
function showGeminiChat() {
document.getElementById('aiModalTitle').innerHTML = 'β¨ Gemini AI Assistant';
document.getElementById('aiSelector').style.display = 'none';
document.getElementById('geminiChat').style.display = 'flex';
document.getElementById('apiKeySetup').style.display = 'none';
aiModalState.currentView = 'gemini';
// μ΄κΈ° λ©μμ§κ° μμΌλ©΄ μΆκ°
const chatMessages = document.getElementById('chatMessages');
if (!chatMessages.innerHTML.trim()) {
addMessage('assistant', `Hello! I can help you with:
β’ Barcode format selection guidance
β’ Best practices for barcode generation
β’ Troubleshooting barcode scanning issues
β’ Industry-specific barcode requirements
β’ WIA Pin Code system questions
What would you like to know about barcodes?`);
}
}
// API ν€ μ€μ νλ©΄ νμ
function showAPIKeySetup() {
document.getElementById('aiModalTitle').textContent = 'Setup Gemini API';
document.getElementById('aiSelector').style.display = 'none';
document.getElementById('geminiChat').style.display = 'none';
document.getElementById('apiKeySetup').style.display = 'block';
aiModalState.currentView = 'setup';
}
// AI μ ν μ²λ¦¬
function selectAI(aiType) {
switch(aiType) {
case 'chatgpt':
const toolContext = `I need help with barcode generation. I'm using a barcode generator tool that supports Code128, EAN-13, UPC-A, and other formats. This is part of the WIA Pin Code platform.`;
const chatUrl = `https://chat.openai.com/?q=${encodeURIComponent(toolContext)}`;
window.open(chatUrl, '_blank');
closeAIModal();
trackEvent('ai_selection', { ai_type: 'chatgpt' });
break;
case 'claude':
const claudeContext = `I need help with barcode generation. I'm using a barcode generator tool that supports various formats like Code128, EAN-13, UPC-A, etc. This is part of the WIA Pin Code platform.`;
const claudeUrl = `https://claude.ai/chat?q=${encodeURIComponent(claudeContext)}`;
window.open(claudeUrl, '_blank');
closeAIModal();
trackEvent('ai_selection', { ai_type: 'claude' });
break;
case 'gemini':
if (!aiModalState.apiKey) {
showAPIKeySetup();
} else {
showGeminiChat();
}
trackEvent('ai_selection', { ai_type: 'gemini' });
break;
}
}
// API ν€ μ μ₯
function saveGeminiApiKey() {
const apiKey = document.getElementById('geminiApiKeyInput').value.trim();
if (apiKey) {
localStorage.setItem('geminiApiKey', apiKey);
aiModalState.apiKey = apiKey;
showGeminiChat();
updateAPIKeyStatus();
} else {
alert('Please enter a valid API key');
}
}
// API ν€ μν μ
λ°μ΄νΈ
function updateAPIKeyStatus() {
const statusEl = document.getElementById('apiKeyStatus');
if (aiModalState.apiKey) {
statusEl.innerHTML = 'Change API Key';
} else {
statusEl.textContent = 'No API key set';
}
}
// μ±ν
λ©μμ§ μΆκ°
function addMessage(type, content) {
const chatMessages = document.getElementById('chatMessages');
const messageDiv = document.createElement('div');
messageDiv.className = `message ${type}`;
if (type === 'user') {
messageDiv.innerHTML = `You: ${content}`;
} else {
messageDiv.innerHTML = `β¨ Gemini:${content.replace(/\n/g, '
')}`; } chatMessages.appendChild(messageDiv); chatMessages.scrollTop = chatMessages.scrollHeight; } // Geminiμ λ©μμ§ μ μ‘ async function sendToGemini() { const input = document.getElementById('geminiInput'); const message = input.value.trim(); if (!message) return; // μ¬μ©μ λ©μμ§ μΆκ° addMessage('user', message); input.value = ''; // λ‘λ© νμ const loadingMsg = document.createElement('div'); loadingMsg.className = 'message assistant'; loadingMsg.innerHTML = 'β¨ Gemini:
Thinking...'; loadingMsg.id = 'loading-message'; document.getElementById('chatMessages').appendChild(loadingMsg); try { const response = await fetch(`https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=${aiModalState.apiKey}`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ contents: [{ parts: [{ text: `Context: User is using a barcode generator tool on WIA Pin Code platform. The tool supports various barcode formats: Code128, EAN-13, UPC-A, EAN-8, Code39, ITF-14, MSI, Pharmacode, Codabar. WIA Pin Code is a universal address system for countries without postal codes. User question: ${message}` }] }], generationConfig: { temperature: 0.7, maxOutputTokens: 1000 } }) }); const data = await response.json(); // λ‘λ© λ©μμ§ μ κ±° document.getElementById('loading-message').remove(); if (data.candidates && data.candidates[0] && data.candidates[0].content) { const reply = data.candidates[0].content.parts[0].text; addMessage('assistant', reply); } else { addMessage('assistant', 'Sorry, I could not generate a response. Please try again.'); } } catch (error) { // λ‘λ© λ©μμ§ μ κ±° document.getElementById('loading-message')?.remove(); if (error.message.includes('API key')) { addMessage('error', 'Invalid API key. Please check your API key and try again.'); showAPIKeySetup(); } else { addMessage('error', 'Failed to connect to Gemini. Please check your internet connection and try again.'); } } } // ========== EVENT LISTENERS ========== // Enter key support for main input document.addEventListener('DOMContentLoaded', function() { const mainInput = document.getElementById('barcodeData'); if (mainInput) { mainInput.addEventListener('keypress', function(e) { if (e.key === 'Enter') { generateBarcode(); } }); } // Clear errors on input mainInput?.addEventListener('input', clearErrors); // AI λ²νΌ μ΄λ²€νΈ document.getElementById('aiBtn').addEventListener('click', openAIModal); // λͺ¨λ¬ μΈλΆ ν΄λ¦μ λ«κΈ° document.getElementById('aiModal').addEventListener('click', function(e) { if (e.target === this) { closeAIModal(); } }); // μν° ν€ μ§μ λ° ESC ν€λ‘ λͺ¨λ¬ λ«κΈ° document.addEventListener('keydown', function(e) { if (e.key === 'Enter') { const geminiInput = document.getElementById('geminiInput'); if (document.activeElement === geminiInput) { sendToGemini(); } } // ESC ν€λ‘ λͺ¨λ¬ λ«κΈ° if (e.key === 'Escape') { closeAIModal(); } }); // μ΄κΈ° API ν€ μν μ λ°μ΄νΈ updateAPIKeyStatus(); updateCurrentYear(); updateToolCount(); }); // Track WIA Pin Code clicks for analytics document.querySelectorAll('a[href*="wia"]').forEach(link => { link.addEventListener('click', function() { trackEvent('wia_link_click', { link: link.textContent }); }); }); // ========== DYNAMIC TOOL COUNT ========== // Update tool count dynamically async function updateToolCount() { try { const response = await fetch('/api/tool-count.php'); const data = await response.json(); // Update dynamic tools description document.querySelectorAll('.dynamic-tools-count').forEach(el => { el.textContent = `${data.count}+ free online tools in 211 languages. No signup, no fees, just tools that work.`; }); // Update "All X+ Tools" links document.querySelectorAll('.dynamic-count').forEach(el => { const prefix = el.getAttribute('data-text') || ''; const suffix = el.getAttribute('data-suffix') || ''; const icon = el.textContent.split(' ')[0] || ''; el.textContent = `${icon} ${prefix} ${data.count}+ ${suffix}`; }); } catch (error) { // Fallback: use current actual count from server const fallbackCount = 333; document.querySelectorAll('.dynamic-tools-count').forEach(el => { el.textContent = `${fallbackCount}+ free online tools in 211 languages. No signup, no fees, just tools that work.`; }); document.querySelectorAll('.dynamic-count').forEach(el => { const prefix = el.getAttribute('data-text') || ''; const suffix = el.getAttribute('data-suffix') || ''; const icon = el.textContent.split(' ')[0] || ''; el.textContent = `${icon} ${prefix} ${fallbackCount}+ ${suffix}`; }); console.log('Tool count API not available, using current count:', fallbackCount); } } // Update current year dynamically function updateCurrentYear() { const currentYear = new Date().getFullYear(); document.querySelectorAll('.current-year').forEach(el => { el.textContent = currentYear; }); } // ========== ANALYTICS ========== // Google Analytics window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-XXXXXXXXX'); // Track page view trackEvent('page_view', { tool: TOOL_CONFIG.name, category: TOOL_CONFIG.category });