• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Including fonts in PDFs using iText

 
Ashutosh Arya
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am working on a web application where I want to include thai language fonts.How can I do that and where do I have to place the .ttf file in the directory structure?

Ashutosh

[ UD: provided more accurate subject ]
[ October 07, 2008: Message edited by: Ulf Dittmer ]
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

Fonts need to be installed on the client machine; that's not something the web app can accomplish. The best you can do is to link to a freely downloadable font that people can install if they're so inclined. Using those fonts will require a restart of the web browser, though.
 
Ashutosh Arya
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But I have to use fonts as I am using those fonts in a thus generated pdf when the user clicks on a link.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So the fonts wouldn't be used on a web page, but only in the PDF? If so, how do create the PDF? The common Java PDF libraries (iText, FOP) can be configured to include fonts in the resulting PDF.
 
Ashutosh Arya
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is what I am dealing with but don't know that how to include the .ttf files which I am using .java file which is used to create a pdf using iText.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may want to read up on font handling in iText, then. It shows how to embed fonts in iText documents. Make sure that it's legally permissible to embed the fonts you want to use (by using freely available fonts, for instance).

Also, I would strongly urge you to go out and buy the book "iText in Action". It is indispensable if you're working professionally with iText, and will save you countless hours of time, thus repaying for itself very quickly.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic