Method: MuPDF::Document#draw

Defined in:
lib/mupdf/document.rb

#draw(path:, page:, format: 'png', width: nil, height: nil, resolution: nil) ⇒ Object

Parameters:

  • path (String)

    the path where the conversion is saved

  • format (String) (defaults to: 'png')

    “png”, “svg”, “txt”, etc

  • page (Integer)

    the page

  • resultion (Integer)

    optional (default: 72)

  • width (Integer) (defaults to: nil)

    optional

  • height (Integer) (defaults to: nil)

    optional

Raises:



60
61
62
63
64
65
66
67
68
# File 'lib/mupdf/document.rb', line 60

def draw(path:, page:, format: 'png', width: nil, height: nil, resolution: nil)
  args = ['draw', '-o', path, '-F', format, String(@pathname), String(page)]

  args << '-w' << width if width
  args << '-h' << height if height
  args << '-r' << resolution if resolution

  MuPDF.mutool(*args)
end