PDFs in SQL lesen, OCR-verarbeiten, prüfen, transformieren und schreiben
Maintainer: asubbarao
Installation und Laden
INSTALL pdf FROM community;LOAD pdf;Beispiel
LOAD pdf;
-- One row per page (file, list, or glob; parallel across pages/files)SELECT filename, page, textFROM read_pdf('reports/*.pdf')WHERE contains(lower(text), 'revenue');
-- Metadata censusSELECT file, title, author, page_count FROM pdf_info('reports/*.pdf');
-- RAG chunks in one statementCREATE TABLE chunks AS FROM pdf_chunks('reports/*.pdf');
-- Page raster + native writeSELECT pdf_to_png('report.pdf', 1, 150) AS page_image;COPY (SELECT * FROM findings)TO 'findings.pdf' (FORMAT pdf, TITLE 'Findings', FOOTER 'page {page}');Über pdf
Alles PDF, in SQL — Poppler, Tesseract (OCR), qpdf und libharu, statisch gelinkt. Pfade oder Globs; für Kernoperationen keine externen Werkzeuge zur Laufzeit. Vollständige Dokumentation und Rezepte: github.com/asubbarao/duckdb-pdf.
Lesen — read_pdf, read_pdf_lines, read_pdf_words /
read_pdf_layout (Wortboxen), read_pdf_elements, read_pdf_tables,
pdf_chunks. Auto-OCR auf rein bildbasierten Seiten; englisches Modell gebündelt.
Prüfen — pdf_info, Outline, Anhänge, Formularfelder, Annotationen,
Revisionen, Signaturen, eingebettete Bilder.
Konvertieren / Rendern — Text, Markdown, HTML, XML, SVG, PNG; Low-Level-
poppler_render_page + tesseract_ocr für Blob-Pipelines.
Transformieren und schreiben — Zusammenführen, Teilen, Drehen, Komprimieren, Ver-/Entschlüsseln,
Wasserzeichen, Bates, Signieren, Schwärzen; write_pdf / COPY … (FORMAT pdf);
to_pdf für Office-Dokumente (LibreOffice zur Laufzeit).
Umfang — deterministische Extraktion, keine ML-Document-AI. Lizenz — GPL-2.0-or-later (Poppler).
Hinzugefügte Funktionen
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| pdf_annotations | table | NULL | NULL | |
| pdf_attachments | table | NULL | NULL | |
| pdf_bates | scalar | NULL | NULL | |
| pdf_chunks | table | NULL | NULL | |
| pdf_compress | scalar | NULL | NULL | |
| pdf_decrypt | scalar | NULL | NULL | |
| pdf_destinations | table | NULL | NULL | |
| pdf_encrypt | scalar | NULL | NULL | |
| pdf_fonts | table | NULL | NULL | |
| pdf_form_fields | table | NULL | NULL | |
| pdf_images | table | NULL | NULL | |
| pdf_info | table | NULL | NULL | |
| pdf_json | scalar | NULL | NULL | |
| pdf_merge | scalar | NULL | NULL | |
| pdf_outline | table | NULL | NULL | |
| pdf_page_images | table | NULL | NULL | |
| pdf_pages | scalar | NULL | NULL | |
| pdf_pages_info | table | NULL | NULL | |
| pdf_permissions | table | NULL | NULL | |
| pdf_qpdf_info | table | NULL | NULL | |
| pdf_redact | table | NULL | NULL | |
| pdf_redact_lateral | table | NULL | NULL | |
| pdf_repair | scalar | NULL | NULL | |
| pdf_revisions | table | NULL | NULL | |
| pdf_rotate | scalar | NULL | NULL | |
| pdf_sign | table | NULL | NULL | |
| pdf_signatures | table | NULL | NULL | |
| pdf_split | table | NULL | NULL | |
| pdf_split_blank | table | NULL | NULL | |
| pdf_to_html | scalar | NULL | NULL | |
| pdf_to_markdown | scalar | NULL | NULL | |
| pdf_to_png | scalar | NULL | NULL | |
| pdf_to_svg | scalar | NULL | NULL | |
| pdf_to_text | scalar | NULL | NULL | |
| pdf_to_xml | scalar | NULL | NULL | |
| pdf_watermark | scalar | NULL | NULL | |
| pdf_write_page_images | table | NULL | NULL | |
| poppler_render_page | scalar | NULL | NULL | |
| poppler_version | scalar | NULL | NULL | |
| read_pdf | table | NULL | NULL | |
| read_pdf_elements | table | NULL | NULL | |
| read_pdf_layout | table | NULL | NULL | |
| read_pdf_lines | table | NULL | NULL | |
| read_pdf_meta | table | NULL | NULL | |
| read_pdf_tables | table | NULL | NULL | |
| read_pdf_words | table | NULL | NULL | |
| tesseract_ocr | scalar | NULL | NULL | |
| to_pdf | scalar | NULL | NULL | |
| write_pdf | scalar | NULL | NULL |
Überladene Funktionen
Diese Erweiterung fügt keine Funktionsüberladungen hinzu.
Hinzugefügte Typen
Diese Erweiterung fügt keine Typen hinzu.
Hinzugefügte Einstellungen
Diese Erweiterung fügt keine Einstellungen hinzu.