Controlling the highlighting of a form field of a pdf

Is there I way to control the highlighting of a form field of a pdf shown to a user ? 


I would like to highlight the field of a pdf differenlty depending on whom is supposed to fill it ? Is there a way to achieve this in flutter ?


Thank you !


3 Replies

JT Jeyalakshmi Thangamarippandian Syncfusion Team January 19, 2024 02:43 PM UTC

You can refer to the following documentation link for creating form fields with different custom styles. Based on that, we can highlight the form fields with various custom appearances.

https://help.syncfusion.com/flutter/pdf/working-with-forms



VO Vaun Orage January 19, 2024 03:18 PM UTC

Hello,


In this solution, a new textbox field is created from scratch, I want to have an example where I modify the highlight color of a current field inside the pdf form.


Thank you



KS Karmegam Seerangan Syncfusion Team January 22, 2024 03:27 PM UTC

Kindly refer the following code snippet to modify color properties from existing text box field.

 //Loads an existing PDF document.

 final PdfDocument document =

      PdfDocument(inputBytes: File('input.pdf').readAsBytesSync());

 //Get the loaded form field by index.

 final PdfField field = document.form.fields[0];

 if (field is PdfTextBoxField) {

   //Modify the back color.

   field.backColor = PdfColor(255, 0, 0);

   //Modify the border color.

   field.borderColor = PdfColor(0, 255, 0);

   //Modify the text color.

   field.foreColor = PdfColor(0, 0, 255);

 }

 //Disable default appearance.

 document.form.setDefaultAppearance(false);

 //Save the PDF document.

 File('output.pdf').writeAsBytesSync(await document.save());

 //Dispose the document.

 document.dispose();

 

Kindly use the following UG link for reference, https://help.syncfusion.com/flutter/pdf/working-with-forms#modifying-the-existing-form-field-in-a-pdf-document



Loader.
Up arrow icon