feat: initial release — pdf-toolkit v1.0.0
Core operations: - Compress PDF (3 presets: screen, ebook, printer, prepress) - PDF/A detection and conversion to regular PDF - Compress while preserving PDF/A structure - Merge multiple PDFs - Split/extract pages by range - Rotate pages - Extract text and images Interface: - Streamlit web GUI (app.py) - FastAPI REST API with auto OpenAPI docs (api.py) Docs: - README.md, ARCHITECTURE.md, API.md - Unit tests (15/15 passing)
This commit is contained in:
38
config.py
Normal file
38
config.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""
|
||||
Configurações globais do pdf-toolkit.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
# ── Limites de arquivo ──────────────────────────────────────────────
|
||||
MAX_UPLOAD_SIZE_MB = 200
|
||||
MAX_UPLOAD_SIZE_BYTES = MAX_UPLOAD_SIZE_MB * 1024 * 1024
|
||||
MAX_FILES_PER_BATCH = 20
|
||||
MAX_PAGES_PREVIEW = 10
|
||||
|
||||
# ── Compressão ──────────────────────────────────────────────────────
|
||||
QUALITY_PRESETS = {
|
||||
"screen": {"quality": 30, "max_dim": 1200, "desc": "Agressivo — tamanho mínimo, qualidade baixa"},
|
||||
"ebook": {"quality": 60, "max_dim": 2000, "desc": "Equilibrado — bom custo-benefício"},
|
||||
"printer": {"quality": 85, "max_dim": 3500, "desc": "Leve — qualidade alta, redução modesta"},
|
||||
"prepress":{"quality": 95, "max_dim": 5000, "desc": "Mínima — quase sem perda"},
|
||||
}
|
||||
|
||||
DEFAULT_QUALITY = "ebook"
|
||||
|
||||
# ── Paths ───────────────────────────────────────────────────────────
|
||||
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
|
||||
TEMP_DIR = os.path.join(PROJECT_ROOT, "..", "tmp")
|
||||
|
||||
# Cria temp dir se não existir
|
||||
os.makedirs(TEMP_DIR, exist_ok=True)
|
||||
|
||||
# ── API ─────────────────────────────────────────────────────────────
|
||||
API_HOST = "0.0.0.0"
|
||||
API_PORT = 8555
|
||||
API_TITLE = "pdf-toolkit API"
|
||||
API_VERSION = "1.0.0"
|
||||
API_DESCRIPTION = "API de transformação e otimização de arquivos PDF."
|
||||
|
||||
# ── Streamlit ───────────────────────────────────────────────────────
|
||||
STREAMLIT_PORT = 8550
|
||||
Reference in New Issue
Block a user