fc10ef2e10
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
20 lines
570 B
Python
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]) |