Poppler-based PDF processing module.
Handles PDF operations using poppler-utils command-line tools:
pdftoppm- Convert PDF pages to images (JPEG)pdfinfo- Extract PDF metadata (page count, author, title)
Dependencies
Requires poppler-utils to be installed:
- Debian/Ubuntu:
apt-get install poppler-utils - macOS:
brew install poppler
Summary
Functions
Extract metadata from a PDF file using pdfinfo.
Convert the first page of a PDF to a JPEG image.
Functions
Extract metadata from a PDF file using pdfinfo.
Parameters
pdf_path- Path to the PDF file
Returns
{:ok, metadata}- Map with extracted metadata{:ok, %{}}- Empty map on failure (graceful degradation)
Convert the first page of a PDF to a JPEG image.
Uses pdftoppm to render the first page at the specified DPI.
Parameters
pdf_path- Path to the input PDF fileoutput_prefix- Prefix for the output JPEG file (e.g., "/tmp/my_pdf")opts- Options:dpi- Resolution in DPI (default: 150)
Returns
{:ok, jpeg_path}- Path to the generated JPEG file{:error, reason}- If conversion fails