You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Pages/Insert-New-Page-in-Existing-PDF-with-Same-Size/.NET).
1593
+
1594
+
## Page-level actions in PDF documents
1595
+
1596
+
Added full support for page‑level actions in the .NET PDF library, enabling developers to add, retrieve, edit, and remove actions triggered by PDF page events such as `OnOpen` and `OnClose`.
1597
+
1598
+
Refer to the following code example to define custom behavior for PDF page‑level actions.
1599
+
1600
+
{% tabs %}
1601
+
1602
+
{% highlight c# tabtitle="C# [Cross-platform]" %}
1603
+
1604
+
using Syncfusion.Pdf;
1605
+
using Syncfusion.Pdf.Interactive;
1606
+
1607
+
// Create a new PDF document.
1608
+
using (PdfDocument document = new PdfDocument())
1609
+
{
1610
+
// Add a page to the document.
1611
+
PdfPage page1 = document.Pages.Add();
1612
+
document.Actions.AfterOpen =
1613
+
// Create and add new JavaScript action to execute when the first page opens
1614
+
Page1.Actions.OnOpen = new PdfJavaScriptAction("app.alert(\"Welcome! This page has just been opened.\");");
1615
+
// Create and add new URI action to execute when the first page closes
1616
+
Page1.Actions.OnClose = new PdfUriAction("http://www.google.com");
1617
+
// Add second page to the document.
1618
+
PdfPage page2 = document.Pages.Add();
1619
+
// Create a sound action
1620
+
PdfSoundAction soundAction = new PdfSoundAction("Startup.wav");
0 commit comments