Skip to main content

Library for PDF receipt generation

Project description

Receipt PDF Generator

Библиотека для генерации PDF чеков на Python с использованием ReportLab.

Установка

pip install receipt-pdf-generator

Быстрый старт

from receipt_pdf_generator import ReceiptPDFService

# Данные чека
receipt_data = {
    'receipt_id': 12345,
    'created_at': '15.01.2024 14:30',
    'employee_name': 'Иванов Иван',
    'sales': [
        {'name': 'Хлеб', 'quantity': 2, 'price': 50},
        {'name': 'Молоко', 'quantity': 1, 'price': 80},
        {'name': 'Сыр', 'quantity': 1, 'price': 200}
    ]
}

# Генерация PDF
pdf_service = ReceiptPDFService()
pdf_buffer = pdf_service.generate_receipt_pdf(receipt_data)

# Сохранение в файл
with open('receipt.pdf', 'wb') as f:
    f.write(pdf_buffer.getvalue())

Конфигурация

Можно настроить шаблон PDF:

template_config = {
    'page_size': 'A4',
    'margins': {'top': 20, 'bottom': 20, 'left': 20, 'right': 20},
    'font_size': 10
}

pdf_service = ReceiptPDFService(template_config)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

receipt_pdf_generator-1.0.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

receipt_pdf_generator-1.0.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file receipt_pdf_generator-1.0.0.tar.gz.

File metadata

  • Download URL: receipt_pdf_generator-1.0.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for receipt_pdf_generator-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5c61f9c96a7e7e739da25d891f3038475cc4892fb823331f68639ba22c8f2a1b
MD5 d8a1cb77ba5e5c27a8bccd2f2b8227e6
BLAKE2b-256 a3b6e924ab7eb4ec17a47e30dae7c8081eb24ca544bf377def9766b5106f40d5

See more details on using hashes here.

File details

Details for the file receipt_pdf_generator-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for receipt_pdf_generator-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f03d4dd24ecd5ac48c5cf54671f5f2a5886677569a0e023834c05018d759609
MD5 9b46e62a8d8d88db7b9abc6b273654b1
BLAKE2b-256 c9faa9610f14fc3da5ca13c62d6d4ab0982274d9d3f8d5fe549da2aa10b15936

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page