FPDF set FONT_PATH

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 …

On Jul 2, 2006, at 7:54 PM, raziq zaki wrote:

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 S. - principal, Shrier and Deihl - mailto:[email protected]
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 M.
Informatika Mihelac, Bojan M. s.p. | www.informatikamihelac.com
-> tools, scripts, tricks from our code lab: http://source.mihelac.org

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 M.
Informatika Mihelac, Bojan M. 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

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs