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 }
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 }
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: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 }