Articles in this section
Category / Section

PDF form fields values are not visible in Chrome browser

4 mins read

Syncfusion Essential PDF is a .NET PDF library used to create, read, and edit PDF documents. Using this library, you can make the text visible in PDF form fields in Chrome browser using C# and VB.NET. Form fields may appear empty before you click them due to the absence of the appearance dictionary. By setting false to SetDefaultAppearance(false) method in PdfForm class will create an own appearance dictionary. Doing this will make the text visible in Chrome browser.

Steps to make the text visible in PDF form fields in Chrome browser programmatically:

  1. Create a new C# Windows Forms application project. Window Forms application screenshot
  2. Install the Syncfusion.Pdf.WinForms NuGet package as reference to your .NET Framework application from NuGet.org. WinForms Sf PDF NuGet package screenshot
  3. Include the following namespaces in the Form1.cs file.

C#

using Syncfusion.Pdf.Parsing;

 

VB.NET

Imports Syncfusion.Pdf.Parsing

 

  1. Use the following code snippet in the click event of button to make the text visible in PDF form fields in Chrome browser.

C#

//Load the PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
//Get the loaded form
PdfLoadedForm loadedForm = loadedDocument.Form;
//Get the loaded text box field and fill it
PdfLoadedTextBoxField loadedTextBoxField = loadedForm.Fields[0] as PdfLoadedTextBoxField;
loadedTextBoxField.Text = "1";
//Set the default appearance
loadedForm.SetDefaultAppearance(false);
//Save the modified document
loadedDocument.Save("VisiblePDFFormFieldText.pdf");
//Close the document
loadedDocument.Close(true);

 

VB.NET

'Load the PDF document
Dim loadedDocument As New PdfLoadedDocument("input.pdf")
'Get the loaded form
Dim loadedForm As PdfLoadedForm = loadedDocument.Form
'Get the loaded text box field and fill it
Dim loadedTextBoxField As PdfLoadedTextBoxField = TryCast(loadedForm.Fields(0), PdfLoadedTextBoxField)
loadedTextBoxField.Text = "1"
'Set the default appearance
loadedForm.SetDefaultAppearance(False)
'Save the modified document
loadedDocument.Save("VisiblePDFFormFieldText.pdf")
'Close the document
loadedDocument.Close(True)

 

A complete working sample can be downloaded from VisibleTextInPDFFormFields.zip.

By executing the program, you will get the PDF document as follows. WinForms PDF Document

Take a moment to peruse the documentation for working with forms, where you will find other options like creating, removing, modifying, and filling form fields in the PDF document.

Refer here to explore the rich set of Syncfusion Essential PDF features.

An online sample link to fill and flatten the PDF form fields.

Note:

Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion license key in your application to use the components without trail message.

Conclusion

I hope you enjoyed learning about need to create a KB to load SVG file into our diagram control.

You can refer to our WinForms PDF’s feature tour page to know about its other groundbreaking feature representations. You can also explore our  WinForms PDF documentation to understand how to present and manipulate data.

For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms Diagram and other WinForms components.

If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied