A modern web application that generates PDF417 barcodes from driver's license form data. Built with FastAPI, vanilla JavaScript, and deployed on Vercel.
- π Interactive Form: Clean, responsive driver's license form interface
- π PDF417 Generation: Convert form data to ANSI format and generate PDF417 barcodes
- π± Responsive Design: Works seamlessly on desktop and mobile devices
- π₯ Download Support: Download generated barcodes as PNG images
- π Copy to Clipboard: One-click copy functionality for generated barcodes
- β Form Validation: Client-side validation with helpful error messages
- π§ͺ Demo Data: Quick-fill with sample data for testing (localhost only)
- π¨ Modern UI: Beautiful gradient design with smooth animations
- Frontend: HTML5, CSS3, Vanilla JavaScript
- Backend: Python FastAPI (serverless functions)
- PDF417 Generation:
pdf417gen
library - Image Processing: Pillow (PIL)
- Deployment: Vercel
- Version Control: Git + GitHub
- Python 3.9+
- Node.js 18+ (for Vercel CLI)
- Git
-
Clone the repository:
git clone <your-repo-url> cd dl-pdf417-app
-
Install Python dependencies:
pip install -r requirements.txt
-
Install Vercel CLI:
npm install -g vercel
-
Run local development server:
vercel dev
-
Open your browser: Navigate to
http://localhost:3000
- Fill out the driver's license form with valid data
- Click "Generate PDF417 Barcode"
- View the generated barcode and download if needed
- Use the "Fill Demo Data" button (localhost only) for quick testing
dl-pdf417-app/
βββ api/
β βββ generate.py # FastAPI serverless function
β βββ generate_pdf417.py # Original PDF417 generation script
βββ public/
β βββ index.html # Main application page
β βββ styles.css # Responsive CSS styles
β βββ app.js # Frontend JavaScript logic
βββ vercel.json # Vercel deployment configuration
βββ requirements.txt # Python dependencies
βββ .gitignore # Git ignore rules
βββ README.md # This file
Generate a PDF417 barcode from driver's license data.
Request Body:
{
"dl_number": "091076664",
"first_name": "STANLEY",
"last_name": "Crooms",
"middle_name": "David",
"address": "2110 Old Maple Ln",
"city": "Durham",
"zip_code": "37745",
"sex": "M",
"height_inches": "69",
"birth_date": "04151988",
"issue_date": "07282025",
"expiry_date": "07282033",
"eye_color": "HAZ",
"dl_class": "D",
"donor": "No",
"restrictions": "NONE",
"endorsement": "NONE"
}
Response:
{
"success": true,
"barcode": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"ansi_data": "@\n\nANSI 636053060002DL00410257ZT02980037DL\nDAQ091076664\n...",
"image_size": [400, 200]
}
This application is configured for automatic deployment on Vercel:
-
Connect GitHub Repository:
- Visit vercel.com
- Import your GitHub repository
- Vercel will automatically detect the project settings
-
Configure Environment:
- No environment variables required for basic functionality
- Python runtime is automatically detected
-
Deploy:
- Push to
main
branch for automatic deployment - Or use
vercel --prod
for manual deployment
- Push to
# Login to Vercel
vercel login
# Deploy to production
vercel --prod
# Follow the prompts to configure your project
{
"version": 2,
"functions": {
"api/generate.py": {
"runtime": "python3.9"
}
},
"routes": [
{ "src": "/api/(.*)", "dest": "/api/generate.py" },
{ "handle": "filesystem" },
{ "src": "/(.*)", "dest": "/public/$1" }
]
}
fastapi==0.104.1
pdf417gen==0.8.1
pillow==10.0.1
uvicorn==0.24.0
The application includes comprehensive form validation:
- Required Fields: All essential driver's license fields must be filled
- Date Format: Dates must be in MMDDYYYY format (e.g., 04151988)
- Zip Code: Must be exactly 5 digits
- Height: Must be between 36-96 inches
- Real-time Feedback: Immediate validation with helpful error messages
The application is fully responsive and works on:
- Desktop: Full-featured experience with grid layout
- Tablet: Adaptive layout with touch-friendly controls
- Mobile: Single-column layout optimized for small screens
- Client-side validation only (server-side validation recommended for production)
- No sensitive data storage (form data is processed in memory only)
- CORS headers configured for cross-origin requests
- Input sanitization through Pydantic models
-
API not working locally:
- Ensure Python dependencies are installed:
pip install -r requirements.txt
- Check that
vercel dev
is running on port 3000
- Ensure Python dependencies are installed:
-
Barcode not generating:
- Verify all required fields are filled
- Check browser console for JavaScript errors
- Ensure date formats are correct (MMDDYYYY)
-
Styling issues:
- Clear browser cache and refresh
- Check that
styles.css
is loading properly
- Use the "Fill Demo Data" button for quick testing on localhost
- Open browser developer tools to view API requests/responses
- Check the Network tab for any failed requests
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- PDF417Gen: Python library for PDF417 barcode generation
- FastAPI: Modern Python web framework
- Vercel: Deployment platform
- ANSI D20: Driver's license data standard
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Include browser console output and steps to reproduce
Built with π» by [Your Name] using FastAPI, PDF417Gen, and deployed on Vercel