PdfButtonFormFieldFacade Class
Contains a set of properties used to manage button form fields without access to their inner structure.
Namespace: DevExpress.Pdf
Assembly: DevExpress.Pdf.v24.2.Core.dll
NuGet Package: DevExpress.Pdf.Core
#Declaration
public class PdfButtonFormFieldFacade :
PdfFormFieldFacade<PdfButtonWidgetFacade, PdfButtonFormField>
#Related API Members
The following members return PdfButtonFormFieldFacade objects:
#Remarks
Note
PDF Document API does not ship with API to create push button fields. You can only retrieve the existing push button fields and change their properties.
#Change Widget Annotation Options
Use the Widgets property to get options of each widget annotation associated with the button form field. The PdfButtonWidgetFacade class properties allow you to change the border and background color, specify an alternate caption, and more.
The code sample below changes the button form field appearance:
using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
{
pdfDocumentProcessor.LoadDocument("Documents//FormDemo.pdf");
PdfDocumentFacade documentFacade = pdfDocumentProcessor.DocumentFacade;
PdfAcroFormFacade acroForm = documentFacade.AcroForm;
//Obtain button form field parameters:
PdfButtonFormFieldFacade pushButton = acroForm.GetButtonFormField("Submit");
//Retrieve form field widget:
PdfButtonWidgetFacade buttonWidget = pushButton.Widgets[0];
//Change widget's color options:
buttonWidget.BorderWidth = 1;
buttonWidget.BackgroundColor = new PdfRGBColor(0.81, 0.81, 0.81);
buttonWidget.BorderColor = new PdfRGBColor(0.47, 0.44, 0.67);
buttonWidget.FontColor = new PdfRGBColor(0.34, 0.25, 0.36);
}
#Change Icon Options
Use the following methods to specify a button icon:
- SetNormalIcon – Specifies the button icon displayed when the button is not clicked.
- SetAlternateIcon – Specifies the button icon displayed when the user clicks the button, but before the button is released.
- SetRolloverIcon – Specifies the button icon displayed when the mouse pointer hovers over the button.
The PdfButtonWidgetIconOptions class properties allow you to specify icon display and scale options. Use the PdfButtonWidgetFacade.IconOptions property to get these options.
The code sample below specifies a normal icon and its options:
using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
{
pdfDocumentProcessor.LoadDocument("Documents//FormDemo.pdf");
PdfDocumentFacade documentFacade = pdfDocumentProcessor.DocumentFacade;
PdfAcroFormFacade acroForm = documentFacade.AcroForm;
//Change all form fields' color settings:
var fields = acroForm.GetFields();
foreach (PdfFormFieldFacade field in fields)
{
ChangeFormFieldColor(field);
}
//Obtain button form field parameters:
PdfButtonFormFieldFacade pushButton = acroForm.GetButtonFormField("Submit");
PdfButtonWidgetFacade buttonWidget = pushButton.Widgets[0];
//Specify a button icon and set its options:
buttonWidget.SetNormalIcon("Documents//submit_3802014.png");
buttonWidget.IconOptions.FitToAnnotationBounds = true;
buttonWidget.IconOptions.ScaleCondition = PdfIconScalingCircumstances.BiggerThanAnnotationRectangle;
buttonWidget.TextPosition = PdfWidgetAnnotationTextPosition.NoCaption;
}