Perplexed.PdfConverter behaviour (Perplexed v0.1.0)

Copy Markdown View Source

The behaviour that turns PDF bytes into Markdown for a scrape.

Configure an implementation with config :perplexed, pdf_converter: Module. Without one, PDF pages scrape as {:error, :unsupported}.

Failure atoms that mean no other scraper can help (:needs_ocr, :encrypted, :unsupported) end the scrape ladder.

Summary

Callbacks

Converts PDF binary (fetched from a URL ending in filename) to Markdown.

Functions

Converts binary with opts[:pdf_converter], else the configured converter.

Callbacks

convert(binary, filename)

@callback convert(binary(), filename :: String.t()) ::
  {:ok, String.t()} | {:error, atom()}

Converts PDF binary (fetched from a URL ending in filename) to Markdown.

Functions

convert(binary, filename, opts \\ [])

@spec convert(binary(), String.t(), keyword()) :: {:ok, String.t()} | {:error, atom()}

Converts binary with opts[:pdf_converter], else the configured converter.