cd /tmp/workspace/attachments/352bf08c-455a-4e25-88d1-2b20b5c416aa/ && python3 -c " import pdfplumber for f in ['SET 1.pdf','SET 2.pdf','SET 3.pdf','SET 4.pdf']: with pdfplumber.open(f) as pdf: print('===', f, 'pages:', len(pdf.pages), '===') text = pdf.pages[0].extract_text() or '' print(text[:800]) print('---') "
cd /tmp/workspace/attachments/352bf08c-455a-4e25-88d1-2b20b5c416aa/ && python3 -c " import fitz print('fitz ok') doc = fitz.open('SET 1.pdf') print(len(doc)) page = doc[0] print(page.get_text()[:500]) print('images:', page.get_images()) "
python3 -c "import pypdfium2; print('pdfium ok')" 2>&1; python3 -c "import pdfplumber; print(pdfplumber.__version__)" 2>&1
cd /tmp/workspace/attachments/352bf08c-455a-4e25-88d1-2b20b5c416aa/ && python3 -c " import pypdfium2 as pdfium for f in ['SET 1.pdf','SET 2.pdf','SET 3.pdf','SET 4.pdf']: pdf = pdfium.PdfDocument(f) total_text = 0 for i in range(len(pdf)): page = pdf[i] tp = page.get_textpage() t = tp.get_text_range() total_text += len(t.strip()) print(f, 'pages', len(pdf), 'total_text_chars', total_text) "
What would you like me to do with these 4 PDFs (SET 1-4)?
which tesseract; python3 -c "import pytesseract; print('pytesseract module available')" 2>&1; python3 -c "import easyocr; print('easyocr available')" 2>&1
mkdir -p /tmp/workspace/set_pages && cd /tmp/workspace/attachments/352bf08c-455a-4e25-88d1-2b20b5c416aa/ && python3 -c " import pypdfium2 as pdfium pdf = pdfium.PdfDocument('SET 1.pdf') page = pdf[0] bitmap = page.render(scale=2.0) pil_image = bitmap.to_pil() pil_image.save('/tmp/workspace/set_pages/set1_p1.png') print('saved', pil_image.size) " ls -la /tmp/workspace/set_pages/
~/attachments
Answer each diagnosis
~/attachments