Module: HexaPDF::DictionaryFields::PDFByteStringConverter
- Defined in:
- lib/hexapdf/dictionary_fields.rb
Overview
Converter module for binary string fields to automatically convert a string into binary encoding.
See: PDF2.0 s7.9.2.4
Class Method Summary collapse
-
.additional_types ⇒ Object
:nodoc:.
-
.convert(str, _type, _document) ⇒ Object
Converts the string into binary encoding, assuming it is a non-binary string.
-
.usable_for?(type) ⇒ Boolean
This converter is usable if the
type
is PDFByteString.
Class Method Details
.additional_types ⇒ Object
:nodoc:
284 285 286 |
# File 'lib/hexapdf/dictionary_fields.rb', line 284 def self.additional_types String end |
.convert(str, _type, _document) ⇒ Object
Converts the string into binary encoding, assuming it is a non-binary string. Otherwise returns nil
.
290 291 292 293 |
# File 'lib/hexapdf/dictionary_fields.rb', line 290 def self.convert(str, _type, _document) return if !str.kind_of?(String) || str.encoding == Encoding::BINARY str.dup.force_encoding(Encoding::BINARY) end |
.usable_for?(type) ⇒ Boolean
This converter is usable if the type
is PDFByteString.
279 280 281 |
# File 'lib/hexapdf/dictionary_fields.rb', line 279 def self.usable_for?(type) type == PDFByteString end |