Last active
August 29, 2015 14:15
-
-
Save altherlex/ee52873280094c30df91 to your computer and use it in GitHub Desktop.
PDF::Writter for Ruby 1.9 and DB in ISO-8859-1: convert database info from ISO-8859-1 to UTF-8; for rigth show in PDF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#config\initializers\pdfwriter_extensions.rb | |
CONVERTER = Iconv.new( 'ISO-8859-1//IGNORE//TRANSLIT', 'utf-8') | |
module PDF | |
class Writer | |
# for fixed text (labels in general): It isn't necessary! (Obsolete) | |
alias_method :old_text, :text | |
def text(textto, options = {}) | |
#old_text(CONVERTER.iconv(textto), options) | |
old_text(textto, options) | |
end | |
# for info from of data base | |
alias_method :old_add_text_wrap, :add_text_wrap | |
def add_text_wrap(x, y, width, text, size = nil, justification = :left, angle = 0, test = false) | |
old_add_text_wrap(x, y, width, CONVERTER.iconv(text), size, justification, angle, test) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment