A comprehensive Python project for generating and reading QR codes, with support for embedding QR codes in PDF documents.
- QR Code Generation: Create QR codes with custom data
- QR Code Reading: Programmatically read QR codes from images
- PDF Integration: Embed QR codes in PDF documents
- Multiple Reading Methods: Support for various QR code reading libraries
- Easy Setup: Virtual environment with all dependencies
- Python 3.8+
- pip
- Clone the repository:
git clone <repository-url>
cd qr-code- Create and activate virtual environment:
python3 -m venv qr_env
source qr_env/bin/activate # On Windows: qr_env\Scripts\activate- Install dependencies:
pip install qrcode pillow zxing-cpp reportlabRun the project with the included script:
./run_qr.shActivate the virtual environment and run scripts:
source qr_env/bin/activate
python generate_qr.py # Generate QR code
python read_qr_zxing.py # Read QR codes
python pdf_with_qr.py # Create PDF with QR code
python qr_info.py # Show QR code informationqr-code/
├── generate_qr.py # Generate QR codes
├── read_qr_zxing.py # Read QR codes programmatically
├── pdf_with_qr.py # Create PDFs with embedded QR codes
├── qr_info.py # QR code information and reading methods
├── run_qr.sh # Easy runner script
├── qr_env/ # Virtual environment
├── .gitignore # Git ignore file
└── README.md # This file
Generates a QR code with delivery guide information and saves it as PNG.
Example Output:
GD:123456 | RUT:96543210-5 | Fecha:2025-10-25 | Total:$1.250.000 | Ítems:4
Reads QR codes from image files using the zxing-cpp library.
Features:
- Read QR codes from PNG files
- Decode QR codes from memory
- Display decoded data and format information
Creates PDF documents with embedded QR codes.
Features:
- Generate QR codes in memory
- Embed QR codes in PDF documents
- Customizable positioning and sizing
Provides comprehensive information about QR code reading methods.
Information includes:
- Phone camera methods
- Online QR readers
- Desktop applications
- Programmatic reading options
- iPhone: Open Camera app, point at QR code
- Android: Open Camera app or Google Lens
- Most smartphones detect QR codes automatically
- macOS: Press spacebar on QR code image (Quick Look)
- Windows: Use Camera app or QR scanner apps
- Linux: Install qrencode or similar tools
- QR Code Reader (iOS/Android)
- QR Scanner (iOS/Android)
- Google Lens (Android)
- qrcode: QR code generation
- pillow: Image processing
- zxing-cpp: QR code reading
- reportlab: PDF generation
import qrcode
data = "GD:123456 | RUT:96543210-5 | Fecha:2025-10-25 | Total:$1.250.000 | Ítems:4"
img = qrcode.make(data)
img.save("delivery_qr.png")import zxingcpp
from PIL import Image
image = Image.open("delivery_qr.png")
results = zxingcpp.read_barcodes(image)
for result in results:
print(f"Data: {result.text}")from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from reportlab.lib.utils import ImageReader
import qrcode
from io import BytesIO
# Generate QR code
data = "GD:123456 | Fecha:2025-10-25 | Total:$1.250.000"
qr = qrcode.make(data)
buffer = BytesIO()
qr.save(buffer, format="PNG")
buffer.seek(0)
# Create PDF
c = canvas.Canvas("delivery_guide.pdf", pagesize=A4)
qr_image = ImageReader(buffer)
c.drawImage(qr_image, 450, 720, width=100, height=100)
c.save()- 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.
- qrcode - QR code generation library
- zxing-cpp - QR code reading library
- ReportLab - PDF generation library
- Pillow - Image processing library
If you have any questions or need help, please open an issue in the repository.
Happy QR Coding! 🎉