public static void Run() { // ExStart:AddlnkAnnotation // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Annotations(); Document doc = new Document(); Page pdfPage = doc.Pages.Add(); System.Drawing.Rectangle drect = new System.Drawing.Rectangle(); drect.Height = (int)pdfPage.Rect.Height; drect.Width = (int)pdfPage.Rect.Width; drect.X = 0; drect.Y = 0; Aspose.Pdf.Rectangle arect = Aspose.Pdf.Rectangle.FromRect(drect); ArrayList inkList = new ArrayList(); Aspose.Pdf.Point[] arrpt = new Aspose.Pdf.Point[3]; inkList.Add(arrpt); arrpt[0] = new Aspose.Pdf.Point(100, 800); arrpt[1] = new Aspose.Pdf.Point(200, 800); arrpt[2] = new Aspose.Pdf.Point(200, 700); InkAnnotation ia = new InkAnnotation(pdfPage, arect, inkList); ia.Title = "XXX"; ia.Color = Aspose.Pdf.Color.LightBlue; // (GetColorFromString(stroke.InkColor)); ia.CapStyle = CapStyle.Rounded; Border border = new Border(ia); border.Width = 25; ia.Opacity = 0.5; pdfPage.Annotations.Add(ia); dataDir = dataDir + "AddlnkAnnotation_out.pdf"; // Save output file doc.Save(dataDir); // ExEnd:AddlnkAnnotation Console.WriteLine("\nlnk annotation added successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:lnkAnnotationLineWidth // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Annotations(); Document doc = new Document(); doc.Pages.Add(); IList <Point[]> inkList = new List <Point[]>(); LineInfo lineInfo = new LineInfo(); lineInfo.VerticeCoordinate = new float[] { 55, 55, 70, 70, 70, 90, 150, 60 }; lineInfo.Visibility = true; lineInfo.LineColor = System.Drawing.Color.Red; lineInfo.LineWidth = 2; int length = lineInfo.VerticeCoordinate.Length / 2; Aspose.Pdf.Point[] gesture = new Aspose.Pdf.Point[length]; for (int i = 0; i < length; i++) { gesture[i] = new Aspose.Pdf.Point(lineInfo.VerticeCoordinate[2 * i], lineInfo.VerticeCoordinate[2 * i + 1]); } inkList.Add(gesture); InkAnnotation a1 = new InkAnnotation(doc.Pages[1], new Aspose.Pdf.Rectangle(100, 100, 300, 300), inkList); a1.Subject = "Test"; a1.Title = "Title"; a1.Color = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Green); Border border = new Border(a1); border.Width = 3; border.Effect = BorderEffect.Cloudy; border.Dash = new Dash(1, 1); border.Style = BorderStyle.Solid; doc.Pages[1].Annotations.Add(a1); dataDir = dataDir + "lnkAnnotationLineWidth_out.pdf"; // Save output file doc.Save(dataDir); // ExEnd:lnkAnnotationLineWidth Console.WriteLine("\nlnk annotation line width setup successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:AddlnkAnnotation // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Annotations(); Document doc = new Document(); Page pdfPage = doc.Pages.Add(); System.Drawing.Rectangle drect = new System.Drawing.Rectangle(); drect.Height = (int)pdfPage.Rect.Height; drect.Width = (int)pdfPage.Rect.Width; drect.X = 0; drect.Y = 0; Aspose.Pdf.Rectangle arect = Aspose.Pdf.Rectangle.FromRect(drect); IList <Point[]> inkList = new List <Point[]>(); Aspose.Pdf.Point[] arrpt = new Aspose.Pdf.Point[3]; inkList.Add(arrpt); arrpt[0] = new Aspose.Pdf.Point(100, 800); arrpt[1] = new Aspose.Pdf.Point(200, 800); arrpt[2] = new Aspose.Pdf.Point(200, 700); InkAnnotation ia = new InkAnnotation(pdfPage, arect, inkList); ia.Title = "XXX"; ia.Color = Aspose.Pdf.Color.LightBlue; // (GetColorFromString(stroke.InkColor)); ia.CapStyle = CapStyle.Rounded; Border border = new Border(ia); border.Width = 25; ia.Opacity = 0.5; pdfPage.Annotations.Add(ia); dataDir = dataDir + "AddlnkAnnotation_out.pdf"; // Save output file doc.Save(dataDir); // ExEnd:AddlnkAnnotation Console.WriteLine("\nlnk annotation added successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:lnkAnnotationLineWidth // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Annotations(); Document doc = new Document(); doc.Pages.Add(); ArrayList inkList = new ArrayList(); LineInfo lineInfo = new LineInfo(); lineInfo.VerticeCoordinate = new float[] { 55, 55, 70, 70, 70, 90, 150, 60 }; lineInfo.Visibility = true; lineInfo.LineColor = System.Drawing.Color.Red; lineInfo.LineWidth = 2; int length = lineInfo.VerticeCoordinate.Length / 2; Aspose.Pdf.Point[] gesture = new Aspose.Pdf.Point[length]; for (int i = 0; i < length; i++) { gesture[i] = new Aspose.Pdf.Point(lineInfo.VerticeCoordinate[2 * i], lineInfo.VerticeCoordinate[2 * i + 1]); } inkList.Add(gesture); InkAnnotation a1 = new InkAnnotation(doc.Pages[1], new Aspose.Pdf.Rectangle(100, 100, 300, 300), inkList); a1.Subject = "Test"; a1.Title = "Title"; a1.Color = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Green); Border border = new Border(a1); border.Width = 3; border.Effect = BorderEffect.Cloudy; border.Dash = new Dash(1, 1); border.Style = BorderStyle.Solid; doc.Pages[1].Annotations.Add(a1); dataDir = dataDir + "lnkAnnotationLineWidth_out.pdf"; // Save output file doc.Save(dataDir); // ExEnd:lnkAnnotationLineWidth Console.WriteLine("\nlnk annotation line width setup successfully.\nFile saved at " + dataDir); }