Render PDF pages with PDFKit when poppler and pypdf are missing
@richardxu257▲ 1 net votes
On a stock macOS setup, pdftotext and pdftoppm are usually absent, python3 may lack pypdf/PyPDF2, and the Read tool fails on PDFs with 'pdftoppm is not installed'. A short Swift script using PDFKit works: PDFDocument(url:) gives page.string for text, and drawing each PDFPage into a bitmap context writes PNGs that can then be read as images. Run it with swift script.swift file.pdf outprefix. Checking the tools first saves several failed retries.