alexa
menu

Document Processing

    Show / Hide Table of Contents

    PdfPageActions Class

    Represents actions for the PDF page.

    Inheritance
    System.Object
    PdfPageActions
    Namespace: Syncfusion.Pdf
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public class PdfPageActions : Object, IPdfWrapper
    Examples
    //Create a new PDF document
    PdfDocument document = new PdfDocument();
    //Add a page
    PdfPage page = document.Pages.Add();
    //Create a JavaScript action
    PdfJavaScriptAction action = new PdfJavaScriptAction("app.alert('Welcome to Page')");
    //Set the action to OnOpen event
    page.Actions.OnOpen = action;
    //Save the document
    document.Save("PageActions.pdf");
    document.Close(true);
    'Create a new PDF document
    Dim document As New PdfDocument()
    'Add a page
    Dim page As PdfPage = document.Pages.Add()
    'Create a JavaScript action
    Dim action As New PdfJavaScriptAction("app.alert('Welcome to Page')")
    'Set the action to OnOpen event
    page.Actions.OnOpen = action
    'Save the document
    document.Save("PageActions.pdf")
    document.Close(True)

    Properties

    OnClose

    Gets or sets the action that shall be performed when the page is closed.

    Declaration
    public PdfAction OnClose { get; set; }
    Property Value
    Type Description
    PdfAction

    A PdfAction specifying the action to be executed when the page is closed.

    Examples
    //Create a new PDF document
    PdfDocument document = new PdfDocument();
    //Add a page
    PdfPage page = document.Pages.Add();
    //Create a JavaScript action
    PdfJavaScriptAction action = new PdfJavaScriptAction("app.alert('Closing Page')");
    //Set the action to OnClose event
    page.Actions.OnClose = action;
    //Save the document
    document.Save("PageActions.pdf");
    document.Close(true);
    'Create a new PDF document
    Dim document As New PdfDocument()
    'Add a page
    Dim page As PdfPage = document.Pages.Add()
    'Create a JavaScript action
    Dim action As New PdfJavaScriptAction("app.alert('Closing Page')")
    'Set the action to OnClose event
    page.Actions.OnClose = action
    'Save the document
    document.Save("PageActions.pdf")
    document.Close(True)
    See Also
    PdfPage
    PdfAction

    OnOpen

    Gets or sets the action that shall be performed when the page is opened.

    Declaration
    public PdfAction OnOpen { get; set; }
    Property Value
    Type Description
    PdfAction

    A PdfAction specifying the action to be executed when the page is opened.

    Examples
    //Create a new PDF document
    PdfDocument document = new PdfDocument();
    //Add a page
    PdfPage page = document.Pages.Add();
    //Create a JavaScript action
    PdfJavaScriptAction action = new PdfJavaScriptAction("app.alert('Welcome to Page')");
    //Set the action to OnOpen event
    page.Actions.OnOpen = action;
    //Save the document
    document.Save("PageActions.pdf");
    document.Close(true);
    'Create a new PDF document
    Dim document As New PdfDocument()
    'Add a page
    Dim page As PdfPage = document.Pages.Add()
    'Create a JavaScript action
    Dim action As New PdfJavaScriptAction("app.alert('Welcome to Page')")
    'Set the action to OnOpen event
    page.Actions.OnOpen = action
    'Save the document
    document.Save("PageActions.pdf")
    document.Close(True)
    See Also
    PdfPage
    PdfAction

    Methods

    Clear(Boolean)

    Removes all actions associated with the page.

    Declaration
    public void Clear(bool annotationActions = true)
    Parameters
    Type Name Description
    System.Boolean annotationActions

    If true, removes both page actions and annotation actions; if false, removes only page actions. Default is true.

    Examples
    //Load an existing PDF document
    PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
    //Get the first page
    PdfPageBase page = document.Pages[0];
    //Clear all page actions including annotation actions
    page.Actions.Clear(true);
    //Save the document
    document.Save("Output.pdf");
    document.Close(true);
    'Load an existing PDF document
    Dim document As New PdfLoadedDocument("Input.pdf")
    'Get the first page
    Dim page As PdfPageBase = document.Pages(0)
    'Clear all page actions including annotation actions
    page.Actions.Clear(True)
    'Save the document
    document.Save("Output.pdf")
    document.Close(True)
    See Also
    PdfPageBase

    See Also

    PdfPage
    PdfAction
    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved