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

            // Instantiate Pdf instance by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Create a section in the Pdf document
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            // Create 1st graph in the section with width=100 and height=400
            Aspose.Pdf.Generator.Graph graph1 = new Aspose.Pdf.Generator.Graph(sec1, 100, 400);

            // Add 1st graph into the paragraphs collection of the section
            sec1.Paragraphs.Add(graph1);

            // Create a rectangle shape with specified coordinates
            Aspose.Pdf.Generator.Rectangle rect1 = new Aspose.Pdf.Generator.Rectangle(graph1, 85, 100, 100, 50);

            // Add the rectangle into the shapes collection of the 1st graph
            graph1.Shapes.Add(rect1);

            // Create 2nd graph in the section with width=100 and height=400
            Aspose.Pdf.Generator.Graph graph2 = new Aspose.Pdf.Generator.Graph(sec1, 100, 400);

            // Add 2nd graph into the paragraphs collection of the section
            sec1.Paragraphs.Add(graph2);

            // Create a rectangle shape with specified coordinates  
            Aspose.Pdf.Generator.Rectangle rect2 = new Aspose.Pdf.Generator.Rectangle(graph2, 85, 100, 100, 50);

            // Add the rectangle into the shapes collection of the 2nd graph
            graph2.Shapes.Add(rect2);

            // Rotate the 2nd graph to 30 degree using RotationAngle property
            graph2.GraphInfo.RotationAngle = 30;

            // Create 3rd graph in the section with width=100 and height=400                
            Aspose.Pdf.Generator.Graph graph3 = new Aspose.Pdf.Generator.Graph(sec1, 100, 400);

            // Add 3rd graph into the paragraphs collection of the section
            sec1.Paragraphs.Add(graph3);

            // Create a rectangle shape with specified coordinates
            Aspose.Pdf.Generator.Rectangle rect3 = new Aspose.Pdf.Generator.Rectangle(graph3, 85, 100, 100, 50);

            // Add the rectangle into the shapes collection of the 3rd graph
            graph3.Shapes.Add(rect3);

            // Adjust the horizontal size of the 3rd graph using ScalingRateX property
            graph3.GraphInfo.ScalingRateX = 1.5f;     

            dataDir = dataDir + "RotationAndScaling_out.pdf";

            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:RotationAndScaling         
        }
        public static void Run()
        {
            // ExStart:GraphCoordinate
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Graphs();

            // Instantiate a Pdf document object
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Add a section to the Pdf document
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            // Create a graph object in the section with Width=100 and Height=400
            Aspose.Pdf.Generator.Graph graph1 = new Aspose.Pdf.Generator.Graph(sec1,100,400);

            // Add the graph object to the paragraphs collection of the section
            sec1.Paragraphs.Add(graph1);

            // Create an array containing the (X,Y) values of 4 control points
            // Required to position a curve
            float[] posArr = new float[]{0,0,200,80,300,40,350,90};

            // Create a curve in the graph with the coordinates given as an array to
            // The constructor of curve class
            Aspose.Pdf.Generator.Curve curve1 = new Aspose.Pdf.Generator.Curve(graph1,posArr);

            // Add the curve shape into the shapes collection of the graph
            graph1.Shapes.Add(curve1);

            dataDir = dataDir + "GraphCoordinate_out.pdf";

            // Save the Pdf
            pdf1.Save(dataDir);   
            // ExEnd:GraphCoordinate         
        }
Beispiel #3
0
        public static void Run()
        {
            // ExStart:GraphCoordinate
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Graphs();

            // Instantiate a Pdf document object
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Add a section to the Pdf document
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            // Create a graph object in the section with Width=100 and Height=400
            Aspose.Pdf.Generator.Graph graph1 = new Aspose.Pdf.Generator.Graph(sec1, 100, 400);

            // Add the graph object to the paragraphs collection of the section
            sec1.Paragraphs.Add(graph1);

            // Create an array containing the (X,Y) values of 4 control points
            // required to position a curve
            float[] posArr = new float[] { 0, 0, 200, 80, 300, 40, 350, 90 };

            // Create a curve in the graph with the coordinates given as an array to
            // the constructor of curve class
            Aspose.Pdf.Generator.Curve curve1 = new Aspose.Pdf.Generator.Curve(graph1, posArr);

            // Add the curve shape into the shapes collection of the graph
            graph1.Shapes.Add(curve1);

            dataDir = dataDir + "GraphCoordinate_out_.pdf";

            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:GraphCoordinate
        }
