• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Including fonts in PDFs using iText

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic