ByteScout simple and easy to understand tutorials are planned to describe the code for both C# beginners and advanced programmers. ByteScout Premium Suite can set link to page in pdf with pdf sdk. It can be applied from C#. ByteScout Premium Suite is the set that includes 12 SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording.
Want to save time? You will save a lot of time on writing and testing code as you may just take the C# code from ByteScout Premium Suite for set link to page in pdf with pdf sdk below and use it in your application. This C# sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Enjoy writing a code with ready-to-use sample C# codes.
If you want to try other source code samples then the free trial version of ByteScout Premium Suite is available for download from our website. Just try other 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 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); } } }
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: