Jump to content
We've recently updated our Privacy Statement, available here ×

Incorrecly displying Hindi unicode font in pdf


sujith

Recommended Posts

I created pdf using ireport, but hindi font is not displaying correcly in pdfs. Here I am attaching two pdfs, one is created using ireport and other one created using adobe pdf convertor. second one displaying hindi correcly. One difference I noticed is that, if I am creating pdf using ireport it is adding one unwanted font (Helvetica) in pdf. [file name=My_Documents.zip size=11138]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/My_Documents.zip[/file]

 

Post edited by: sujith, at: 2007/12/22 05:03

 

Post edited by: sujith, at: 2007/12/22 05:04

Post edited by: sujith, at: 2007/12/22 05:07

Link to comment
Share on other sites

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

Forget about the jasperreports.properties file.

You don't need to go that deep.

 

What you need to understand is that when exporting to PDF, you need to specify the fonts to be used in the PDF file and even embed them into the PDF file, unless you rely on Helvetica, which is the default.

Helvetica is not good for you, because it does not support Hindi.

 

I'm pretty sure you use the fontName attribute to specify a font that supports Hindi. This is why it works for you in the JR Swing viewer. For PDF, you need to also use the pdfFontName, pdfEncoding and isPdfEmbedded attributes to indicate the TTF file to be used in PDF, the enconding and whether the font should be embedded into the resulting PDF file, in case those who view the PDF do not have the Hindi font installed on their machines or PDF viewers.

 

You should take a closer look at the supplied /demo/samples/unicode sample provided with the project and see how we display Arabic and Hebrew texts that also work in PDF.

 

I hope this helps.

Teodor

Link to comment
Share on other sites

  • 4 months later...

teodord wrote:

What you need to understand is that when exporting to PDF, you need to specify the fonts to be used in the PDF file and even embed them into the PDF file
...

You should take a closer look at the supplied /demo/samples/unicode sample provided with the project and see how we display Arabic and Hebrew texts that also work in PDF.

 

hello theodor, hello everybody!

 

i have a similar problem with greek letters in a report but i am using "Arial" for fontName and "ARIAL.TTF" for pdfFontName (exactly as in above mentioned unicode sample - which works fine on my system)

 

when trying to generate a PDF using

Code:

jasperReport = JasperCompileManager.compileReport(reportXML);
jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, dataSource);

...

output = JasperExportManager.exportReportToPdf(jasperPrint);

 

in my application sourcecode,

i get an exception:

Code:
[code]
net.sf.jasperreports.engine.JRException: Could not load the following font :
pdfFontName : ARIAL.TTF
pdfEncoding : Identity-H
isPdfEmbedded : true

...

 

my .jrxml file is located inside a .jar file and i am running my application on a jboss application server - could this be part of the problem?

 

 

can't figure it out on my own.. please help.. :(

 

 

thanks in advance,

reiner

 

 

 

please note: i know it does work when setting

Code:
[code]
pdfFontName="C:WindowsFontsARIAL.TTF"

in the jrxml file - but setting hardcoded absolute paths is no option for me

Post edited by: reinerm, at: 2008/04/29 15:56

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

 Hi

For UTF-8 set pdffontname with path to font.ttf and set ispdfEmbeded=true.

It works for me.

Thanx

AnyOne.

<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Mangal" size="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="C:\Windows\Fonts\Mangal.TTF" pdfEncoding="Identity-H" isPdfEmbedded="true"/>

</textElement>

 
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...