public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Annotations();

            //open document
            Document pdfDocument = new Document(dataDir + "SetFreeTextAnnotationFormatting.pdf");
            
            // instantiate DefaultAppearance object
            Aspose.Pdf.InteractiveFeatures.DefaultAppearance default_appearance = new DefaultAppearance("Arial", 28, System.Drawing.Color.Red);
            
            //create annotation
            FreeTextAnnotation freetext = new FreeTextAnnotation(pdfDocument.Pages[1], new Aspose.Pdf.Rectangle(200, 400, 400, 600), default_appearance);
            
            // specify the contents of annotation
            freetext.Contents = "Free Text";
            
            // add anootation to annotations collection of page
            pdfDocument.Pages[1].Annotations.Add(freetext);
            
            // save the updated document
            pdfDocument.Save(dataDir + "SetFreeTextAnnotationFormatting_out.pdf");

            
        }
Example #2
0
        /// <summary>
        /// This feature is supported by version 19.6 or greater
        /// </summary>
        public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Annotations();

            Document          doc  = new Document();
            Page              page = doc.Pages.Add();
            DefaultAppearance da   = new DefaultAppearance();

            da.TextColor = System.Drawing.Color.Red;
            da.FontSize  = 10;
            FreeTextAnnotation fta = new FreeTextAnnotation(page, new Rectangle(422.25, 645.75, 583.5, 702.75), da);

            fta.Intent      = FreeTextIntent.FreeTextCallout;
            fta.EndingStyle = LineEnding.OpenArrow;
            fta.Callout     = new Point[]
            {
                new Point(428.25, 651.75), new Point(462.75, 681.375), new Point(474, 681.375)
            };
            page.Annotations.Add(fta);
            fta.RichText = "<body xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:xfa=\"http://www.xfa.org/schema/xfa-data/1.0/\" xfa:APIVersion=\"Acrobat:11.0.23\" xfa:spec=\"2.0.2\"  style=\"color:#FF0000;font-weight:normal;font-style:normal;font-stretch:normal\"><p dir=\"ltr\"><span style=\"font-size:9.0pt;font-family:Helvetica\">This is a sample</span></p></body>";
            doc.Save(dataDir + "SetCalloutProperty.pdf");

            // ExEnd:1
        }
        public static void Run()
        {
            // ExStart:AddDateTimeStamp
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_StampsWatermarks();

            // Open document
            Document pdfDocument    = new Document(dataDir + "AddTextStamp.pdf");
            string   annotationText = string.Empty;

            annotationText = DateTime.Now.ToString("MM/dd/yy hh:mm:ss tt ");
            // Create text stamp
            TextStamp textStamp = new TextStamp(annotationText);

            // Set properties of the stamp
            textStamp.BottomMargin        = 10;
            textStamp.RightMargin         = 20;
            textStamp.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Right;
            textStamp.VerticalAlignment   = VerticalAlignment.Bottom;
            // Adding stamp on stamp collection
            pdfDocument.Pages[1].AddStamp(textStamp);

            DefaultAppearance default_appearance = new DefaultAppearance("Arial", 6, System.Drawing.Color.Black);

            FreeTextAnnotation textAnnotation = new FreeTextAnnotation(pdfDocument.Pages[1], new Aspose.Pdf.Rectangle(0, 0, 0, 0), default_appearance);

            textAnnotation.Name = "Stamp";
            textAnnotation.Accept(new AnnotationSelector(textAnnotation));

            textAnnotation.Contents = textStamp.Value;
            // TextAnnotation.Open = true;
            // TextAnnotation.Icon = Aspose.Pdf.InteractiveFeatures.Annotations.TextIcon.Key;
            Border border = new Border(textAnnotation);

            border.Width          = 0;
            border.Dash           = new Dash(1, 1);
            textAnnotation.Border = border;
            textAnnotation.Rect   = new Aspose.Pdf.Rectangle(0, 0, 0, 0);
            pdfDocument.Pages[1].Annotations.Add(textAnnotation);

            dataDir = dataDir + "AddDateTimeStamp_out.pdf";
            // Save output document
            pdfDocument.Save(dataDir);
            // ExEnd:AddDateTimeStamp
            Console.WriteLine("\nDate time stamp added successfully.\nFile saved at " + dataDir);
        }
        public static void Run()
        {
            // ExStart:AddDateTimeStamp
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_StampsWatermarks();

            // Open document
            Document pdfDocument = new Document(dataDir+ "AddTextStamp.pdf");
            string annotationText = string.Empty;

            annotationText = DateTime.Now.ToString("MM/dd/yy hh:mm:ss tt ");
            // Create text stamp
            TextStamp textStamp = new TextStamp(annotationText);
            // Set properties of the stamp
            textStamp.BottomMargin = 10;
            textStamp.RightMargin = 20;
            textStamp.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Right;
            textStamp.VerticalAlignment = VerticalAlignment.Bottom;
            // Adding stamp on stamp collection
            pdfDocument.Pages[1].AddStamp(textStamp);

            DefaultAppearance default_appearance = new DefaultAppearance("Arial", 6, System.Drawing.Color.Black);

            FreeTextAnnotation textAnnotation = new FreeTextAnnotation(pdfDocument.Pages[1], new Aspose.Pdf.Rectangle(0, 0, 0, 0), default_appearance);
            textAnnotation.Name = "Stamp";
            textAnnotation.Accept(new AnnotationSelector(textAnnotation));

            textAnnotation.Contents = textStamp.Value;
            // TextAnnotation.Open = true;
            // TextAnnotation.Icon = Aspose.Pdf.InteractiveFeatures.Annotations.TextIcon.Key;
            Border border = new Border(textAnnotation);
            border.Width = 0;
            border.Dash = new Dash(1, 1);
            textAnnotation.Border = border;
            textAnnotation.Rect = new Aspose.Pdf.Rectangle(0, 0, 0, 0);
            pdfDocument.Pages[1].Annotations.Add(textAnnotation);

            dataDir = dataDir + "AddDateTimeStamp_out.pdf";
            // Save output document
            pdfDocument.Save(dataDir);
            // ExEnd:AddDateTimeStamp
            Console.WriteLine("\nDate time stamp added successfully.\nFile saved at " + dataDir);            
            
        }
