feat: Introduce a new desktop application for IPSExtractor, enabling extraction workflows through a React-based UI. This commit includes the application structure, API client integration, and initial components for user interaction. Enhance documentation to guide setup and usage, and update .gitignore to accommodate new files.
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
"""Utilidades para convertir documentos (PDF/TIFF) a imágenes base64.
|
||||
|
||||
En Windows se requiere Poppler. Este proyecto incluye una ruta por defecto:
|
||||
`dependencies/poppler-24.08.0/Library/bin`. Ajuste si su instalación difiere.
|
||||
"""
|
||||
"""Utilidades para convertir documentos (PDF/TIFF) a imágenes base64."""
|
||||
import base64
|
||||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
from io import BytesIO
|
||||
from typing import List, Tuple, Optional
|
||||
import time
|
||||
@@ -17,12 +14,24 @@ Image.MAX_IMAGE_PIXELS = None
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
_DEFAULT_POPPLER = 'dependencies/poppler-24.08.0/Library/bin'
|
||||
_SERVICE_ROOT = Path(__file__).resolve().parents[1]
|
||||
_BUNDLED_WINDOWS_POPPLER = _SERVICE_ROOT / "dependencies" / "poppler-24.08.0" / "Library" / "bin"
|
||||
_LEGACY_WINDOWS_POPPLER = Path("dependencies/poppler-24.08.0/Library/bin")
|
||||
_DOCKER_POPPLER = Path("/usr/bin")
|
||||
|
||||
|
||||
def _resolve_poppler(poppler_path: str | None) -> str:
|
||||
"""Devuelve la ruta a Poppler: usa la provista o el default del proyecto."""
|
||||
return poppler_path or _DEFAULT_POPPLER
|
||||
def _resolve_poppler(poppler_path: str | None) -> str | None:
|
||||
"""Devuelve una ruta de Poppler solo si existe; si no, usa el PATH del sistema."""
|
||||
candidates = [
|
||||
Path(poppler_path.strip()) if poppler_path and poppler_path.strip() else None,
|
||||
_BUNDLED_WINDOWS_POPPLER,
|
||||
_LEGACY_WINDOWS_POPPLER,
|
||||
_DOCKER_POPPLER,
|
||||
]
|
||||
for candidate in candidates:
|
||||
if candidate and candidate.exists():
|
||||
return str(candidate)
|
||||
return None
|
||||
|
||||
|
||||
def pdf_to_images_bs64(
|
||||
|
||||
Reference in New Issue
Block a user