public static void Run() { // ExStart:AddLineObject // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Graphs(); // Create Document instance Document doc = new Document(); // Add page to pages collection of PDF file Page page = doc.Pages.Add(); // Create Graph instance Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph(100, 400); // Add graph object to paragraphs collection of page instance page.Paragraphs.Add(graph); // Create Rectangle instance Aspose.Pdf.Drawing.Line line = new Aspose.Pdf.Drawing.Line(new float[] { 100, 100, 200, 100 }); // Specify fill color for Graph object line.GraphInfo.DashArray = new int[] { 0, 1, 0 }; line.GraphInfo.DashPhase = 1; // Add rectangle object to shapes collection of Graph object graph.Shapes.Add(line); dataDir = dataDir + "AddLineObject_out.pdf"; // Save PDF file doc.Save(dataDir); // ExEnd:AddLineObject Console.WriteLine("\nLine object added successfully to pdf.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:DashLength // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Graphs(); // Instantiate Document instance Document doc = new Document(); // Add page to pages collection of Document object Page page = doc.Pages.Add(); // Create Drawing object with certain dimensions Aspose.Pdf.Drawing.Graph canvas = new Aspose.Pdf.Drawing.Graph(100, 400); // Add drawing object to paragraphs collection of page instance page.Paragraphs.Add(canvas); // Create Line object Aspose.Pdf.Drawing.Line line = new Aspose.Pdf.Drawing.Line(new float[] { 100, 100, 200, 100 }); // Set color for Line object line.GraphInfo.Color = Aspose.Pdf.Color.Red; // Specify dash array for line object line.GraphInfo.DashArray = new int[] { 0, 1, 0 }; // Set the dash phase for Line instance line.GraphInfo.DashPhase = 1; // Add line to shapes collection of drawing object canvas.Shapes.Add(line); dataDir = dataDir + "DashLength_out_.pdf"; // Save PDF document doc.Save(dataDir); // ExEnd:DashLength Console.WriteLine("\nLength dashed successfully in black and white.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:AddLineObject // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Graphs(); // Create Document instance Document doc = new Document(); // Add page to pages collection of PDF file Page page = doc.Pages.Add(); // Create Graph instance Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph(100, 400); // Add graph object to paragraphs collection of page instance page.Paragraphs.Add(graph); // Create Rectangle instance Aspose.Pdf.Drawing.Line line = new Aspose.Pdf.Drawing.Line(new float[] { 100, 100, 200, 100 }); // Specify fill color for Graph object line.GraphInfo.DashArray = new int[] { 0, 1, 0 }; line.GraphInfo.DashPhase = 1; // Add rectangle object to shapes collection of Graph object graph.Shapes.Add(line); dataDir = dataDir + "AddLineObject_out_.pdf"; // Save PDF file doc.Save(dataDir); // ExEnd:AddLineObject Console.WriteLine("\nLine object added successfully to pdf.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:DashLength // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Graphs(); // Instantiate Document instance Document doc = new Document(); // Add page to pages collection of Document object Page page = doc.Pages.Add(); // Create Drawing object with certain dimensions Aspose.Pdf.Drawing.Graph canvas = new Aspose.Pdf.Drawing.Graph(100, 400); // Add drawing object to paragraphs collection of page instance page.Paragraphs.Add(canvas); // Create Line object Aspose.Pdf.Drawing.Line line = new Aspose.Pdf.Drawing.Line(new float[] { 100, 100, 200, 100 }); // Set color for Line object line.GraphInfo.Color = Aspose.Pdf.Color.Red; // Specify dash array for line object line.GraphInfo.DashArray = new int[] { 0, 1, 0 }; // Set the dash phase for Line instance line.GraphInfo.DashPhase = 1; // Add line to shapes collection of drawing object canvas.Shapes.Add(line); dataDir = dataDir + "DashLength_out.pdf"; // Save PDF document doc.Save(dataDir); // ExEnd:DashLength Console.WriteLine("\nLength dashed successfully in black and white.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:DrawingLine // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Graphs(); // Create Document instance Document pDoc = new Document(); // Add page to pages collection of PDF document Page pg = pDoc.Pages.Add(); // Set page margin on all sides as 0 pg.PageInfo.Margin.Left = pg.PageInfo.Margin.Right = pg.PageInfo.Margin.Bottom = pg.PageInfo.Margin.Top = 0; // Create Graph object with Width and Height equal to page dimensions Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph((float)pg.PageInfo.Width, (float)pg.PageInfo.Height); // Create first line object starting from Lower-Left to Top-Right corner of page Aspose.Pdf.Drawing.Line line = new Aspose.Pdf.Drawing.Line(new float[] { (float)pg.Rect.LLX, 0, (float)pg.PageInfo.Width, (float)pg.Rect.URY }); // Add line to shapes collection of Graph object graph.Shapes.Add(line); // Draw line from Top-Left corner of page to Bottom-Right corner of page Aspose.Pdf.Drawing.Line line2 = new Aspose.Pdf.Drawing.Line(new float[] { 0, (float)pg.Rect.URY, (float)pg.PageInfo.Width, (float)pg.Rect.LLX }); // Add line to shapes collection of Graph object graph.Shapes.Add(line2); // Add Graph object to paragraphs collection of page pg.Paragraphs.Add(graph); dataDir = dataDir + "DrawingLine_out.pdf"; // Save PDF file pDoc.Save(dataDir); // ExEnd:DrawingLine Console.WriteLine("\nLine drawn successfully across the page.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:DrawingLine // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Graphs(); // Create Document instance Document pDoc = new Document(); // Add page to pages collection of PDF document Page pg = pDoc.Pages.Add(); // Set page margin on all sides as 0 pg.PageInfo.Margin.Left = pg.PageInfo.Margin.Right = pg.PageInfo.Margin.Bottom = pg.PageInfo.Margin.Top = 0; // Create Graph object with Width and Height equal to page dimensions Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph((float)pg.PageInfo.Width , (float)pg.PageInfo.Height); // Create first line object starting from Lower-Left to Top-Right corner of page Aspose.Pdf.Drawing.Line line = new Aspose.Pdf.Drawing.Line(new float[] { (float)pg.Rect.LLX, 0, (float)pg.PageInfo.Width, (float)pg.Rect.URY }); // Add line to shapes collection of Graph object graph.Shapes.Add(line); // Draw line from Top-Left corner of page to Bottom-Right corner of page Aspose.Pdf.Drawing.Line line2 = new Aspose.Pdf.Drawing.Line(new float[] { 0, (float)pg.Rect.URY, (float)pg.PageInfo.Width, (float)pg.Rect.LLX }); // Add line to shapes collection of Graph object graph.Shapes.Add(line2); // Add Graph object to paragraphs collection of page pg.Paragraphs.Add(graph); dataDir = dataDir + "DrawingLine_out.pdf"; // Save PDF file pDoc.Save(dataDir); // ExEnd:DrawingLine Console.WriteLine("\nLine drawn successfully across the page.\nFile saved at " + dataDir); }
public static void Graph3(Page pdfPage) { pdfPage.PageInfo.Margin.Left = pdfPage.PageInfo.Margin.Right = pdfPage.PageInfo.Margin.Bottom = pdfPage.PageInfo.Margin.Top = 0; // Create Graph object with Width and Height equal to page dimensions Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph((float)pdfPage.PageInfo.Width, (float)pdfPage.PageInfo.Height); // Create first line object starting from Lower-Left to Top-Right corner of page Aspose.Pdf.Drawing.Line line = new Aspose.Pdf.Drawing.Line(new float[] { (float)pdfPage.Rect.LLX, 0, (float)pdfPage.PageInfo.Width, (float)pdfPage.Rect.URY }); // Add line to shapes collection of Graph object graph.Shapes.Add(line); // Draw line from Top-Left corner of page to Bottom-Right corner of page Aspose.Pdf.Drawing.Line line2 = new Aspose.Pdf.Drawing.Line(new float[] { 0, (float)pdfPage.Rect.URY, (float)pdfPage.PageInfo.Width, (float)pdfPage.Rect.LLX }); // Add line to shapes collection of Graph object graph.Shapes.Add(line2); // Add Graph object to paragraphs collection of page pdfPage.Paragraphs.Add(graph); }
public static void Run() { // ExStart:CreateMultiColumnPdf // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Text(); Document doc = new Document(); // Specify the left margin info for the PDF file doc.PageInfo.Margin.Left = 40; // Specify the Right margin info for the PDF file doc.PageInfo.Margin.Right = 40; Page page = doc.Pages.Add(); Aspose.Pdf.Drawing.Graph graph1 = new Aspose.Pdf.Drawing.Graph(500, 2); // Add the line to paraphraphs collection of section object page.Paragraphs.Add(graph1); // Specify the coordinates for the line float[] posArr = new float[] { 1, 2, 500, 2 }; Aspose.Pdf.Drawing.Line l1 = new Aspose.Pdf.Drawing.Line(posArr); graph1.Shapes.Add(l1); // Create string variables with text containing html tags string s = "<font face=\"Times New Roman\" size=4>" + "<strong> How to Steer Clear of money scams</<strong> " + "</font>"; // Create text paragraphs containing HTML text HtmlFragment heading_text = new HtmlFragment(s); page.Paragraphs.Add(heading_text); Aspose.Pdf.FloatingBox box = new Aspose.Pdf.FloatingBox(); // Add four columns in the section box.ColumnInfo.ColumnCount = 2; // Set the spacing between the columns box.ColumnInfo.ColumnSpacing = "5"; box.ColumnInfo.ColumnWidths = "105 105"; TextFragment text1 = new TextFragment("By A Googler (The Official Google Blog)"); text1.TextState.FontSize = 8; text1.TextState.LineSpacing = 2; box.Paragraphs.Add(text1); text1.TextState.FontSize = 10; text1.TextState.FontStyle = FontStyles.Italic; // Create a graphs object to draw a line Aspose.Pdf.Drawing.Graph graph2 = new Aspose.Pdf.Drawing.Graph(50, 10); // Specify the coordinates for the line float[] posArr2 = new float[] { 1, 10, 100, 10 }; Aspose.Pdf.Drawing.Line l2 = new Aspose.Pdf.Drawing.Line(posArr2); graph2.Shapes.Add(l2); // Add the line to paragraphs collection of section object box.Paragraphs.Add(graph2); TextFragment text2 = new TextFragment(@"Sed augue tortor, sodales id, luctus et, pulvinar ut, eros. Suspendisse vel dolor. Sed quam. Curabitur ut massa vitae eros euismod aliquam. Pellentesque sit amet elit. Vestibulum interdum pellentesque augue. Cras mollis arcu sit amet purus. Donec augue. Nam mollis tortor a elit. Nulla viverra nisl vel mauris. Vivamus sapien. nascetur ridiculus mus. Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et,nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et, semper sed, enim nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed urna. . Duis convallis ultrices nisi. Maecenas non ligula. Nunc nibh est, tincidunt in, placerat sit amet, vestibulum a, nulla. Praesent porttitor turpis eleifend ante. Morbi sodales.nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed urna. . Duis convallis ultrices nisi. Maecenas non ligula. Nunc nibh est, tincidunt in, placerat sit amet, vestibulum a, nulla. Praesent porttitor turpis eleifend ante. Morbi sodales."); box.Paragraphs.Add(text2); page.Paragraphs.Add(box); dataDir = dataDir + "CreateMultiColumnPdf_out_.pdf"; // Save PDF file doc.Save(dataDir); // ExEnd:CreateMultiColumnPdf Console.WriteLine("\nMulti column pdf file created successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:CreateMultiColumnPdf // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Text(); Document doc = new Document(); // Specify the left margin info for the PDF file doc.PageInfo.Margin.Left = 40; // Specify the Right margin info for the PDF file doc.PageInfo.Margin.Right = 40; Page page = doc.Pages.Add(); Aspose.Pdf.Drawing.Graph graph1 = new Aspose.Pdf.Drawing.Graph(500, 2); // Add the line to paraphraphs collection of section object page.Paragraphs.Add(graph1); // Specify the coordinates for the line float[] posArr = new float[] { 1, 2, 500, 2 }; Aspose.Pdf.Drawing.Line l1 = new Aspose.Pdf.Drawing.Line(posArr); graph1.Shapes.Add(l1); // Create string variables with text containing html tags string s = "<font face=\"Times New Roman\" size=4>" + "<strong> How to Steer Clear of money scams</<strong> " + "</font>"; // Create text paragraphs containing HTML text HtmlFragment heading_text = new HtmlFragment(s); page.Paragraphs.Add(heading_text); Aspose.Pdf.FloatingBox box = new Aspose.Pdf.FloatingBox(); // Add four columns in the section box.ColumnInfo.ColumnCount = 2; // Set the spacing between the columns box.ColumnInfo.ColumnSpacing = "5"; box.ColumnInfo.ColumnWidths = "105 105"; TextFragment text1 = new TextFragment("By A Googler (The Official Google Blog)"); text1.TextState.FontSize = 8; text1.TextState.LineSpacing = 2; box.Paragraphs.Add(text1); text1.TextState.FontSize = 10; text1.TextState.FontStyle = FontStyles.Italic; // Create a graphs object to draw a line Aspose.Pdf.Drawing.Graph graph2 = new Aspose.Pdf.Drawing.Graph(50, 10); // Specify the coordinates for the line float[] posArr2 = new float[] { 1, 10, 100, 10 }; Aspose.Pdf.Drawing.Line l2 = new Aspose.Pdf.Drawing.Line(posArr2); graph2.Shapes.Add(l2); // Add the line to paragraphs collection of section object box.Paragraphs.Add(graph2); TextFragment text2 = new TextFragment(@"Sed augue tortor, sodales id, luctus et, pulvinar ut, eros. Suspendisse vel dolor. Sed quam. Curabitur ut massa vitae eros euismod aliquam. Pellentesque sit amet elit. Vestibulum interdum pellentesque augue. Cras mollis arcu sit amet purus. Donec augue. Nam mollis tortor a elit. Nulla viverra nisl vel mauris. Vivamus sapien. nascetur ridiculus mus. Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et,nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et, semper sed, enim nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed urna. . Duis convallis ultrices nisi. Maecenas non ligula. Nunc nibh est, tincidunt in, placerat sit amet, vestibulum a, nulla. Praesent porttitor turpis eleifend ante. Morbi sodales.nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed urna. . Duis convallis ultrices nisi. Maecenas non ligula. Nunc nibh est, tincidunt in, placerat sit amet, vestibulum a, nulla. Praesent porttitor turpis eleifend ante. Morbi sodales."); box.Paragraphs.Add(text2); page.Paragraphs.Add(box); dataDir = dataDir + "CreateMultiColumnPdf_out.pdf"; // Save PDF file doc.Save(dataDir); // ExEnd:CreateMultiColumnPdf Console.WriteLine("\nMulti column pdf file created successfully.\nFile saved at " + dataDir); }