import subprocess
import os

APP_PATH = '/home/vobshopi/public_html/ocr'
PDFTOPPm_BIN = os.path.join(APP_PATH, "pdftoppm")

print(f"Checking: {PDFTOPPm_BIN}")
print(f"Exists: {os.path.exists(PDFTOPPm_BIN)}")

if os.path.exists(PDFTOPPm_BIN):
    # تست نسخه
    cmd = [PDFTOPPm_BIN, "-v"]
    result = subprocess.run(cmd, capture_output=True, text=True)
    print(f"Version test: {result.stderr[:200] if result.stderr else result.stdout[:200]}")
else:
    print("pdftoppm not found!")