Beispiel #4
0
        public static void Run()
        {
            // ExStart:RotationAndScaling
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Graphs();

            // Instantiate Pdf instance by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Create a section in the Pdf document
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            // Create 1st graph in the section with width=100 and height=400
            Aspose.Pdf.Generator.Graph graph1 = new Aspose.Pdf.Generator.Graph(sec1, 100, 400);

            // Add 1st graph into the paragraphs collection of the section
            sec1.Paragraphs.Add(graph1);

            // Create a rectangle shape with specified coordinates
            Aspose.Pdf.Generator.Rectangle rect1 = new Aspose.Pdf.Generator.Rectangle(graph1, 85, 100, 100, 50);

            // Add the rectangle into the shapes collection of the 1st graph
            graph1.Shapes.Add(rect1);

            // Create 2nd graph in the section with width=100 and height=400
            Aspose.Pdf.Generator.Graph graph2 = new Aspose.Pdf.Generator.Graph(sec1, 100, 400);

            // Add 2nd graph into the paragraphs collection of the section
            sec1.Paragraphs.Add(graph2);

            // Create a rectangle shape with specified coordinates
            Aspose.Pdf.Generator.Rectangle rect2 = new Aspose.Pdf.Generator.Rectangle(graph2, 85, 100, 100, 50);

            // Add the rectangle into the shapes collection of the 2nd graph
            graph2.Shapes.Add(rect2);

            // Rotate the 2nd graph to 30 degree using RotationAngle property
            graph2.GraphInfo.RotationAngle = 30;

            // Create 3rd graph in the section with width=100 and height=400
            Aspose.Pdf.Generator.Graph graph3 = new Aspose.Pdf.Generator.Graph(sec1, 100, 400);

            // Add 3rd graph into the paragraphs collection of the section
            sec1.Paragraphs.Add(graph3);

            // Create a rectangle shape with specified coordinates
            Aspose.Pdf.Generator.Rectangle rect3 = new Aspose.Pdf.Generator.Rectangle(graph3, 85, 100, 100, 50);

            // Add the rectangle into the shapes collection of the 3rd graph
            graph3.Shapes.Add(rect3);

            // Adjust the horizontal size of the 3rd graph using ScalingRateX property
            graph3.GraphInfo.ScalingRateX = 1.5f;

            dataDir = dataDir + "RotationAndScaling_out.pdf";

            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:RotationAndScaling
        }
