Table of Contents

Class PdfLoadedButtonField

Namespace
Syncfusion.Pdf.Parsing
Assembly
Syncfusion.Pdf.Portable.dll

Represents a button field of an existing PDF document.

public class PdfLoadedButtonField : PdfLoadedStyledField, INotifyPropertyChanged
Inheritance
PdfLoadedButtonField
Implements
Inherited Members

Examples

//Load an existing document.
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the form
PdfLoadedForm form = doc.Form;
// Load an existing button field.
PdfLoadedButtonField buttonField = form.Fields["Submit"] as PdfLoadedButtonField;
buttonField.ToolTip = "SubmitButton";
doc.Save("Form.pdf");
doc.Close(true);
'Load an existing document.
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the form
Dim form As PdfLoadedForm = doc.Form
' Load an existing button field.
Dim buttonField As PdfLoadedButtonField = TryCast(form.Fields("Submit"), PdfLoadedButtonField)
buttonField.ToolTip = "SubmitButton"
doc.Save("Form.pdf")
doc.Close(True)

Properties

ComplexScript

Gets or sets the complex script language support.

public bool ComplexScript { get; set; }

Property Value

bool

Examples

//Load existing PDF document.
PdfLoadedDocument ldoc = new PdfLoadedDocument("form.pdf");
//Load the existing button box field.
PdfLoadedButtonField button = lfied as PdfLoadedButtonField;
//Create font.
Font font = new Font("Tahoma", 10f);
//Create a new PDF font instance.
PdfFont pdfFont = new PdfTrueTypeFont(font, FontStyle.Regular, 10f, true, true);
//Set font.
button.Font = pdfFont;
//Enable complex script support.
button.ComplexScript = true;
ldoc.Form.SetDefaultAppearance(false);
//Save the document.
ldoc.Save("output.pdf");
//Close the document.
ldoc.Close(true);
'Load existing PDF document.
Dim ldoc As New PdfLoadedDocument("form.pdf")
'Load the existing button box field.
Dim button As PdfLoadedButtonField = TryCast(ldoc.Form.Fields(0), PdfLoadedButtonField)
'Create font.
Dim font As New Font("Tahoma", 10F)
'Create a new PDF font instance.
Dim pdfFont As PdfFont = New PdfTrueTypeFont(font, FontStyle.Regular, 10F, True, True)
'Set font.
button.Font = pdfFont
'Enable complex script support.
button.ComplexScript = True
ldoc.Form.SetDefaultAppearance(False)
'Save the document.
ldoc.Save("output.pdf")
'Close the document.
ldoc.Close(True)
See Also

Items

Gets the collection of button items.[Read-Only]

public PdfLoadedButtonItemCollection Items { get; }

Property Value

PdfLoadedButtonItemCollection

Examples

//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load an existing button field
PdfLoadedButtonField buttonField = doc.Form.Fields["Submit"] as PdfLoadedButtonField;
// Reading button collection item
PdfLoadedButtonItemCollection buttonCollection = buttonField.Items;
// Load an existing button item
PdfLoadedButtonItem buttonItem = buttonCollection[0];
buttonItem.Bounds = new RectangleF(0, 0, 20, 30);
doc.Save("Form.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load an existing button field
Dim buttonField As PdfLoadedButtonField = TryCast(doc.Form.Fields("Submit"), PdfLoadedButtonField)
' Reading button collection item
Dim buttonCollection As PdfLoadedButtonItemCollection = buttonField.Items
' Load an existing button item
Dim buttonItem As PdfLoadedButtonItem = buttonCollection(0)
buttonItem.Bounds = New RectangleF(0, 0, 20, 30)
doc.Save("Form.pdf")
doc.Close(True)
See Also

Text

Gets or sets the caption text.

public string Text { get; set; }

Property Value

string

A string value specifying the caption of the button.

Examples

//Load an existing document.
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load the form
PdfLoadedForm form = doc.Form;
// Load an existing button field.
PdfLoadedButtonField buttonField = form.Fields["Submit"] as PdfLoadedButtonField;
buttonField.Text = "Submit";
doc.Save("Form.pdf");
doc.Close(true);
'Load an existing document.
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Load the form
Dim form As PdfLoadedForm = doc.Form
' Load an existing button field.
Dim buttonField As PdfLoadedButtonField = TryCast(form.Fields("Submit"), PdfLoadedButtonField)
buttonField.Text = "Submit"
doc.Save("Form.pdf")
doc.Close(True)
See Also

Methods

AddPrintAction()

Adds Print action to current button field.

public void AddPrintAction()

Examples

//Load an existing document
PdfLoadedDocument ldoc = new PdfLoadedDocument("SourceDoc.pdf");
// Load the existing form
PdfLoadedForm form = ldoc.Form;
// Load an existing button field.
PdfLoadedButtonField buttonField = form.Fields["Submit"] as PdfLoadedButtonField;
// Adding print action
buttonField.AddPrintAction();
// Save the document to a disk
ldoc.Save("Form.pdf");
ldoc.Close(true);
'Load an existing document
Dim ldoc As PdfLoadedDocument = New PdfLoadedDocument("SourceDoc.pdf")
' Load the existing form
Dim form As PdfLoadedForm = ldoc.Form
' Load an existing button field.
Dim buttonField As PdfLoadedButtonField = TryCast(form.Fields("Submit"), PdfLoadedButtonField)
' Adding print action
buttonField.AddPrintAction()
' Save the document to a disk
ldoc.Save("Form.pdf")
ldoc.Close(True)

Remarks

Clicking on the specified button will trigger the Print Dialog Box.

See Also

Remove(PdfLoadedButtonItem)

Remove the particular PdfLoadedButtonItem from PdfLoadedButtonField.

public void Remove(PdfLoadedButtonItem item)

Parameters

item PdfLoadedButtonItem

Examples

 //Load an existing document
 PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");      
 //Get the loaded form.
  PdfLoadedForm loadedForm = loadedDocument.Form;
 //Get the buttonField
 PdfLoadedButtonField buttonField = loadedForm.Fields[0] as PdfLoadedButtonField;
 //Get the buttonField Item
 PdfLoadedButtonItem buttonFieldItem = textBoxField.Items[0] as PdfLoadedButtonItem;
//Remove the buttonField item
 loadedField.Remove(buttonFieldItem);         
//Save the modified document.
 loadedDocument.Save("form.pdf");
 //Close the document
loadedDocument.Close(true);
See Also

RemoveAt(int)

Remove the PdfLoadedButtonField item at the specified index.

public void RemoveAt(int index)

Parameters

index int

Examples

 //Load an existing document
 PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");        
 //Get the loaded form.
  PdfLoadedForm loadedForm = loadedDocument.Form;
 //Get the buttonField 
 PdfLoadedButtonField buttonField = loadedForm.Fields[0] as PdfLoadedButtonField;       
//Remove the buttonField item
 buttonField.RemoveAt(0);
//Save the modified document.
 loadedDocument.Save("form.pdf");
//Close the document
loadedDocument.Close(true);
See Also

See Also