Class PdfGoToAction
Represents an action which goes to a destination in the current document.
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfGoToAction : PdfAction, IPdfWrapper
Remarks
This PdfGoToAction class is used to display the specified page in the current document. Please refer the UG docuemntation link https://help.syncfusion.com/file-formats/pdf/working-with-action#goto-action for more details.
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//Create font and font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold);
//Create a new PdfButtonField
PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
submitButton.Bounds = new RectangleF(25, 160, 100, 20);
submitButton.Font = font;
submitButton.Text = "Goto";
submitButton.BackColor = new PdfColor(181, 191, 203);
//Create a new page and adds it as the last page of the document
PdfPage pdfPages = document.Pages.Add();
//Create a new PdfGoToAction
PdfGoToAction gotoAction = new PdfGoToAction(pdfPages);
//Add the gotoAction
submitButton.Actions.GotFocus = gotoAction;
//Add the submit button to a new document.
document.Form.Fields.Add(submitButton);
//Save document to disk.
document.Save("GoToAction.pdf");
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'Create font and font style.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12F, PdfFontStyle.Bold)
'Create a new PdfButtonField
Dim submitButton As New PdfButtonField(page, "submitButton")
submitButton.Bounds = New RectangleF(25, 160, 100, 20)
submitButton.Font = font
submitButton.Text = "Goto"
submitButton.BackColor = New PdfColor(181, 191, 203)
'Create a new page and adds it as the last page of the document
Dim pdfPages As PdfPage = document.Pages.Add()
'Create a new PdfGoToAction
Dim gotoAction As New PdfGoToAction(pdfPages)
'Add the gotoAction
submitButton.Actions.GotFocus = gotoAction
'Add the submit button to a new document.
document.Form.Fields.Add(submitButton)
'Save document to disk.
document.Save("GoToAction.pdf")
document.Close(True)
Constructors
PdfGoToAction(PdfDestination)
Initializes a new instance of the PdfGoToAction class with specified destination page.
Declaration
public PdfGoToAction(PdfDestination destination)
Parameters
Type | Name | Description |
---|---|---|
PdfDestination | destination | The destination to jump to. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//Create font and font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold);
//Create a new PdfButtonField
PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
submitButton.Bounds = new RectangleF(25, 160, 100, 20);
submitButton.Font = font;
submitButton.Text = "Goto";
submitButton.BackColor = new PdfColor(181, 191, 203);
//Create a new page and adds it as the last page of the document
PdfPage pdfPages = document.Pages.Add();
//Create a new PdfDestination
PdfDestination destination = new PdfDestination(pdfPages);
//Set the PdfDestinationMode
destination.Mode = PdfDestinationMode.FitToPage;
//Create a new PdfGoToAction
PdfGoToAction gotoAction = new PdfGoToAction(destination);
//Add the gotoAction
submitButton.Actions.GotFocus = gotoAction;
//Add the submit button to a new document.
document.Form.Fields.Add(submitButton);
//Save document to disk.
document.Save("GoToAction.pdf");
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'Create font and font style.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12F, PdfFontStyle.Bold)
'Create a new PdfButtonField
Dim submitButton As New PdfButtonField(page, "submitButton")
submitButton.Bounds = New RectangleF(25, 160, 100, 20)
submitButton.Font = font
submitButton.Text = "Goto"
submitButton.BackColor = New PdfColor(181, 191, 203)
'Create a new page and adds it as the last page of the document
Dim pdfPages As PdfPage = document.Pages.Add()
'Create a new PdfDestination
Dim destination As New PdfDestination(pdfPages)
'Set the PdfDestinationMode
destination.Mode = PdfDestinationMode.FitToPage
'Create a new PdfGoToAction
Dim gotoAction As New PdfGoToAction(destination)
'Add the gotoAction
submitButton.Actions.GotFocus = gotoAction
'Add the submit button to a new document.
document.Form.Fields.Add(submitButton)
'Save document to disk.
document.Save("GoToAction.pdf")
document.Close(True)
See Also
PdfGoToAction(PdfPage)
Initializes a new instance of the PdfGoToAction class with specified page.
Declaration
public PdfGoToAction(PdfPage page)
Parameters
Type | Name | Description |
---|---|---|
PdfPage | page | The page to navigate. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//Create font and font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold);
//Create a new PdfButtonField
PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
submitButton.Bounds = new RectangleF(25, 160, 100, 20);
submitButton.Font = font;
submitButton.Text = "Goto";
submitButton.BackColor = new PdfColor(181, 191, 203);
//Create a new page and adds it as the last page of the document
PdfPage pdfPages = document.Pages.Add();
//Create a new PdfGoToAction
PdfGoToAction gotoAction = new PdfGoToAction(pdfPages);
//Add the gotoAction
submitButton.Actions.GotFocus = gotoAction;
//Add the submit button to a new document.
document.Form.Fields.Add(submitButton);
//Save document to disk.
document.Save("GoToAction.pdf");
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'Create font and font style.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12F, PdfFontStyle.Bold)
'Create a new PdfButtonField
Dim submitButton As New PdfButtonField(page, "submitButton")
submitButton.Bounds = New RectangleF(25, 160, 100, 20)
submitButton.Font = font
submitButton.Text = "Goto"
submitButton.BackColor = New PdfColor(181, 191, 203)
'Create a new page and adds it as the last page of the document
Dim pdfPages As PdfPage = document.Pages.Add()
'Create a new PdfGoToAction
Dim gotoAction As New PdfGoToAction(pdfPages)
'Add the gotoAction
submitButton.Actions.GotFocus = gotoAction
'Add the submit button to a new document.
document.Form.Fields.Add(submitButton)
'Save document to disk.
document.Save("GoToAction.pdf")
document.Close(True)
See Also
Properties
Destination
Gets or sets the destination to be navigated.
Declaration
public PdfDestination Destination { get; set; }
Property Value
Type | Description |
---|---|
PdfDestination | The PdfDestination to navigate. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//Create font and font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold);
//Create a new PdfButtonField
PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
submitButton.Bounds = new RectangleF(25, 160, 100, 20);
submitButton.Font = font;
submitButton.Text = "Goto";
submitButton.BackColor = new PdfColor(181, 191, 203);
//Create a new page and adds it as the last page of the document
PdfPage pdfPages = document.Pages.Add();
//Create a new PdfDestination
PdfDestination destination = new PdfDestination(pdfPages);
//Set the PdfDestinationMode
destination.Mode = PdfDestinationMode.FitToPage;
//Create a new PdfGoToAction
PdfGoToAction gotoAction = new PdfGoToAction(pdfPages);
//Set the destination
gotoAction.Destination = destination;
//Add the gotoAction
submitButton.Actions.GotFocus = gotoAction;
//Add the submit button to a new document.
document.Form.Fields.Add(submitButton);
//Save document to disk.
document.Save("GoToAction.pdf");
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'Create font and font style.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12F, PdfFontStyle.Bold)
'Create a new PdfButtonField
Dim submitButton As New PdfButtonField(page, "submitButton")
submitButton.Bounds = New RectangleF(25, 160, 100, 20)
submitButton.Font = font
submitButton.Text = "Goto"
submitButton.BackColor = New PdfColor(181, 191, 203)
'Create a new page and adds it as the last page of the document
Dim pdfPages As PdfPage = document.Pages.Add()
'Create a new PdfDestination
Dim destination As New PdfDestination(pdfPages)
'Set the PdfDestinationMode
destination.Mode = PdfDestinationMode.FitToPage
'Create a new PdfGoToAction
Dim gotoAction As New PdfGoToAction(pdfPages)
'Set the destination
gotoAction.Destination = destination
'Add the gotoAction
submitButton.Actions.GotFocus = gotoAction
'Add the submit button to a new document.
document.Form.Fields.Add(submitButton)
'Save document to disk.
document.Save("GoToAction.pdf")
document.Close(True)
See Also
Methods
Initialize()
Initializes instance.
Declaration
protected override void Initialize()