Hi
I just can’t seem to figure this out.
I know that PDF doesn’t support UTF-8 so I’m trying to use Iconv to
convert the string from UTF-8 to MacRoman (or anything that will
work). This doesn’t seem to be working though. Is there a better/
correct way to do this? The string is stored as UTF-8 in MySQL and
displays properly on the web (<?xml version="1.0" encoding="utf-8"?>).
The main problem seems to be smart quotes do not come across I get
strange symbols, everything else seems to work.
My latest attempt.
def create_pdf
# creates a PDF version of an authors listing. Pass a listing
object as the methods parameter. AJ
#
pdfOfListing = PDF::Writer.new # defaults to a US Letter,
portrait, PDF version 1.3 document. AJ
pdfOfListing.compressed
pdfOfListing.select_font(‘Times-Roman’, {:encoding =>
‘MacRomanEncoding’})
pdfOfListing.text(Iconv.conv(“UTF-8”, “MacRoman”,
chapter.chapter_body), :font_size => 12, :justification => :left))
send_data(pdfOfListing.render, :filename =>
listing.title_of_work , :type => “application/pdf” )
end
Thanks
Andrew J.