💡 Inspiration
Before university exams, campus print shops face massive crowds and long lines. Most students bring lecture slide decks containing 40 to 60 slides filled with dark background themes, decorative cover pages, and low text density. Students spend $4.00 or more per lecture printing paper they throw away after highlighting a few formulas.
At the same time, transferring files via USB flash drives on public campus library computers represents the number one security vector for malware spreading across university lab networks.
We built SmartPrint AI to answer a fundamental student problem: Pay for the knowledge you need to study, not for paper waste.
⚙️ What It Does
SmartPrint AI takes an uploaded lecture PDF and gives the student two transparent options:
- Standard Print: The original uploaded file, priced by raw page count.
- AI High-Yield Revision Sheet: A condensed study cheat sheet synthesized by Google Gemini 1.5 Flash, retaining only key definitions, formulas, and high-probability exam questions.
📊 Real-World Cost & Resource Comparison
| Metric | Standard Raw Print | SmartPrint AI Summary | Student Impact |
|---|---|---|---|
| Page Count | 40 pages | 2 pages | 95% paper reduction |
| Student Cost | $4.00 | $0.20 | $3.80 direct savings |
| Toner Waste | Heavy (dark backgrounds) | Minimal (clean monochrome) | 90% ink saved |
| Security Risk | Public USB flash drives | Zero-trust cloud OTP | Zero malware propagation |
💰 Transparent Server-Side Pricing
Pricing is computed authoritatively on the server, completely ignoring any client-side parameters:
- Rate: $0.10 per printed page
- Standard Raw Print: 40 pages × $0.10 = $4.00
- AI Summary Print: 2 pages × $0.10 = $0.20
- Total Student Savings: $3.80 (95% discount)
🔄 The Zero-Trust Kiosk Loop
- Upload & Analysis: The student uploads a lecture PDF.
pypdfextracts raw text and validates total page counts. - AI Document Synthesis: Google Gemini 1.5 Flash parses the material, removes presentation fluff, and formats an exam study sheet via ReportLab.
- PayPal Checkout: The student pays the micro-transaction ($0.20) via official PayPal Smart Buttons rendered by the PayPal JavaScript SDK.
- Server Capture Verification: The FastAPI backend independently captures the payment through the PayPal Orders v2 REST API, strictly verifying that status is COMPLETED, currency is USD, and the captured amount matches the server price down to the cent.
- Expiring 6-Digit PIN: Upon verified capture, the server generates a single-use 6-digit release PIN that expires in 30 minutes.
- Kiosk Print Release: The student enters their 6-digit PIN on any unattended campus kiosk touchscreen to collect their physical pages. No passwords, no queues, and zero flash drive risk.
🏗️ How We Built It
- Backend Architecture: Built with Python and FastAPI, backed by SQLAlchemy and SQLite for ACID-compliant transaction records.
- PayPal Integration:
- OAuth2 token authentication via
/v1/oauth2/token. - Dynamic order creation via
/v2/checkout/orderswith server-calculated amounts. - Server-side capture verification via
/v2/checkout/orders/{id}/capture. - Official PayPal JavaScript SDK Smart Buttons embedded with custom modal handlers.
- OAuth2 token authentication via
- AI & Document Processing:
- Google Gemini 1.5 Flash API: Semantic analysis of academic content and exam cheat sheet generation.
- Heuristic Rule-Based Fallback: Multi-tier extraction pipeline ensuring checkout never hangs if network latency or API limits occur.
- ReportLab & pypdf: Server-side PDF compilation, page rendering, and geometry inspection.
- Frontend Portals:
- Modern, responsive web portal built with Tailwind CSS featuring instant price comparisons, live PayPal checkout, and an interactive kiosk hardware touchscreen simulator.
- Supplementary Flutter Web terminal build mounted for unattended hardware kiosks.
🧗 Challenges We Faced
- Zero-Trust Payment Verification: Clients cannot be trusted to report payment status. If an application blindly relies on frontend callbacks, attackers can spoof payments and trigger free printing. We architected a zero-trust model where the backend authoritatively contacts PayPal Sandbox to capture funds and confirms status, amount, and currency before queuing the print job.
- Deterministic Pricing vs. Stochastic AI Output: Generative AI output length varies between runs. If price were calculated after text generation, the amount due could fluctuate mid-checkout. We solved this by enforcing a deterministic page ceiling (2 pages for standard lectures) so the student's quoted fee remains fixed.
- Idempotency and Network Retries: Students frequently refresh tabs or click payment buttons multiple times during spotty campus Wi-Fi. Every print job is strictly keyed to the unique PayPal Order ID. Repeated capture calls return the existing job and PIN rather than creating duplicate orders or double-charging.
🏆 Accomplishments That We're Proud Of
- 95% Cost Relief for College Students: Demonstrated that AI document compression can turn an expensive $4.00 print job into a 20-cent micro-payment.
- True End-to-End Loop: Flawlessly connected PDF upload, Gemini AI summarization, PayPal sandbox order capture, and kiosk PIN release in a sub-minute workflow.
- Campus Cybersecurity Protection: Completely removed USB flash drives from the printing workflow, protecting campus computer labs from recurring malware infections.
📚 What We Learned
Payment engineering is defined by edge cases that rarely appear in happy-path demos: abandoned modal popups, buyer cancellations, unapproved orders, and network drops during capture handoffs. Designing the backend around strict state machine transitions and idempotent keys proved critical to building a production-ready system.
🚀 What's Next for SmartPrint AI
- Campus Kiosk Fleet Rollout: Deploying Raspberry Pi print controllers running CUPS across campus libraries and academic departments.
- Multi-Language AI Translation: Allowing students to translate lecture slides into regional languages directly on their revision cheat sheets.
- Department Budget Accounts: Using the PayPal Subscriptions API to give faculty and student research labs monthly automated print allowances.