ByteScout PDF Suite - C# - Set link to page in pdf with pdf sdk - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout PDF Suite – C# – Set link to page in pdf with pdf sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Suite – C# – Set link to page in pdf with pdf sdk

How to set link to page in pdf with pdf sdk in C# using ByteScout PDF Suite

Learning is essential in computer world and the tutorial below will demonstrate how to set link to page in pdf with pdf sdk in C#

We made thousands of pre-made source code pieces for easy implementation in your own programming projects. Want to set link to page in pdf with pdf sdk in your C# app? ByteScout PDF Suite is designed for it. ByteScout PDF Suite is the set that includes 6 SDK products to work with PDF from generating rich PDF reports to extracting data from PDF documents and converting them to HTML. This bundle includes PDF (Generator) SDK, PDF Renderer SDK, PDF Extractor SDK, PDF to HTML SDK, PDF Viewer SDK and PDF Generator SDK for Javascript.

This prolific sample source code in C# for ByteScout PDF Suite contains various functions and other necessary options you should do calling the API to set link to page in pdf with pdf sdk. Just copy and paste the code into your C# application’s code and follow the instructions. This basic programming language sample code for C# will do the whole work for you to set link to page in pdf with pdf sdk.

Trial version of ByteScout PDF Suite is available for free. Source code samples are included to help you with your C# app.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
using System.Diagnostics; using System.Drawing; using Bytescout.PDF; using Brush = Bytescout.PDF.Brush; using Font = Bytescout.PDF.Font; using SolidBrush = Bytescout.PDF.SolidBrush; using StringFormat = Bytescout.PDF.StringFormat; namespace LinkToPage { /// <summary> /// This example demonstrates how to create a navigation link to a page. /// </summary> class Program { static void Main() { // Create new document Document pdfDocument = new Document(); pdfDocument.RegistrationName = "demo"; pdfDocument.RegistrationKey = "demo"; // Add two pages Page page1 = new Page(PaperFormat.A4); pdfDocument.Pages.Add(page1); Page page2 = new Page(PaperFormat.A4); pdfDocument.Pages.Add(page2); Font font = new Font(StandardFonts.Times, 12); Brush brush = new SolidBrush(); // Create link annotation pointing to Page 2, 200 Points from the top. Destination destination = new Destination(page2, 200); LinkAnnotation link = new LinkAnnotation(destination, 20, 20, 100, 25); link.Color = new ColorRGB(255, 0, 0); // you can change the link color page1.Annotations.Add(link); // Draw link text (optional) page1.Canvas.DrawString("Link to Page 2", font, brush, new RectangleF(20, 20, 100, 25), new StringFormat {HorizontalAlign = HorizontalAlign.Center, VerticalAlign = VerticalAlign.Center}); // Draw a text at the link target page2.Canvas.DrawString("Link target", font, brush, 20, 200); // 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); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Suite Home Page

Explore ByteScout PDF Suite Documentation

Explore Samples

Sign Up for ByteScout PDF Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Suite Home Page

Explore ByteScout PDF Suite Documentation

Explore Samples

Sign Up for ByteScout PDF Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next