Beispiel #5
0
        public static void ParagraphsCustomPositioning()
        {
            // ExStart:ParagraphsCustomPositioning
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_UtilityFeatures();

            // Instantiate the Pdf object
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Add a section to the Pdf object
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            // Create a text paragraph
            Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text("This is a text paragraph.");

            // Set the id of the paragraph to "text1" so that it can referenced uniquely
            text1.ID = "text1";

            // Add the paragraph to the section
            sec1.Paragraphs.Add(text1);

            // Create a graph with specified left and top position settings. Set its
            // poition relative to the page. Add a rectangle to its shapes collection and
            // then add the graph to the paragraph collection of the section
            Aspose.Pdf.Generator.Graph graph1 = new Aspose.Pdf.Generator.Graph(200, 50);
            graph1.Left            = 200;
            graph1.Top             = 10;
            graph1.PositioningType = Aspose.Pdf.Generator.PositioningType.PageRelative;
            graph1.Shapes.Add(new Aspose.Pdf.Generator.Rectangle(0, 0, 200, 50));
            sec1.Paragraphs.Add(graph1);

            // Create an attachment as note annotation and add it to the section as a
            // pragraph. Set the content and heading for the note. Set its position relative
            // to the paragraph. Assign a unique id to this note annotation for the
            // reference purposes and then customize its left and top position
            Aspose.Pdf.Generator.Attachment noteAttachment = new Aspose.Pdf.Generator.Attachment();
            sec1.Paragraphs.Add(noteAttachment);
            noteAttachment.AttachmentType       = Aspose.Pdf.Generator.AttachmentType.Note;
            noteAttachment.NoteContent          = "This is a test for note";
            noteAttachment.NoteHeading          = "this is a Note";
            noteAttachment.PositioningType      = Aspose.Pdf.Generator.PositioningType.ParagraphRelative;
            noteAttachment.ReferenceParagraphID = "text1";
            noteAttachment.Left = 200;
            noteAttachment.Top  = 0;

            dataDir = dataDir + "ParagraphsCustomPositioning_out_.pdf";
            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:ParagraphsCustomPositioning
        }
        public static void ParagraphsCustomPositioning()
        {
            // ExStart:ParagraphsCustomPositioning
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_UtilityFeatures();

            // Instantiate the Pdf object
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Add a section to the Pdf object
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            // Create a text paragraph
            Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text("This is a text paragraph.");

            // Set the id of the paragraph to "text1" so that it can referenced uniquely
            text1.ID = "text1";

            // Add the paragraph to the section
            sec1.Paragraphs.Add(text1);

            // Create a graph with specified left and top position settings. Set its
            // Poition relative to the page. Add a rectangle to its shapes collection and
            // Then add the graph to the paragraph collection of the section
            Aspose.Pdf.Generator.Graph graph1 = new Aspose.Pdf.Generator.Graph(200, 50);
            graph1.Left = 200;
            graph1.Top = 10;
            graph1.PositioningType = Aspose.Pdf.Generator.PositioningType.PageRelative;
            graph1.Shapes.Add(new Aspose.Pdf.Generator.Rectangle(0, 0, 200, 50));
            sec1.Paragraphs.Add(graph1);

            // Create an attachment as note annotation and add it to the section as a
            // Pragraph. Set the content and heading for the note. Set its position relative
            // To the paragraph. Assign a unique id to this note annotation for the
            // Reference purposes and then customize its left and top position
            Aspose.Pdf.Generator.Attachment noteAttachment = new Aspose.Pdf.Generator.Attachment();
            sec1.Paragraphs.Add(noteAttachment);
            noteAttachment.AttachmentType = Aspose.Pdf.Generator.AttachmentType.Note;
            noteAttachment.NoteContent = "This is a test for note";
            noteAttachment.NoteHeading = "this is a Note";
            noteAttachment.PositioningType = Aspose.Pdf.Generator.PositioningType.ParagraphRelative;
            noteAttachment.ReferenceParagraphID = "text1";
            noteAttachment.Left = 200;
            noteAttachment.Top = 0; 

            dataDir = dataDir + "ParagraphsCustomPositioning_out.pdf";
            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:ParagraphsCustomPositioning           
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Paragraphs();

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);

            if (!IsExists)
            {
                System.IO.Directory.CreateDirectory(dataDir);
            }


            //Instantiate Pdf object by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            //Add a new section to the Pdf object
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            //Instantiate a graph object, associate it with a section and pass the height
            // & width of the graph
            Aspose.Pdf.Generator.Graph g1 = new Aspose.Pdf.Generator.Graph(sec1, 100, 100);

            //Add a graph object to the paragraphs collection of the section
            sec1.Paragraphs.Add(g1);

            //Add a circle object to the shapes collection of graph object
            g1.Shapes.Add(new Aspose.Pdf.Generator.Circle(g1, 50, 50, 30));

            //Instantiate another Graph object, associate it with a section and pass the height
            // & width of the graph
            Aspose.Pdf.Generator.Graph g2 = new Aspose.Pdf.Generator.Graph(sec1, 100, 100);

            //Set the value of left margin
            g2.Margin.Left = 150;

            //Set the value of top margin and assign a negative value to it
            g2.Margin.Top = -100;

            //Add the paragraph object "g2" to paragraphs collection of the section
            sec1.Paragraphs.Add(g2);

            //Add a rectangle to the graph object (g2) in its shapes collection
            g2.Shapes.Add(new Aspose.Pdf.Generator.Rectangle(g2, 20, 20, 60, 60));

            // save the resultant PDF
            pdf1.Save(dataDir + "MergedOutput.pdf");
        }
