Class PdfLoadedButtonField
Represents a button field of an existing PDF document.
Implements
System.ComponentModel.INotifyPropertyChanged
Inherited Members
Namespace: Syncfusion.Pdf.Parsing
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfLoadedButtonField : PdfLoadedStyledField, IPdfWrapper, INotifyPropertyChanged
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.
Declaration
public bool ComplexScript { get; set; }
Property Value
Type |
---|
System.Boolean |
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)
Items
Gets the collection of button items.[Read-Only]
Declaration
public PdfLoadedButtonItemCollection Items { get; }
Property Value
Type |
---|
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.
Declaration
public string Text { get; set; }
Property Value
Type | Description |
---|---|
System.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.
Declaration
public void AddPrintAction()
Remarks
Clicking on the specified button will trigger the Print Dialog Box.
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)
Remove(PdfLoadedButtonItem)
Remove the particular PdfLoadedButtonItem from PdfLoadedButtonField.
Declaration
public void Remove(PdfLoadedButtonItem item)
Parameters
Type | Name | Description |
---|---|---|
PdfLoadedButtonItem | item |
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);
RemoveAt(Int32)
Remove the PdfLoadedButtonField item at the specified index.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
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);
Implements
System.ComponentModel.INotifyPropertyChanged