aspose file tools*
The moose likes Other Open Source Projects and the fly likes Including fonts in PDFs using iText Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Including fonts in PDFs using iText" Watch "Including fonts in PDFs using iText" New topic
Author

Including fonts in PDFs using iText

Ashutosh Arya
Ranch Hand

Joined: Oct 07, 2008
Posts: 69
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
Marshal

Joined: Mar 22, 2005
Posts: 41865
    
  63
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.


Ping & DNS - my free Android networking tools app
Ashutosh Arya
Ranch Hand

Joined: Oct 07, 2008
Posts: 69
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
Marshal

Joined: Mar 22, 2005
Posts: 41865
    
  63
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

Joined: Oct 07, 2008
Posts: 69
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
Marshal

Joined: Mar 22, 2005
Posts: 41865
    
  63
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Including fonts in PDFs using iText