Export Special Characters to PDF using iTextSharp in ASP.Net

Last Reply 7 months ago By dharmendr

Posted 7 months ago

Hi all, by using below url i exported special characters like ∩, ∑, ∫, ∆ gridview data to pdf.

http://www.aspsnippets.com/Articles/Export-ASPNet-GridView-Arabic-Persian-or-Urdu-Language-Characters-to-PDF-using-iTextSharp.aspx

 

my requirement is

some special characters like ∈ not exported AND

instead of

 

 

BaseFont bf = BaseFont.CreateFont(Environment.GetEnvironmentVariable("windir") + @"\fonts\Arial.ttf", BaseFont.IDENTITY_H, true);

i want to use(my requirement)

 

BaseFont bf = BaseFont.CreateFont(Environment.GetEnvironmentVariable("windir") + @"\fonts\Times New Roman.ttf", BaseFont.IDENTITY_H, true);

but at runtime i get the error "Times-New-Roman" not found, but in my "windir" i have "Times New Roman.ttf" in font folder.

if any body understand my problem please help me.

Thanks in Advance

Posted 7 months ago

Hi nagaraju60,

In font folder under arial there is multiple ttf files available. From that arial.ttf is one. You can simply check the ttf file name by right clicking on the file and open the property you get the ttf file name in general tab.

Like that Times New Roman has multiple ttf files(timesbd.ttf, timesbi.ttf, timesi.ttf, times.ttf). You can use these four font. That why you are getting the error "Times New Roman" not found. Because there is no ttf file with the name Times New Roman.


Posted 7 months ago

Hi nagaraju60,

Use "ARIALUNI.ttf" font.

BaseFont bf = BaseFont.CreateFont(Environment.GetEnvironmentVariable("windir") + @"\fonts\ARIALUNI.ttf", BaseFont.IDENTITY_H, true);

 

I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html?aff_id=108