Files
lishanpi/tools/read_pdf.py
T
hm fc10ef2e10 Initial commit: LSPi (LiangShanPi) project
GD32F470ZGT6 based project with full peripheral support:
- SDRAM (W9825G6KH) via EXMC
- LCD NT35510 (480x800) via EXMC NOR/PSRAM
- Flash (W25Q64) via SPI
- UART (USART0) debug console
- LED indicators
- CMSIS-DAP debug interface
- CMake + ARM GCC toolchain build system
2026-04-26 16:24:42 +08:00

20 lines
570 B
Python

# -*- coding: utf-8 -*-
import sys
import PyPDF2
def extract_pdf_text(pdf_path):
try:
with open(pdf_path, 'rb') as file:
pdf_reader = PyPDF2.PdfReader(file)
text = ""
for page_num in range(len(pdf_reader.pages)):
page = pdf_reader.pages[page_num]
text += page.extract_text()
return text
except Exception as e:
return f"Error reading PDF: {e}"
if __name__ == "__main__":
pdf_path = "ÁºÉ½Pi¿ª·¢°å.pdf"
text = extract_pdf_text(pdf_path)
print(text[:2000])