Beispiel #8
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Paragraphs();

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);
            if (!IsExists)
                System.IO.Directory.CreateDirectory(dataDir);


            //Instantiate Pdf object by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            //Add a new section to the Pdf object
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            //Instantiate a graph object, associate it with a section and pass the height
            // & width of the graph
            Aspose.Pdf.Generator.Graph g1 = new Aspose.Pdf.Generator.Graph(sec1, 100, 100);

            //Add a graph object to the paragraphs collection of the section
            sec1.Paragraphs.Add(g1);

            //Add a circle object to the shapes collection of graph object
            g1.Shapes.Add(new Aspose.Pdf.Generator.Circle(g1, 50, 50, 30));

            //Instantiate another Graph object, associate it with a section and pass the height
            // & width of the graph
            Aspose.Pdf.Generator.Graph g2 = new Aspose.Pdf.Generator.Graph(sec1, 100, 100);

            //Set the value of left margin
            g2.Margin.Left = 150;

            //Set the value of top margin and assign a negative value to it
            g2.Margin.Top = -100;

            //Add the paragraph object "g2" to paragraphs collection of the section
            sec1.Paragraphs.Add(g2);

            //Add a rectangle to the graph object (g2) in its shapes collection
            g2.Shapes.Add(new Aspose.Pdf.Generator.Rectangle(g2, 20, 20, 60, 60));

            // save the resultant PDF
            pdf1.Save(dataDir+ "MergedOutput.pdf");
            
            
        }
Beispiel #9
0
        public static void Run()
        {
            // ExStart:SpecifyListItem
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_UtilityFeatures();

            // Instantiate Pdf instance by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Create a section in the Pdf document
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            // Add four headings in the section
            for (int Level = 1; Level != 5; Level++)
            {
                Aspose.Pdf.Generator.Heading heading2 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, Level);
                Aspose.Pdf.Generator.Segment segment2 = new Aspose.Pdf.Generator.Segment(heading2);
                heading2.Segments.Add(segment2);
                heading2.IsAutoSequence = true;
                segment2.Content        = "this is heading of level ";
                segment2.Content       += Level.ToString();

                // Add the heading into Table Of Contents.
                heading2.IsInList = true;
                sec1.Paragraphs.Add(heading2);
            }

            // Create a graph and add a curve shape to its shapes collection
            Aspose.Pdf.Generator.Graph graph1 = new Aspose.Pdf.Generator.Graph(sec1, 100, 400);
            sec1.Paragraphs.Add(graph1);
            float[] posArr = new float[] { 0, 0, 200, 80, 300, 40, 350, 90 };
            Aspose.Pdf.Generator.Curve curve1 = new Aspose.Pdf.Generator.Curve(graph1, posArr);
            graph1.Shapes.Add(curve1);

            // Add the Graph to the List of Figures
            graph1.IsInList = true;

            dataDir = dataDir + "SpecifyListItem_out_.pdf";
            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:SpecifyListItem
        }
        public static void Run()
        {
            // ExStart:SpecifyListItem
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_UtilityFeatures();

            // Instantiate Pdf instance by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Create a section in the Pdf document
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            // Add four headings in the section
            for (int Level = 1; Level != 5; Level++)
            {
                Aspose.Pdf.Generator.Heading heading2 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, Level);
                Aspose.Pdf.Generator.Segment segment2 = new Aspose.Pdf.Generator.Segment(heading2);
                heading2.Segments.Add(segment2);
                heading2.IsAutoSequence = true;
                segment2.Content = "this is heading of level ";
                segment2.Content += Level.ToString();

                // Add the heading into Table Of Contents. 
                heading2.IsInList = true;
                sec1.Paragraphs.Add(heading2);
            }

            // Create a graph and add a curve shape to its shapes collection
            Aspose.Pdf.Generator.Graph graph1 = new Aspose.Pdf.Generator.Graph(sec1, 100, 400);
            sec1.Paragraphs.Add(graph1);
            float[] posArr = new float[] { 0, 0, 200, 80, 300, 40, 350, 90 };
            Aspose.Pdf.Generator.Curve curve1 = new Aspose.Pdf.Generator.Curve(graph1, posArr);
            graph1.Shapes.Add(curve1);

            // Add the Graph to the List of Figures
            graph1.IsInList = true;

            dataDir = dataDir + "SpecifyListItem_out.pdf";
            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:SpecifyListItem           
        }
        public static void Run()
        {
            // ExStart:SetMargins
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Paragraphs();

            // Instantiate Pdf object by calling its empty constructor and add a new section to the Pdf object
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();        
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            // Instantiate a graph object, associate it with a section and pass the height & width of the graph         
            Aspose.Pdf.Generator.Graph g1 = new Aspose.Pdf.Generator.Graph(sec1, 100, 100);

            // Add a graph object to the paragraphs collection of the section
            sec1.Paragraphs.Add(g1);

            // Add a circle object to the shapes collection of graph object
            g1.Shapes.Add(new Aspose.Pdf.Generator.Circle(g1, 50, 50, 30));

            // Instantiate another Graph object, associate it with a section and pass the height & width of the graph           
            Aspose.Pdf.Generator.Graph g2 = new Aspose.Pdf.Generator.Graph(sec1, 100, 100);

            // Set left and top margin values
            g2.Margin.Left = 150;        
            g2.Margin.Top = -100;

            // Add the paragraph object "g2" to paragraphs collection of the section
            sec1.Paragraphs.Add(g2);

            // Add a rectangle to the graph object (g2) in its shapes collection
            g2.Shapes.Add(new Aspose.Pdf.Generator.Rectangle(g2, 20, 20, 60, 60));

            dataDir = dataDir + "SetMargins_out.pdf";
            // Save the resultant PDF
            pdf1.Save(dataDir);
            // ExEnd:SetMargins
            Console.WriteLine("\nParagraph margins setup successfully.\nFile saved at " + dataDir);
            
        }
Beispiel #12
0
        public static void Run()
        {
            // ExStart:SetMargins
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Paragraphs();

            // Instantiate Pdf object by calling its empty constructor and add a new section to the Pdf object
            Aspose.Pdf.Generator.Pdf     pdf1 = new Aspose.Pdf.Generator.Pdf();
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            // Instantiate a graph object, associate it with a section and pass the height & width of the graph
            Aspose.Pdf.Generator.Graph g1 = new Aspose.Pdf.Generator.Graph(sec1, 100, 100);

            // Add a graph object to the paragraphs collection of the section
            sec1.Paragraphs.Add(g1);

            // Add a circle object to the shapes collection of graph object
            g1.Shapes.Add(new Aspose.Pdf.Generator.Circle(g1, 50, 50, 30));

            // Instantiate another Graph object, associate it with a section and pass the height & width of the graph
            Aspose.Pdf.Generator.Graph g2 = new Aspose.Pdf.Generator.Graph(sec1, 100, 100);

            // Set left and top margin values
            g2.Margin.Left = 150;
            g2.Margin.Top  = -100;

            // Add the paragraph object "g2" to paragraphs collection of the section
            sec1.Paragraphs.Add(g2);

            // Add a rectangle to the graph object (g2) in its shapes collection
            g2.Shapes.Add(new Aspose.Pdf.Generator.Rectangle(g2, 20, 20, 60, 60));

            dataDir = dataDir + "SetMargins_out_.pdf";
            // Save the resultant PDF
            pdf1.Save(dataDir);
            // ExEnd:SetMargins
            Console.WriteLine("\nParagraph margins setup successfully.\nFile saved at " + dataDir);
        }
        public static void Run()
        {
            // ExStart:GraphFormat
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Graphs();

            // Instantiate Pdf document by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Create a section in the Pdf document
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            // Create a graph in the section with Width=100 and Height=400
            Aspose.Pdf.Generator.Graph graph1 = new Aspose.Pdf.Generator.Graph(sec1, 100, 400);

            // Add the graph object to paragraphs collection of the section
            sec1.Paragraphs.Add(graph1);

            // Create a circle shape in the graph with X=200, Y=50 and Radius=30
            Aspose.Pdf.Generator.Circle circle1 = new Aspose.Pdf.Generator.Circle(graph1, 200, 50, 30);

            // Add the circle in the shapes collection of the graph
            graph1.Shapes.Add(circle1);

            // Set fill color of the circle using GraphInfo property of circle object
            circle1.GraphInfo.FillColor = new Aspose.Pdf.Generator.Color("Green");

            // Enable the circle to be filled with the color specified above line
            circle1.GraphInfo.IsFilled = true;

            dataDir = dataDir + "GraphFormat_out.pdf";

            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:GraphFormat         
        }
