hi all, im using ruby FPDF to generate my pdf. the problem im facing now is i need to use some new font that is not included in basic fpdf font. then i have generated the font using the makefont.rb. but then i dont know how to define the font_path in ruby. the font work great in PHP-FPDF. Is anybody there had solved the problem im facing now. ** sorry for my english ... -- Posted via http://www.ruby-forum.com/.
On Jul 2, 2006, at 7:54 PM, raziq zaki wrote:> hi all, > im using ruby FPDF to generate my pdf. the problem im facing now is i > need to use some new font that is not included in basic fpdf font. > then > i have generated the font using the makefont.rb. but then i dont know > how to define the font_path in ruby. the font work great in PHP- > FPDF. Is > anybody there had solved the problem im facing now. > > ** sorry for my english ... > > --In order to set the font path, you need to define the constant FPDF_FONTPATH in your subclass of FPDF. You should do something like this: class My_PDF_Document < FPDF FPDF_FONTPATH = "/path/to/my/new/font" # your code here... end When the pdf document is created, the code looks for the font in the directory "/path/to/my/new/font". Kim -- Kim Shrier - principal, Shrier and Deihl - mailto:kim@tinker.com Remote Unix Network Admin, Security, Internet Software Development Tinker Internet Services - Superior FreeBSD-based Web Hosting http://www.tinker.com/
raziq zaki wrote:> hi all, > im using ruby FPDF to generate my pdf. the problem im facing now is i > need to use some new font that is not included in basic fpdf font. then > i have generated the font using the makefont.rb. but then i dont know > how to define the font_path in ruby. the font work great in PHP-FPDF. Is > anybody there had solved the problem im facing now. > > ** sorry for my english ... >Raziq, there are some embeding font problems I recognized in FPDF library that I found workaround so tell if you still have problems. Bojan -- Bojan Mihelac Informatika Mihelac, Bojan Mihelac s.p. | www.informatikamihelac.com -> tools, scripts, tricks from our code lab: http://source.mihelac.org
thanks all, i manage to create my pdf with the font. But when i open the pdf file created, there an error saying cannot extract the embedded font. the font display is not what im aspected. im not defined the FPDF_FONTPATH in my script, but hardcoded it in fpdf.rb. did this method give me the error. -- Posted via http://www.ruby-forum.com/.
raziq wrote:> thanks all, > i manage to create my pdf with the font. But when i open the pdf file > created, there an error saying cannot extract the embedded font. the > font display is not what im aspected. > > im not defined the FPDF_FONTPATH in my script, but hardcoded it in > fpdf.rb. > > did this method give me the error. >Raziq, if you use FPDF on windows then change (line 1014 of rpdf.rb): putstream(IO.read(file)) to: File.open(file, "rb") { |io| putstream(io.read) } so the file would be read read in binary mode. hope it helps, Bojan -- Bojan Mihelac Informatika Mihelac, Bojan Mihelac s.p. | www.informatikamihelac.com -> tools, scripts, tricks from our code lab: http://source.mihelac.org
I''m still a noob with Rails so please forgive me but... How do I use makefont to generate the font files. I currently have a japanese font ttf file that I want to use. Thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---