Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Thu Jun 12, 2025 5:14 am

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

rdnzrdnz
 
Posts: 3
Joined: Thu Jun 12, 2025 4:50 am

Thu Jun 12, 2025 8:06 am

Hello,

Thanks for your inquiry.
I noticed that the font of the PdfTextBoxFieldWidget in your pdf document is BebasNeue-Regular. If you don't have this font installed in your system, Spire.PDF will use other fonts to draw the content when updating the content of the feild. To avoid this issue, please install the BebasNeue-Regular font and retest. You can get the font from this link. If you have any other questions, please feel free to write to back.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 757
Joined: Mon Dec 27, 2021 2:23 am

Thu Jun 12, 2025 8:40 am

I have the font of course and it is installed (otherwise I could not select it when creating the form field using adobe acrobat). Is there any other possible reason for this behaviour?

rdnzrdnz
 
Posts: 3
Joined: Thu Jun 12, 2025 4:50 am

Thu Jun 12, 2025 9:26 am

Hello,

Thansk for your feedback.
On my side, I installed the BebasNeue font and did not reproduce the issue you mentioned. I uploaded my results for your reference. Are you currently using the latest Spire.PDF Pack(Hotfix) Version:11.6.0? If not, please upgrade to this version and retest.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 757
Joined: Mon Dec 27, 2021 2:23 am

Fri Jun 13, 2025 4:04 am

i'm using the latest version of the community version, which is 10.2

rdnzrdnz
 
Posts: 3
Joined: Thu Jun 12, 2025 4:50 am

Fri Jun 13, 2025 6:14 am

Hello,

Thanks for your reply.
Please note that 10.2 is a free version. The free version does not provide technical support and is updated occasionally. For your scenario, we recommend that you switch to the commercial version to verify whether the issuestill exists.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 757
Joined: Mon Dec 27, 2021 2:23 am

Return to Spire.PDF

cron