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.

Mon Jan 17, 2022 1:27 pm

Hello!

We are trying to fill an interactive PDF (that only has one interactive textfield) with a certain code that needs to be white, a specific font size and also bold. I've tried to make a new PDF font according to your example ("Set the font and color for the text on PDF Combo Box field area").

Here is my code:

For i As Integer = 0 To elementList.Count - 1

If TypeOf elementList(i) Is PdfTextBoxFieldWidget Then

Dim textBoxField As PdfTextBoxFieldWidget = TryCast(elementList(i), PdfTextBoxFieldWidget)

Select Case textBoxField.Name
Case "KUPONG"
Dim newFont = New PdfTrueTypeFont(New Font("Arial", 20.0F, FontStyle.Bold))
textBoxField.Text = voucherKod
textBoxField.TextAlignment = PdfTextAlignment.Center
textBoxField.ForeColor = Color.White
textBoxField.Font = newFont
End Select

End If
Next

As you can see, there's only one field we're looking for in the PDF ("KUPONG"). I picked the font "Arial", 20.0F and set the fontstyle to bold. The problem is, that in some pages, the code is bolded, and in some, it isn't. We can't see any pattern either (like every other or something like that). Are we doing something strange?

Also see the images that I've added. They show how the result looks like (some PDF's are getting the bolded text and some aren't).

Best regards,

Elin

elinarctic
 
Posts: 27
Joined: Thu Oct 21, 2021 11:39 am

Tue Jan 18, 2022 5:48 am

Hello,

Thank you for your inquiry.
To help us investigate your issue quickly and efficiently, please provide the following information. You could attach them here or send them to us via email (support@e-iceblue.com). Thanks in advance.
1) Your input PDF file (the file that fails to set the font style bold).
2) Your test environment, such as OS info (E.g. Windows 7, 64-bit) and region setting (E.g. China, Chinese).
3) Your application type, such as Console app (. Net Framework 4.5).

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1647
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.PDF