Class: MuPDF::Document
- Inherits:
-
Object
- Object
- MuPDF::Document
- Defined in:
- lib/mupdf/document.rb
Overview
A wrapper for a PDF document allowing for MuPDF APIs.
Instance Method Summary collapse
- #draw(path:, page:, format: 'png', width: nil, height: nil, resolution: nil) ⇒ Object
- #info ⇒ MuPDF::Info
-
#initialize(pathname) ⇒ Document
constructor
A new instance of Document.
- #inspect ⇒ String
- #pages ⇒ Array<MuPDF::Page>
Constructor Details
#initialize(pathname) ⇒ Document
Returns a new instance of Document.
7 8 9 |
# File 'lib/mupdf/document.rb', line 7 def initialize(pathname) @pathname = pathname end |
Instance Method Details
#draw(path:, page:, format: 'png', width: nil, height: nil, resolution: nil) ⇒ Object
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 |
#info ⇒ MuPDF::Info
22 23 24 25 26 27 |
# File 'lib/mupdf/document.rb', line 22 def info @info ||= begin result = MuPDF.mutool('info', String(@pathname)) MuPDF::Info.parse(result) end end |
#inspect ⇒ String
12 13 14 |
# File 'lib/mupdf/document.rb', line 12 def inspect "#<#{self.class.name} pathname=#{@pathname}>" end |