XDoc.PDF
Features
Tech Specs
How-to C#
How-to VB.NET
Pricing
C# PDF: How to HTML5 Viewer & Editor PDF Create PDF Export File and Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print WPF Viewer & Editor Work with Other SDKs Barcode Read Barcode Create OCR Twain
Link: Edit URL
  |  
Home ›› XDoc.PDF ›› C# PDF: Edit Hyperlink (url)

C#.NET PDF SDK - Edit PDF Hyperlink (url) in C#.NET


Guide C# Programmers to Insert a Hyperlink to Specified PDF Document Page in C# Using .NET PDF DLLs




A professional XDoc.PDF SDK for C# .NET project, able to edit hyperlink in adobePDF document


.NET components and library provide various PDF link edit functionalities in both Visual C# .NET WinForms and ASP.NET application


Free online C# class source code for editing PDF hyperlink in Visual Studio .NET framework project


Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint


Empower to create clickable and active html links in .NET WinForms


Able to insert and delete PDF links


Able to embed link to specific PDF pages


Easy to put link into specified position of PDF text, image and PDF table


Link access to variety of objects, such as website, image, document, bookmark, PDF page number, flash, etc


Keep Microsoft Office Word, Excel and PowerPoint links in PDF document


Make PDF link open in a new window or tab


Enable users to copy and paste PDF link


Help to extract and search url in PDF file



RasterEdge PDF SDK for .NET offers C# users a variety of PDF file editing options, like options for editing PDF document hyperlink and navigation links. By using specific PDF editing APIs, C# users will be able to add and edit hyperlinks within the document with extreme ease. This online C# tutorial is mainly about how to edit PDF hyperlink by inserting and adding link to PDF document.




C#.NET Demo Code: Insert Hyperlink to PDF in C#.NET



Add necessary references:


  RasterEdge.Imaging.Basic.dll


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XImage.Raster.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XDoc.PDF.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.PDF;


Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:

       

       If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.

       

       If using x86, the platform target should be x86.


After integrating XDoc.PDF for .NET SDK to Visual Studio C# project, you may use the following programming demo to add a hyperlink to input PDF document.




// Define input and output documents.
String inputFilePath = Program.RootPath + "\\" + "1.pdf";
String outputFilePath = Program.RootPath + "\\" + "Output.pdf";

// Open a PDF file.
PDFDocument doc = new PDFDocument(inputFilePath);

// Get the 1st page.
PDFPage page = (PDFPage)doc.GetPage(0);

// Set a rectangle area starting from Point (0, 0) with width 400, height 200 pixels (in 96 dpi).
RectangleF linkAnnotBoundary = new RectangleF(0, 0, 400, 200);

// Set URL value.
String uri = @"http://www.google.com";

// Create the annotation.
PDFAnnotLink annot = new PDFAnnotLink();
annot.SetBoundary(linkAnnotBoundary);
annot.Uri = uri;

// Add annotation to the page.
page.AddPDFAnnot(annot);

// Save to a new file.
doc.Save(outputFilePath);