Class: Redmine::Export::PDF::RDMPdfEncoding

Inherits:
Object
  • Object
show all
Defined in:
lib/redmine/export/pdf.rb

Class Method Summary collapse

Class Method Details

.attach(attachments, filename, encoding) ⇒ Object


139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/redmine/export/pdf.rb', line 139

def self.attach(attachments, filename, encoding)
  filename_utf8 = Redmine::CodesetUtil.to_utf8(filename, encoding)
  atta = nil
  if /^[^\/"]+\.(gif|jpg|jpe|jpeg|png)$/i.match?(filename_utf8)
    atta = Attachment.latest_attach(attachments, filename_utf8)
  end
  if atta && atta.readable? && atta.visible?
    return atta
  else
    return nil
  end
end

.rdm_from_utf8(txt, encoding) ⇒ Object


134
135
136
137
# File 'lib/redmine/export/pdf.rb', line 134

def self.rdm_from_utf8(txt, encoding)
  txt ||= ''
  Redmine::CodesetUtil.from_utf8(txt, encoding).b
end