Popplex.NIF (Popplex v0.2.0)

View Source

Low-level NIF interface to Poppler C++ library.

This module provides direct access to the NIF functions. Most users should use the Popplex module instead.

Summary

Functions

Combines multiple PDF files into one.

Gets the page count of a PDF file.

Gets text content from a PDF file.

Renders PDF page(s) to image(s).

Functions

combine_pdfs_nif(input_files, output_file)

Combines multiple PDF files into one.

Parameters:

  • input_files: List of PDF file paths to combine
  • output_file: Path for the output PDF file

Returns {:ok, output_path} or {:error, reason}.

Note: This function is currently not implemented in the C++ layer.

get_page_count_nif(path)

Gets the page count of a PDF file.

Returns {:ok, count} or {:error, reason}.

get_text_nif(path, page)

Gets text content from a PDF file.

Parameters:

  • path: Path to the PDF file
  • page: Page number (0-indexed) or -1 for all pages

Returns {:ok, text} or {:error, reason}.

load_nif()

render_page_nif(path, page, format, dpi, quality)

Renders PDF page(s) to image(s).

Parameters:

  • path: Path to the PDF file
  • page: Page number (0-indexed) or -1 for all pages
  • format: 0 for PNG, 1 for JPEG
  • dpi: Resolution in dots per inch
  • quality: JPEG quality (1-100), ignored for PNG

Returns:

  • {:ok, binary} for single page
  • {:ok, [binary]} for all pages
  • {:error, reason} on failure