When updating the content of a form field within an existing PDF, the embedded font is lost and a default font replaced instead.
See document attached with Bebas Neue font embedded.
Using this code to amend the contents of the form field ...
doc.LoadFromFile(@"C:\inetpub\wwwroot\d3-resources\rev\certificates\cert.pdf");
PdfFormWidget formWidget = doc.Form as PdfFormWidget;
for (int i = 0; i < formWidget.FieldsWidget.List.Count; i++)
{
PdfField field = formWidget.FieldsWidget.List[i] as PdfField;
//Fill the data for textBoxField
if (field is PdfTextBoxFieldWidget)
{
PdfTextBoxFieldWidget textBoxField = field as PdfTextBoxFieldWidget;
switch (textBoxField.Name)
{
case "_NAME":
textBoxField.Text = "MY NEW NAME";
break;
default:
// code block
break;
}
}
}
The field is updated but the Bebas font is removed from the saved document and replaced with Helvetica. The form field is also set to be Helvetica.
I had the same issue using ReplaceText function.
Any help appreciated.
rob