Class: ActiveStorageValidations::Analyzer::PdfAnalyzer
- Inherits:
-
ActiveStorageValidations::Analyzer
- Object
- ActiveStorageValidations::Analyzer
- ActiveStorageValidations::Analyzer::PdfAnalyzer
- Defined in:
- lib/active_storage_validations/analyzer/pdf_analyzer.rb
Overview
ActiveStorageValidations PDF Analyzer
Extracts the following from a pdf attachable:
-
Width (pts) => for the first page only
-
Height (pts) => for the first page only
-
Pages (integer) => number of pages in the pdf
Example:
ActiveStorageValidations::Analyzer::PdfAnalyzer.new(attachable).
# => { width: 150, height: 150, pages: 1 }
This analyzer requires the poppler system library, which is not provided by Rails.
Instance Attribute Summary
Attributes inherited from ActiveStorageValidations::Analyzer
Instance Method Summary collapse
Methods inherited from ActiveStorageValidations::Analyzer
Methods included from ActiveStorageValidations::ASVLoggable
Constructor Details
This class inherits a constructor from ActiveStorageValidations::Analyzer
Instance Method Details
#metadata ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/active_storage_validations/analyzer/pdf_analyzer.rb', line 21 def read_media do |media| { width: width, height: height, pages: pages }.compact end end |