public static void Main(string[] args) { // The path to the documents directory. string dataDir = Path.GetFullPath("../../../Data/"); // Open document Document document = new Document(dataDir + "input.pdf"); // Create link Page page = document.Pages[1]; // Create Link annotation object Aspose.Pdf.InteractiveFeatures.Annotations.LinkAnnotation link = new Aspose.Pdf.InteractiveFeatures.Annotations.LinkAnnotation(page, new Aspose.Pdf.Rectangle(100, 100, 300, 300)); // Create border object for LinkAnnotation Aspose.Pdf.InteractiveFeatures.Annotations.Border border = new Aspose.Pdf.InteractiveFeatures.Annotations.Border(link); // Set the border width value as 0 border.Width = 0; // Set the border for LinkAnnotation link.Border = border; // Specify the link type as remote URI link.Action = new Aspose.Pdf.InteractiveFeatures.GoToURIAction("www.aspose.com"); // Add link annotation to annotations collection of first page of PDF file page.Annotations.Add(link); // Create Free Text annotation Aspose.Pdf.InteractiveFeatures.Annotations.FreeTextAnnotation textAnnotation = new Aspose.Pdf.InteractiveFeatures.Annotations.FreeTextAnnotation(document.Pages[1], new Aspose.Pdf.Rectangle(100, 100, 300, 300), new Aspose.Pdf.InteractiveFeatures.DefaultAppearance(Aspose.Pdf.Text.FontRepository.FindFont("TimesNewRoman"), 10, System.Drawing.Color.Blue)); // String to be added as Free text textAnnotation.Contents = "Link to Aspose website"; // Set the border for Free Text Annotation textAnnotation.Border = border; // Add FreeText annotation to annotations collection of first page of Document document.Pages[1].Annotations.Add(textAnnotation); // Save updated document document.Save(dataDir + "output.pdf"); }
public static void Main(string[] args) { // The path to the documents directory. string dataDir = Path.GetFullPath("../../../Data/"); // Open document Document document = new Document(dataDir+ "input.pdf"); // Create link Page page = document.Pages[1]; // Create Link annotation object Aspose.Pdf.InteractiveFeatures.Annotations.LinkAnnotation link = new Aspose.Pdf.InteractiveFeatures.Annotations.LinkAnnotation(page, new Aspose.Pdf.Rectangle(100, 100, 300, 300)); // Create border object for LinkAnnotation Aspose.Pdf.InteractiveFeatures.Annotations.Border border = new Aspose.Pdf.InteractiveFeatures.Annotations.Border(link); // Set the border width value as 0 border.Width = 0; // Set the border for LinkAnnotation link.Border = border; // Specify the link type as remote URI link.Action = new Aspose.Pdf.InteractiveFeatures.GoToURIAction("www.aspose.com"); // Add link annotation to annotations collection of first page of PDF file page.Annotations.Add(link); // Create Free Text annotation Aspose.Pdf.InteractiveFeatures.Annotations.FreeTextAnnotation textAnnotation = new Aspose.Pdf.InteractiveFeatures.Annotations.FreeTextAnnotation(document.Pages[1], new Aspose.Pdf.Rectangle(100, 100, 300, 300), new Aspose.Pdf.InteractiveFeatures.DefaultAppearance(Aspose.Pdf.Text.FontRepository.FindFont("TimesNewRoman"), 10, System.Drawing.Color.Blue)); // String to be added as Free text textAnnotation.Contents = "Link to Aspose website"; // Set the border for Free Text Annotation textAnnotation.Border = border; // Add FreeText annotation to annotations collection of first page of Document document.Pages[1].Annotations.Add(textAnnotation); // Save updated document document.Save(dataDir + "output.pdf"); }
private static TextBoxField CreateTextBoxField(Page page, string name) { var textBoxField = new TextBoxField(page, new Rectangle(100, 200, 300, 400)) { Name = name, PartialName = name, MappingName = name, AlternateName = name + 1 }; var border = new Aspose.Pdf.InteractiveFeatures.Annotations.Border(textBoxField) { Width = 5, Dash = new Aspose.Pdf.InteractiveFeatures.Annotations.Dash(1, 1) }; textBoxField.Border = border; textBoxField.Value = ""; return(textBoxField); }
private static TextBoxField CreateTextBoxField(Page page, string name) { var textBoxField = new TextBoxField(page, new Rectangle(100, 200, 300, 400)) { Name = name, PartialName = name, MappingName = name, AlternateName = name + 1 }; var border = new Aspose.Pdf.InteractiveFeatures.Annotations.Border(textBoxField) { Width = 5, Dash = new Aspose.Pdf.InteractiveFeatures.Annotations.Dash(1, 1) }; textBoxField.Border = border; textBoxField.Value = ""; return textBoxField; }