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



149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/redmine/export/pdf.rb', line 149

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



144
145
146
147
# File 'lib/redmine/export/pdf.rb', line 144

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