Example #5
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Annotations();

            //open document
            Document pdfDocument = new Document(dataDir + "SetFreeTextAnnotationFormatting.pdf");

            // instantiate DefaultAppearance object
            Aspose.Pdf.InteractiveFeatures.DefaultAppearance default_appearance = new DefaultAppearance("Arial", 28, System.Drawing.Color.Red);

            //create annotation
            FreeTextAnnotation freetext = new FreeTextAnnotation(pdfDocument.Pages[1], new Aspose.Pdf.Rectangle(200, 400, 400, 600), default_appearance);

            // specify the contents of annotation
            freetext.Contents = "Free Text";

            // add anootation to annotations collection of page
            pdfDocument.Pages[1].Annotations.Add(freetext);

            // save the updated document
            pdfDocument.Save(dataDir + "SetFreeTextAnnotationFormatting_out.pdf");
        }
        public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            //open document
            Document pdfDocument = new Document(dataDir + "input.pdf");

            // instantiate DefaultAppearance object
            Aspose.Pdf.InteractiveFeatures.DefaultAppearance default_appearance = new DefaultAppearance("Arial", 28, System.Drawing.Color.Red);

            //create annotation
            FreeTextAnnotation freetext = new FreeTextAnnotation(pdfDocument.Pages[1], new Aspose.Pdf.Rectangle(200, 400, 400, 600), default_appearance);

            // specify the contents of annotation
            freetext.Contents = "Free Text";

            // add anootation to annotations collection of page
            pdfDocument.Pages[1].Annotations.Add(freetext);

            // save the updated document
            pdfDocument.Save(dataDir + "output.pdf");
        }
        public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            //open document
            Document pdfDocument = new Document(dataDir + "input.pdf");

            // instantiate DefaultAppearance object
            Aspose.Pdf.InteractiveFeatures.DefaultAppearance default_appearance = new DefaultAppearance("Arial", 28, System.Drawing.Color.Red);

            //create annotation
            FreeTextAnnotation freetext = new FreeTextAnnotation(pdfDocument.Pages[1], new Aspose.Pdf.Rectangle(200, 400, 400, 600), default_appearance);

            // specify the contents of annotation
            freetext.Contents = "Free Text";

            // add anootation to annotations collection of page
            pdfDocument.Pages[1].Annotations.Add(freetext);

            // save the updated document
            pdfDocument.Save(dataDir + "output.pdf");
        }
Example #8
0
        public static void Run()
        {
            // ExStart:SetFreeTextAnnotationFormatting
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Annotations();

            // Open document
            Document pdfDocument = new Document(dataDir + "SetFreeTextAnnotationFormatting.pdf");

            // Instantiate DefaultAppearance object
            DefaultAppearance default_appearance = new DefaultAppearance("Arial", 28, System.Drawing.Color.Red);
            // Create annotation
            FreeTextAnnotation freetext = new FreeTextAnnotation(pdfDocument.Pages[1], new Aspose.Pdf.Rectangle(200, 400, 400, 600), default_appearance);

            // Specify the contents of annotation
            freetext.Contents = "Free Text";
            // Add anootation to annotations collection of page
            pdfDocument.Pages[1].Annotations.Add(freetext);
            dataDir = dataDir + "SetFreeTextAnnotationFormatting_out.pdf";
            // Save the updated document
            pdfDocument.Save(dataDir);
            // ExEnd:SetFreeTextAnnotationFormatting
            Console.WriteLine("\nFree TextAnnotation with specific text formatting added successfully.\nFile saved at " + dataDir);
        }
        public static void Run()
        {
            // ExStart:SetFreeTextAnnotationFormatting
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Annotations();
            
            // Open document
            Document pdfDocument = new Document(dataDir + "SetFreeTextAnnotationFormatting.pdf");

            // Instantiate DefaultAppearance object
            DefaultAppearance default_appearance = new DefaultAppearance("Arial", 28, System.Drawing.Color.Red);
            // Create annotation
            FreeTextAnnotation freetext = new FreeTextAnnotation(pdfDocument.Pages[1], new Aspose.Pdf.Rectangle(200, 400, 400, 600), default_appearance);
            // Specify the contents of annotation
            freetext.Contents = "Free Text";
            // Add anootation to annotations collection of page
            pdfDocument.Pages[1].Annotations.Add(freetext);
            dataDir = dataDir + "SetFreeTextAnnotationFormatting_out.pdf";
            // Save the updated document
            pdfDocument.Save(dataDir);
            // ExEnd:SetFreeTextAnnotationFormatting
            Console.WriteLine("\nFree TextAnnotation with specific text formatting added successfully.\nFile saved at " + dataDir);
            
        }