How To Add Go To Remote Action In PDF Document Using PDF Mosiac .NET Library

This sample shows how to use Go-To Remote actions. Go-To Remote action represents an action which goes to a destination in another document.Using methods and properties of PDFGoToRemoteAction class you can specify a target document, index of page to be shown as the result of the action. Also you can determine boolean value specifying whether to open the destination document in a new window.

GoTo Remote action

The below is c# example for using GoTo Remote action in PDF file:

using System;
using System.Collections.Generic;
using System.Text;

using PDFMosaic;

namespace AddGoToRemoteAction
{    
    class AddGoToRemoteAction
    {         	        
        static void Main()
        {
            PDFDocument pdf = new PDFDocument();
            pdf.Pages.Add(new PDFPage(PDFPaperFormat.A4));

            string fileName = @"test.pdf";            
            PDFGoToRemoteAction actionNewWnd = new PDFGoToRemoteAction(fileName, 2, true);
            PDFGoToRemoteAction actionNotNewWnd = new PDFGoToRemoteAction(fileName, 2, false);            

            PDFPushButton button1 = new PDFPushButton(20, 40, 120, 25, "btn_new_wnd");
            button1.Caption = "Go to a destination in another document in the new window";
            button1.OnActivated = actionNewWnd;
            button1.Font.Size = 8;

            PDFPushButton button2 = new PDFPushButton(20, 80, 120, 25, "btn_not_new_wnd");
            button2.Caption = "Go to a destination in another document in the same window";
            button2.OnActivated = actionNotNewWnd;
            button2.Font.Size = 8;

            pdf.Pages[0].Annotations.Add(button1);
            pdf.Pages[0].Annotations.Add(button2);

            pdf.Save("AddGoToRemoteAction.pdf", true);
        }        
    }
}