An easy to understand guide on how to add launch action to pdf with pdf sdk in C# with this source code sample. ByteScout Premium Suite is the set that includes 12 SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording. It can add launch action to pdf with pdf sdk in C#.
Want to quickly learn? This fast application programming interfaces of ByteScout Premium Suite for C# plus the guidelines and the code below will help you quickly learn how to add launch action to pdf with pdf sdk. Simply copy and paste in your C# project or application you and then run your app! Enjoy writing a code with ready-to-use sample codes in C#.
You can download free trial version of ByteScout Premium Suite from our website to see and try many others source code samples for C#.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
using System.Diagnostics;
using Bytescout.PDF;
namespace LaunchActionExample
{
/// <summary>
/// This example demonstrates how to create a button that launches an external resource.
/// </summary>
class Program
{
static void Main()
{
// Create new document
Document pdfDocument = new Document();
pdfDocument.RegistrationName = "demo";
pdfDocument.RegistrationKey = "demo";
// Add page
Page page = new Page(PaperFormat.A4);
pdfDocument.Pages.Add(page);
// Create button
PushButton button = new PushButton(20, 20, 120, 25, "button1");
button.Caption = "Launch sample.txt";
// Create action that opens an external file
LaunchAction launchAction = new LaunchAction(System.IO.Path.GetFullPath("sample.txt"));
button.OnActivated = launchAction;
page.Annotations.Add(button);
// Save document to file
pdfDocument.Save("result.pdf");
// Cleanup
pdfDocument.Dispose();
// Open result document in default associated application (for demo purpose)
ProcessStartInfo processStartInfo = new ProcessStartInfo("result.pdf");
processStartInfo.UseShellExecute = true;
Process.Start(processStartInfo);
}
}
}
60 Day Free Trial or Visit ByteScout Premium Suite Home Page
Explore ByteScout Premium Suite Documentation
Explore Samples
Sign Up for ByteScout Premium Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
sample.txt
1234567890
abcdefghijklmnopqrstuvwxyz
60 Day Free Trial or Visit ByteScout Premium Suite Home Page
Explore ByteScout Premium Suite Documentation
Explore Samples
Sign Up for ByteScout Premium Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout Premium Suite Home Page
Explore ByteScout Premium Suite Documentation
Explore Samples
Sign Up for ByteScout Premium Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: