FormField Bug?: Non-standard characters are unreadable in Non-Edit mode. Ok when clicking field to edit


Description:
When adding FormField of type Text, and setting its FieldValue to a value containing non-standard characters (i.e the Norwegian characters æ,ø,å ), the value seems to be displayed incorrect when in NON-edit mode.

However, when you CLICK on the textfield to edit its value, the characters are displayed correctly.

Environment:
Platform: .net 4.5.2
Aspose Pdf version: 11.5.0.0


Steps to reproduce:

1. Using the following code:

var Pdf = new Aspose.Pdf.Generator.Pdf();
Pdf.PageSetup.PageWidth = Aspose.Pdf.Generator.PageSize.A4Width;
Pdf.PageSetup.PageHeight = Aspose.Pdf.Generator.PageSize.A4Height;
Pdf.PageSetup.Margin = new Aspose.Pdf.Generator.MarginInfo() { Top = 20, Left = 20, Right = 20, Bottom = 20 };
Pdf.DefaultFontName = "Arial Unicode MS";
Pdf.TextInfo.FontName = "Arial Unicode MS";
var sect=Pdf.Sections.Add();
sect.Paragraphs.Add(new Text("Testing ÆØÅ "));
sect.Paragraphs.Add(new FormField()
{
FormFieldType = Aspose.Pdf.Generator.FormFieldType.Text,
FieldName = "inputname",
FormWidth = 100,
TextFontName = "Arial Unicode MS",
FieldValue = "Testing ÆØÅ "
});
Pdf.SetUnicode();
Pdf.Save(@"..\..\output\test.pdf");
System.Diagnostics.Process.Start(@"..\..\output\test.pdf");


2. Open the PDF. The value of the formfield looks strange.

3.Click on the formfield. The value looks correct.






Hi there,


Thanks for your inquiry. It is recommended to use new generator(Aspose.Pdf) as it is more improved and efficient than old generator(Aspose.Pdf.Generator), it can create a new PDF document from scratch and can manipulate existing PDF document as well. Furthermore old generator will be obsolete in near future.

Aspose.Pdf.Text.TextState
textState = new Aspose.Pdf.Text.TextState();<o:p></o:p>

textState.Font = FontRepository.FindFont("Arial Unicode MS");

var Pdf = new Aspose.Pdf.Document();

Aspose.Pdf.Page sect=Pdf.Pages.Add();

Pdf.PageInfo.Width = Aspose.Pdf.PageSize.A4.Width;

Pdf.PageInfo.Height = Aspose.Pdf.PageSize.A4.Height;

Pdf.PageInfo.Margin = new Aspose.Pdf.MarginInfo() { Top = 20, Left = 20, Right = 20, Bottom = 20 };

//Pdf.TextInfo.FontName = "Arial Unicode MS";

Pdf.PageInfo.DefaultTextState = textState;

sect.Paragraphs.Add(new TextFragment("Testing ÆØÅ "));

sect.Paragraphs.Add(new TextBoxField()

{

//FormFieldType = Aspose.Pdf.Generator.FormFieldType.Text,

PartialName = "inputname",

Width = 100,

Height = 15,

Value = "Testing ÆØÅ "

});

Pdf.Save(myDir+"test.pdf");

Please feel free to contact us for any further assistance.


Best Regards,