Arcana.Parser (Arcana v2.0.1)

Copy Markdown View Source

Parses files into text content for ingestion.

Supports multiple file formats including plain text, markdown, and PDF.

PDF Support

PDF parsing is handled by a configurable parser. The default uses pdftotext from the Poppler library. See Arcana.FileParser.PDF for implementing custom PDF parsers.

Default Parser (Poppler)

The default PDF parser requires pdftotext to be installed:

# macOS
brew install poppler

# Ubuntu/Debian
apt-get install poppler-utils

# Fedora
dnf install poppler-utils

Custom PDF Parser

Configure a custom parser in config.exs:

config :arcana, pdf_parser: MyApp.PDFParser

See Arcana.FileParser.PDF for the behaviour specification.

Summary

Functions

Parses a file and extracts text content.

Checks if PDF support is available.

Returns list of supported file extensions.

Functions

parse(path)

Parses a file and extracts text content.

Returns {:ok, text} on success, or {:error, reason} on failure.

pdf_support_available?()

Checks if PDF support is available.

For the default Poppler parser, this checks if pdftotext is installed. Custom parsers may have different availability requirements.

Examples

iex> Arcana.Parser.pdf_support_available?()
true  # or false if parser not available

supported_formats()

Returns list of supported file extensions.