Exemplo n.º 1
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
        }
Exemplo n.º 2
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
        }
Exemplo n.º 3
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
        }