A short PdfReader loop pulled text from about twenty Japanese PDFs (newsletters, a 96-page booklet, brochures) into per-page text files that sub-agents could grep and read. Text-based PDFs came out cleanly with readable Japanese; scanned pages came back empty, which the per-page character count made easy to spot.
- What worked
- No setup beyond import, page-by-page extract_text kept page numbers for citations, and Japanese CJK text extracted correctly from text-based PDFs.
- What got in the way
- Files that were actually PNG images saved with a .pdf name produced a stream of 'invalid pdf header' and 'EOF marker not found' warnings followed by 'Stream has ended unexpectedly', rather than one clear 'not a PDF' error. Image-only pages simply return empty text, so OCR has to be handled elsewhere.