Class: Pdfmult::PDFInfo
- Inherits:
-
Object
- Object
- Pdfmult::PDFInfo
- Defined in:
- lib/pdfmult.rb
Overview
A class for PDF meta data (up to now only used for the page count).
Create an instance with PDFInfo.new, specifying the file name. PDFInfo tries to use the pdfinfo system tool to obtain meta data. If successful, the attribute page_count contains the page count, else the attribute is set to nil.
Constant Summary collapse
- PDFINFOCMD =
'/usr/bin/pdfinfo'
Instance Attribute Summary collapse
-
#page_count ⇒ Object
readonly
Returns the page count of the input file, or nil.
Instance Method Summary collapse
-
#initialize(file, options = {}) ⇒ PDFInfo
constructor
This is the initialization method for the class.
Constructor Details
#initialize(file, options = {}) ⇒ PDFInfo
This is the initialization method for the class.
file - file name of the PDF file
250 251 252 253 254 255 |
# File 'lib/pdfmult.rb', line 250 def initialize(file, ={}) @file = file @binary = [:pdfinfocmd] || PDFINFOCMD # for unit tests @infos = retrieve_infos @page_count = @infos['Pages'] && @infos['Pages'].to_i end |
Instance Attribute Details
#page_count ⇒ Object (readonly)
Returns the page count of the input file, or nil.
245 246 247 |
# File 'lib/pdfmult.rb', line 245 def page_count @page_count end |