Skip to content

mesum357/QR-code-Generator

Repository files navigation

PDF QR Code Generator

A web application that allows users to upload PDF files and generate QR codes that link directly to the PDFs. When someone scans the QR code, they can view the PDF directly in their browser.

Features

  • 📄 Upload PDF files (up to 10MB)
  • 🔗 Generate QR codes that link to your PDFs
  • 📱 Mobile-friendly responsive design
  • 🎨 Modern, beautiful UI
  • 🔒 Secure file handling with unique IDs
  • 📊 File metadata tracking

How It Works

  1. Upload: User uploads a PDF file through the web interface
  2. Generate: System creates a unique QR code that contains a direct link to the PDF
  3. Share: User can share the QR code with others
  4. View: When someone scans the QR code, they're taken directly to view the PDF

Installation

  1. Make sure you have Node.js installed on your system
  2. Navigate to the project directory
  3. Install dependencies:
    npm install

Usage

  1. Start the server:

    npm start
  2. Open your browser and go to: http://localhost:3000

  3. Upload a PDF file by:

    • Clicking the upload area and selecting a file, or
    • Dragging and dropping a PDF file onto the upload area
  4. Click "Generate QR Code" to create your QR code

  5. Download the QR code or share the PDF link directly

API Endpoints

  • GET / - Main application interface
  • POST /upload - Upload PDF and generate QR code
  • GET /view/:fileId - View PDF by file ID
  • GET /info/:fileId - Get file metadata

File Structure

├── server.js          # Main server file
├── package.json       # Dependencies and scripts
├── public/
│   └── index.html     # Frontend interface
├── uploads/           # Directory for uploaded PDFs (created automatically)
└── README.md          # This file

Technical Details

  • Backend: Node.js with Express
  • File Upload: Multer for handling file uploads
  • QR Code Generation: qrcode library
  • File Storage: Local filesystem with unique UUIDs
  • Frontend: Vanilla HTML, CSS, and JavaScript

Security Features

  • File type validation (PDF only)
  • File size limits (10MB maximum)
  • Unique file IDs to prevent unauthorized access
  • Secure file serving with proper headers

Browser Compatibility

  • Modern browsers with ES6+ support
  • Mobile responsive design
  • Works on both desktop and mobile devices

Development

To run in development mode with auto-restart:

npm run dev

Notes

  • Uploaded files are stored in the uploads/ directory
  • Each file gets a unique UUID to prevent conflicts
  • The application runs on port 3000 by default
  • QR codes contain direct links to view the PDFs

Troubleshooting

  • Make sure port 3000 is not in use by another application
  • Check that Node.js and npm are properly installed
  • Ensure you have write permissions in the project directory
  • For large files, ensure sufficient disk space is available

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published