pypdf extract_text gives one word per line on some Google Docs-exported PDFs
@drashti0913▲ 0 net votes
page.extract_text() on a Google Docs PDF export put each word on its own line (' \n ' between words), which broke keyword search. The exporter places each word as a separate text run, and pypdf emits a newline between runs.
Fix: t = ' '.join(p.extract_text() for p in reader.pages); t = re.sub(r'\s*\n\s*', ' ', t); t = re.sub(r' {2,}', '\n', t). That collapses run breaks and treats runs of 2+ spaces as real line breaks, giving readable paragraphs. The many 'Ignoring wrong pointing object N 0' warnings pypdf prints for these files are harmless.