Trimack
Trimack

Reputation: 4213

iTextSharp diacritics

I am trying to typeset a pdf with iTextSharp library, but I cannot find anywhere how to handle diacritics. Since I found tables of contents of two books about iTextSharp where diacritics has a section, I suppose it is doable. So the question is

How to typeset "ř" ?

In addition, is there some guide or link about this problem?

Thanks in advance.

Upvotes: 3

Views: 2474

Answers (3)

Dragos Durlut
Dragos Durlut

Reputation: 8098

I've tried to implement the answer sugested by glaxaco, but it did not work for me.

I've tried to fill out a pdf form with AcroFields, but the diacritics ţşŢŞăîĂÎ etc. would not apeear. (using Arial font)

In the end I've resorted to stripping the diacritics

Pretty weird because when I introduce them by hand, as in MANUALLY filling in the forms, the diacritics show up just fine.

Hope someone can find a solution to this problem. :(

Upvotes: 2

Eric Pohl
Eric Pohl

Reputation: 2344

You're going to need to figure out what the Unicode representation is for your diacritical characters. You can embed Unicode characters into a string literal with \u[unicode value in hex]; e.g.

string s = "\u0159";  // Should be your character

You may also need to choose a font that can represent the characters correctly:

bf = BaseFont.CreateFont(...);
font = new Font(bf, 12);
document.Add(new Paragraph(s, font);

Upvotes: 5

Bozho
Bozho

Reputation: 597026

Diacritics are simply unicode characters. You will have to embed an unicode font into the PDF. See this thread for Java examples, I assume they will be almost the same in C#

Upvotes: 0

Related Questions