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.

Tue Apr 11, 2017 3:23 pm

Hi,

I have created PdfTextBoxFieldWidget fields in my PDF. I fill these fields using c# code. One of these fields has a different (my own) font. The font is set in the field in MyFileTemplate

When my pdf is generated and saved on the disk, this field with the special font is not displayed. But as soon as I click with a mouse, the correct font is displayed. My application sends the pdfs directly to printer. How can I fix this field. Please see my code below

using (PdfDocument doc = new PdfDocument())
{
doc.LoadFromFile(MyFileTemplate);
PdfFormWidget formWidget = doc.Form as PdfFormWidget;

(formWidget.FieldsWidget["UserID"] as PdfTextBoxFieldWidget).Text = Username;
(formWidget.FieldsWidget["Name"] as PdfTextBoxFieldWidget).Text =Name;
(formWidget.FieldsWidget["Address"] as PdfTextBoxFieldWidget).Text = Address;
// Special field
(formWidget.FieldsWidget["Barcode"] as PdfTextBoxFieldWidget).Text = "3653856";

doc.SaveToFile(MyFilePath);
}

jack70619@gmail.com
 
Posts: 1
Joined: Tue Apr 11, 2017 3:17 pm

Wed Apr 12, 2017 3:25 am

Hi,

Thanks for your inquiry.
Please provide us with your template PDF. Then we will do an investigation and update to you.

Thanks,
Betsy
E-icbelue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Fri Feb 26, 2021 12:45 am

Hey E-iceblue,

We are having the exact same issues here, and after trying for many hours, cannot solve the issue.

The input file attached has a couple of Text Fields. Each field has a different font, and in Adobe Acrobat can be seen and printed ok.

However, once I update the text values in each field, then save the PDF to another file, Acrobat shows a default font in both fields, UNTIL I click into them, at which point the correct font is shown. When printing the output pdf, the correct fonts do not print.

How do we preserve the fonts in the text boxes, so that the correct font is printed?

Here is my DotNet code

Code: Select all
PdfDocument doc = new PdfDocument();
            Console.Write("Loading..");
            doc.LoadFromFile("formtest-input.pdf");
            Console.WriteLine("ok.");

            PdfFormWidget formWidget = doc.Form as PdfFormWidget;
            var fieldlist = formWidget.FieldsWidget.List;
            foreach (PdfField field in formWidget.FieldsWidget.List)
            {
                if(field is PdfTextBoxFieldWidget)
                {
                    PdfTextBoxFieldWidget textBoxField = field as PdfTextBoxFieldWidget;
                    switch(textBoxField.Name)
                    {
                        case "txtTest1":
                            textBoxField.Text = "Cup of Tea";
                            break;

                        case "txtTest2":
                            textBoxField.Text = "Cup of Coffee";
                            break;
                    }

                   
                   
                }
            }

            doc.SaveToFile("formtest-output.pdf");

toopandtoop
 
Posts: 3
Joined: Thu Jul 26, 2018 2:31 am

Fri Feb 26, 2021 6:05 am

Hello,

Thanks for your inquiry!

I have reproduced your issue and logged it in our issue tracking system with the ticket SPIREPDF-4072 for further investigation.

We will let you know if there is any update. Sorry for the inconvenience caused.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Mon Mar 15, 2021 10:03 pm

Hi again,

Just checking in to see if there has been any progress on a patch for this issue?

Regards,
Marcus.

toopandtoop
 
Posts: 3
Joined: Thu Jul 26, 2018 2:31 am

Tue Mar 16, 2021 7:02 am

Hello,

Thanks for your following up!

For the issue SPIREPDF-4072, our Dev team is still working on this, once there are some good news, we will inform you ASAP. Thanks for your patience.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Wed Apr 14, 2021 10:33 am

Hello,

Thanks for your patience!

Glad to inform you that we just released Spire.PDF Pack(Hot Fix) Version:7.4.5 which fixes the issue SPIREPDF-4072.

Please download the fix version from the following links to test.
Website link:
https://www.e-iceblue.com/Download/download-pdf-for-net-now.html
Nuget link:
https://www.nuget.org/packages/Spire.PDF.NETCore/7.4.5
https://www.nuget.org/packages/Spire.PDF/7.4.5

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Mon Apr 19, 2021 9:47 am

Hello,

Hope you are doing well!

Has the issue been solved now? Could you please give us some feedback at your convenience?

Thanks in advance.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Return to Spire.PDF