I have PDF template file with fields. Template created by customer. It has some text, field labels and fields itself. Text and labels uses some font which is embedded within the template.
Problems occur when I try to fill fields with cyrillic values - there is no cyrillic symbols in result document.
I saw a lot of similar problems which were solved by using substitution font for AcroFields. But here I can't use one specific font for substitution, because I can't define field font in template.
I tried to set different fonts for fields in Acrobat Editor - Times New Roman, Arial and other well known Windows fonts, but there is no effect in resulting pdf.
Code sample:
FontFactory.RegisterDirectory(Environment.GetFolderPath(Environment.SpecialFolder.Fonts));
using (var dest = File.Create(@"result.pdf"))
{
using (var stamper = new PdfStamper(reader, dest))
{
var fields = stamper.AcroFields;
fields.SetField("ClientName", "Имя клиента");
stamper.FormFlattening = true;
stamper.Close();
}
}
I even registered all available fonts in FontFactory, but there was no effect.
So the questions are: 1. If I can embed font in Adobe Acrobat used for fields only, then how to do it? 2. If I can define font family for existing field with iTextSharp, then how to do it?