Class: DocPDF::Adapters::Converters::Fallback
- Defined in:
- lib/docpdf/adapters/converters/fallback.rb
Overview
Fallback converter for unrecognized mime types. Tries three strategies in order:
- If the source filename has a known image extension, detect its mime type and delegate to the appropriate image converter.
- Attempt conversion via LibreOffice (soffice), which can handle many formats not explicitly registered.
- If soffice is unavailable or fails, return the raw data unchanged.
Constant Summary collapse
- IMAGE_EXTENSIONS =
%w[.heic .heif .webp .jpg .jpeg .png].freeze
Constants inherited from Base
Class Method Summary collapse
Class Method Details
.convert(data, source_filename) ⇒ Object
19 20 21 22 23 |
# File 'lib/docpdf/adapters/converters/fallback.rb', line 19 def convert(data, source_filename) convert_by_extension(data, source_filename) || convert_with_soffice(data, source_filename) || data end |