Initialize SQLite database for storing PDF content
(self)
| 18 | print("✅ Simple PDF processor initialized") |
| 19 | |
| 20 | def init_database(self): |
| 21 | """Initialize SQLite database for storing PDF content""" |
| 22 | conn = sqlite3.connect(self.db_path) |
| 23 | conn.execute(''' |
| 24 | CREATE TABLE IF NOT EXISTS pdf_documents ( |
| 25 | id TEXT PRIMARY KEY, |
| 26 | session_id TEXT NOT NULL, |
| 27 | filename TEXT NOT NULL, |
| 28 | content TEXT NOT NULL, |
| 29 | created_at TEXT NOT NULL |
| 30 | ) |
| 31 | ''') |
| 32 | |
| 33 | conn.commit() |
| 34 | conn.close() |
| 35 | |
| 36 | def extract_text_from_pdf(self, pdf_bytes: bytes) -> str: |
| 37 | """Extract text from PDF bytes""" |