user2866108
user2866108

Reputation: 29

Cannot display Tamil correctly in generated PDF

Currently we are using Aspose.NET library to generate excel and export to PDF. The pdf consists of multiple language such as English, Chinese and Tamil. For English and Chinese it work fine but for Tamil is having spelling issue.

For example the first and second letter for "போல்" will flipped.

We have tried "Latha" font and "Arial Unicode MS" font, the text is showing but the letter is flipped. We have tried "InaiMathi" font as well but the text is not showing.

I have also try to use different pdf generator such as ITextSharp as suggested in this page: How to Create PDF file with Tamil Font by using itextsharp in C#? But the text still flipped. From the page, they said that ITextSharp does not fully support indic language.

Are there any pdf generator that support indic langauge?

Upvotes: 2

Views: 3441

Answers (2)

Sheik Rasheed K
Sheik Rasheed K

Reputation: 1

Please refer related answer here. Try Quest PDF which supports Tamil text as well.

Create a console application and install the Quest PDF library and use the sample (in .NET 6) to see POC.

dotnet add package QuestPDF

using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;

Document.Create(container =>
{
    container.Page(page =>
    {
        page.Size(PageSizes.A4);
        page.Margin(2, Unit.Centimetre);
        page.PageColor(Colors.White);
        page.DefaultTextStyle(x => x.FontSize(20));
        page.DefaultTextStyle(x => x.FontFamily("Vijaya"));
        
        page.Header()
            .Text("தமிழ் PDF!")
            .SemiBold().FontSize(36).FontColor(Colors.Blue.Medium);
        
        page.Content()
            .PaddingVertical(1, Unit.Centimetre)
            .Column(x =>
            {
                x.Spacing(20);
                
                x.Item().Text("தமிழ் (Tamil language) தமிழர்களினதும் தமிழ் பேசும் பலரின் தாய்மொழி ஆகும். தமிழ், உலகின் உள்ள முதன்மையான மொழிகளில் ஒன்றும் செம்மொழியும் ஆகும்.");                
            });
        
        page.Footer()
            .AlignCenter()
            .Text(x =>
            {
                x.Span("பக்கம் ");
                x.CurrentPageNumber();
            });
    });
})
.GeneratePdf("தமிழ்.pdf");

Upvotes: 0

Learning
Learning

Reputation: 20051

Hi Have you looked at Google wkhtmltopdf.exe. I have used this without any issue

wkhtmltopdf.exe System.Security.SecurityException on cloud web server. How can i override server security policy

Only problem with this is that you need full trust level. If it is for intranet then this is the good option. if you are looking for I have tried this for arabic as well so tamil is not an issue.

Regards

Upvotes: 0

Related Questions