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


683
684
685
686
687
688
689
690
691
692
693
694
# File 'lib/redmine/export/pdf.rb', line 683

def self.attach(attachments, filename, encoding)
  filename_utf8 = Redmine::CodesetUtil.to_utf8(filename, encoding)
  atta = nil
  if filename_utf8 =~ /^[^\/"]+\.(gif|jpg|jpe|jpeg|png)$/i
    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


676
677
678
679
680
681
# File 'lib/redmine/export/pdf.rb', line 676

def self.rdm_from_utf8(txt, encoding)
  txt ||= ''
  txt = Redmine::CodesetUtil.from_utf8(txt, encoding)
  txt.force_encoding('ASCII-8BIT')
  txt
end