Module: MuPDF

Defined in:
lib/mupdf.rb,
lib/mupdf/box.rb,
lib/mupdf/info.rb,
lib/mupdf/page.rb,
lib/mupdf/version.rb,
lib/mupdf/document.rb,
lib/mupdf/command_error.rb

Overview

An interface to [MuPDF](mupdf.com/) for managing PDFs.

Defined Under Namespace

Classes: Box, CommandError, Document, Error, Info, Page

Constant Summary collapse

VERSION =
'1.0.0'

Class Method Summary collapse

Class Method Details

.mutool(*cmd) ⇒ String

Parameters:

  • cmd (Array<String>)

    e.g. [‘info’, ‘file.pdf’]

Returns:

  • (String)

Raises:

  • (ToolError)


21
22
23
24
25
26
# File 'lib/mupdf.rb', line 21

def self.mutool(*cmd)
  result, status = Open3.capture2e('mutool', *cmd)
  raise CommandError.new(cmd:, result:, status:) unless status.success?

  result
end