/// <summary> /// Adds arrow annotation in PDF document /// </summary> public static void AddArrowAnnotation() { try { //ExStart:AddArrowAnnotation // Get input file stream Stream inputFile = new FileStream(CommonUtilities.MapSourceFilePath(CommonUtilities.filePath), FileMode.Open, FileAccess.ReadWrite); // Initialize list of AnnotationInfo List <AnnotationInfo> annotations = new List <AnnotationInfo>(); // Arrow annotation AnnotationInfo arrowAnnotation = new AnnotationInfo { AnnotationPosition = new Point(852.0, 252.0), Box = new Rectangle(279.4742f, 252.9241f, 129.9555f, -9.781596f), PageNumber = 0, PenColor = 1201033, PenStyle = 0, PenWidth = 1, SvgPath = "M279.47417840375584,252.92413145539905 L129.9554929577465,-9.781596244131455", Type = AnnotationType.Arrow, CreatorName = "Anonym A." }; // Add annotation to list annotations.Add(arrowAnnotation); // Export annotation and save output file CommonUtilities.SaveOutputDocument(inputFile, annotations, DocumentType.Pdf); //ExEnd:AddArrowAnnotation } catch (System.Exception exp) { Console.WriteLine(exp.Message); } }
/// <summary> /// Adds watermark annotation in PDF document /// </summary> public static void AddWatermarkAnnotation() { try { //ExStart:AddWatermarkAnnotation // Get input file stream Stream inputFile = new FileStream(CommonUtilities.MapSourceFilePath(CommonUtilities.filePath), FileMode.Open, FileAccess.ReadWrite); // Initialize list of AnnotationInfo List <AnnotationInfo> annotations = new List <AnnotationInfo>(); // Watermark annotation AnnotationInfo watermarkAnnotation = new AnnotationInfo { AnnotationPosition = new Point(100.0, 300.0), FieldText = "TEXT STAMP", FontFamily = "Microsoft Sans Serif", FontSize = 10, FontColor = 2222222, Box = new Rectangle(430f, 272f, 66f, 51f), PageNumber = 0, Type = AnnotationType.Watermark, CreatorName = "Anonym A." }; // Add annotation to list annotations.Add(watermarkAnnotation); // Export annotation and save output file CommonUtilities.SaveOutputDocument(inputFile, annotations, DocumentType.Pdf); //ExEnd:AddWatermarkAnnotation } catch (System.Exception exp) { Console.WriteLine(exp.Message); } }