View Source Mudbrick.Predicates (mudbrick v0.3.0)

Useful for testing PDF documents.

While these predicates do check the PDF in a black-box way, it's not expected that they will work on all PDFs found in the wild.

Summary

Functions

Checks for presence of text in the pdf iodata. Searches compressed and uncompressed data.

Checks for presence of text in the pdf iodata. Searches compressed and uncompressed data.

Functions

@spec has_text?(pdf :: iodata(), text :: binary()) :: boolean()

Checks for presence of text in the pdf iodata. Searches compressed and uncompressed data.

This arity only works with text that can be found in literal form inside a stream, compressed or uncompressed,

Link to this function

has_text?(pdf, text, opts)

View Source
@spec has_text?(pdf :: iodata(), text :: binary(), opts :: list()) :: boolean()

Checks for presence of text in the pdf iodata. Searches compressed and uncompressed data.

This arity requires you to pass the raw font data in which the text is expected to be written. It must be present in raw hexadecimal form corresponding to the font's glyph IDs.

The OpenType library is used to find font features, such as ligatures, which are expected to have been used in the PDF.

Options

  • :in_font - raw font data in which the text is expected.

Example

iex> Mudbrick.Predicates.has_text?("some-pdf", "hello", in_font: Mudbrick.TestHelper.bodoni_regular())