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

This sample shows how to create a URI action.
A URI action causes a URI (Uniform Resource Identifier) to beresolved.

 

using PDFMosaic;
using System;

namespace UriAction
{
    class UriAction
    {
        static void Main()
        {
            PDFDocument document = new PDFDocument();
            PDFPage page = new PDFPage(PDFPaperFormat.A4);

            PDFURIAction action = new PDFURIAction(new Uri("http://pdfmosaic.com/"));
            PDFPushButton button = new PDFPushButton(20, 40, 100, 20, "btn1");
            button.Caption = "PDF Mosaic site";
            button.OnActivated = action;
            button.Font.Size = 8;

            page.Annotations.Add(button);

            document.Pages.Add(page);
            document.Save("UriAction.pdf", true);
        }
    }
}