Beispiel #14
0
        public static void Run()
        {
            // ExStart:GraphFormat
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Graphs();

            // Instantiate Pdf document by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Create a section in the Pdf document
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            // Create a graph in the section with Width=100 and Height=400
            Aspose.Pdf.Generator.Graph graph1 = new Aspose.Pdf.Generator.Graph(sec1, 100, 400);

            // Add the graph object to paragraphs collection of the section
            sec1.Paragraphs.Add(graph1);

            // Create a circle shape in the graph with X=200, Y=50 and Radius=30
            Aspose.Pdf.Generator.Circle circle1 = new Aspose.Pdf.Generator.Circle(graph1, 200, 50, 30);

            // Add the circle in the shapes collection of the graph
            graph1.Shapes.Add(circle1);

            // Set fill color of the circle using GraphInfo property of circle object
            circle1.GraphInfo.FillColor = new Aspose.Pdf.Generator.Color("Green");

            // Enable the circle to be filled with the color specified above line
            circle1.GraphInfo.IsFilled = true;

            dataDir = dataDir + "GraphFormat_out.pdf";

            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:GraphFormat
        }
        public static void Run()
        {
            // ExStart:CustomizingWatermark
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_UtilityFeatures();

            // Instantiate the Pdf object
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Add a section to the Pdf object
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text(sec1, "This is text in section1.");
            text1.Left = 30;
            text1.Top  = 100;
            sec1.Paragraphs.Add(text1);
            Aspose.Pdf.Generator.Section sec2  = pdf1.Sections.Add();
            Aspose.Pdf.Generator.Text    text2 = new Aspose.Pdf.Generator.Text(sec2, "This is text in section2.");
            text2.Left = 30;
            text2.Top  = 100;
            sec2.Paragraphs.Add(text2);


            // Setting image watermark
            Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image();
            image1.ImageInfo.File          = dataDir + "aspose-logo.jpg";
            image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Jpeg;
            image1.ImageScale = 0.1f;
            Aspose.Pdf.Generator.FloatingBox watermark1 = new Aspose.Pdf.Generator.FloatingBox(108, 80);
            watermark1.BoxHorizontalPositioning = Aspose.Pdf.Generator.BoxHorizontalPositioningType.Page;
            watermark1.BoxHorizontalAlignment   = Aspose.Pdf.Generator.BoxHorizontalAlignmentType.Center;
            watermark1.BoxVerticalPositioning   = Aspose.Pdf.Generator.BoxVerticalPositioningType.Page;
            watermark1.BoxVerticalAlignment     = Aspose.Pdf.Generator.BoxVerticalAlignmentType.Center;
            watermark1.Paragraphs.Add(image1);


            // Graph watermark
            Aspose.Pdf.Generator.Graph graph1 = new Aspose.Pdf.Generator.Graph(100, 400);
            float[] posArr = new float[] { 0, 0, 200, 80, 300, 40, 350, 90 };
            Aspose.Pdf.Generator.Curve curve1 = new Aspose.Pdf.Generator.Curve(graph1, posArr);
            graph1.Shapes.Add(curve1);
            Aspose.Pdf.Generator.FloatingBox watermark2 = new Aspose.Pdf.Generator.FloatingBox(108, 80);
            watermark2.Paragraphs.Add(graph1);


            // Text watermark
            Aspose.Pdf.Generator.Text        text3      = new Aspose.Pdf.Generator.Text("Text Watermark");
            Aspose.Pdf.Generator.FloatingBox watermark3 = new Aspose.Pdf.Generator.FloatingBox(108, 80);
            watermark3.Left = 50;
            watermark3.Top  = 500;
            watermark3.Paragraphs.Add(text3);


            pdf1.Watermarks.Add(watermark1);
            pdf1.Watermarks.Add(watermark2);
            pdf1.Watermarks.Add(watermark3);

            dataDir = dataDir + "CustomizingWatermark_out.pdf";
            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:CustomizingWatermark
        }
        public static void Run()
        {
            // ExStart:CustomizingWatermark
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_UtilityFeatures();

            // Instantiate the Pdf object
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Add a section to the Pdf object
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text(sec1, "This is text in section1.");
            text1.Left = 30;
            text1.Top = 100;
            sec1.Paragraphs.Add(text1);
            Aspose.Pdf.Generator.Section sec2 = pdf1.Sections.Add();
            Aspose.Pdf.Generator.Text text2 = new Aspose.Pdf.Generator.Text(sec2, "This is text in section2.");
            text2.Left = 30;
            text2.Top = 100;
            sec2.Paragraphs.Add(text2);


            // Setting image watermark
            Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image();
            image1.ImageInfo.File = dataDir + "aspose-logo.jpg";
            image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Jpeg;
            image1.ImageScale = 0.1f;
            Aspose.Pdf.Generator.FloatingBox watermark1 = new Aspose.Pdf.Generator.FloatingBox(108, 80);           
            watermark1.BoxHorizontalPositioning = Aspose.Pdf.Generator.BoxHorizontalPositioningType.Page;
            watermark1.BoxHorizontalAlignment = Aspose.Pdf.Generator.BoxHorizontalAlignmentType.Center;
            watermark1.BoxVerticalPositioning = Aspose.Pdf.Generator.BoxVerticalPositioningType.Page;
            watermark1.BoxVerticalAlignment = Aspose.Pdf.Generator.BoxVerticalAlignmentType.Center;
            watermark1.Paragraphs.Add(image1);


            // Graph watermark
            Aspose.Pdf.Generator.Graph graph1 = new Aspose.Pdf.Generator.Graph(100, 400);
            float[] posArr = new float[] { 0, 0, 200, 80, 300, 40, 350, 90 };
            Aspose.Pdf.Generator.Curve curve1 = new Aspose.Pdf.Generator.Curve(graph1, posArr);
            graph1.Shapes.Add(curve1);
            Aspose.Pdf.Generator.FloatingBox watermark2 = new Aspose.Pdf.Generator.FloatingBox(108, 80);
            watermark2.Paragraphs.Add(graph1);


            // Text watermark
            Aspose.Pdf.Generator.Text text3 = new Aspose.Pdf.Generator.Text("Text Watermark");
            Aspose.Pdf.Generator.FloatingBox watermark3 = new Aspose.Pdf.Generator.FloatingBox(108, 80);
            watermark3.Left = 50;
            watermark3.Top = 500;
            watermark3.Paragraphs.Add(text3);


            pdf1.Watermarks.Add(watermark1);
            pdf1.Watermarks.Add(watermark2);
            pdf1.Watermarks.Add(watermark3);

            dataDir = dataDir + "CustomizingWatermark_out.pdf";
            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:CustomizingWatermark           
        }