public static void Run()
        {
            // ExStart:CreateFilledRectangle
            // 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.Rectangle rect = new Aspose.Pdf.Drawing.Rectangle(100, 100, 200, 120);
            // Specify fill color for Graph object
            rect.GraphInfo.FillColor = Aspose.Pdf.Color.Red;
            // Add rectangle object to shapes collection of Graph object
            graph.Shapes.Add(rect);
            dataDir = dataDir + "CreateFilledRectangle_out.pdf";
            // Save PDF file
            doc.Save(dataDir);
            // ExEnd:CreateFilledRectangle
            Console.WriteLine("\nFilled rectangle object created successfully.\nFile saved at " + dataDir);            
        }
Beispiel #2
0
        public static void Graph4(Page pdfPage)
        {
            //pdfPage.PageInfo.Margin.Left = pdfPage.PageInfo.Margin.Right = pdfPage.PageInfo.Margin.Bottom = pdfPage.PageInfo.Margin.Top = 0;
            pdfPage.PageInfo.Margin.Left = pdfPage.PageInfo.Margin.Right = pdfPage.PageInfo.Margin.Bottom = pdfPage.PageInfo.Margin.Top = 20;

            // Create Graph instance
            Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph(200, 400);
            
            // Add graph object to paragraphs collection of page instance
            pdfPage.Paragraphs.Add(graph);

            // Create Rectangle instance
            //Aspose.Pdf.Drawing.Rectangle rect = new Aspose.Pdf.Drawing.Rectangle(100, 100, 200, 120);
            //Aspose.Pdf.Drawing.Rectangle rect = new Aspose.Pdf.Drawing.Rectangle(0, 0, 200, 400);
            Aspose.Pdf.Drawing.Rectangle rect1 = new Aspose.Pdf.Drawing.Rectangle(0, 0, 200, 400);
            Aspose.Pdf.Drawing.Rectangle rect2 = new Aspose.Pdf.Drawing.Rectangle(100, 0, 100, 200);

            // Specify fill color for Graph object
            rect1.GraphInfo.FillColor = Aspose.Pdf.Color.Blue;
            rect2.GraphInfo.FillColor = Aspose.Pdf.Color.Red;

            // Add rectangle object to shapes collection of Graph object
            graph.Shapes.Add(rect1);
            graph.Shapes.Add(rect2);
        }
        public static void Run()
        {
            // ExStart:CreateRectangleWithAlphaColor
            // 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 PDF file
            Aspose.Pdf.Page page = doc.Pages.Add();
            // Create Graph instance
            Aspose.Pdf.Drawing.Graph canvas = new Aspose.Pdf.Drawing.Graph(100, 400);
            // Create rectangle object with specific dimensions
            Aspose.Pdf.Drawing.Rectangle rect = new Aspose.Pdf.Drawing.Rectangle(100, 100, 200, 100);
            // Set graph fill color from System.Drawing.Color structure from a 32-bit ARGB value
            rect.GraphInfo.FillColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.FromArgb(128, System.Drawing.Color.FromArgb(12957183)));
            // Add rectangle object to shapes collection of Graph instance
            canvas.Shapes.Add(rect);

            // Create second rectangle object
            Aspose.Pdf.Drawing.Rectangle rect1 = new Aspose.Pdf.Drawing.Rectangle(200, 150, 200, 100);
            rect1.GraphInfo.FillColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.FromArgb(128, System.Drawing.Color.FromArgb(16118015)));
            canvas.Shapes.Add(rect1);
            // Add graph instance to paragraph collection of page object
            page.Paragraphs.Add(canvas);

            dataDir = dataDir + "CreateRectangleWithAlphaColor_out.pdf";
            // Save PDF file
            doc.Save(dataDir);
            // ExEnd:CreateRectangleWithAlphaColor
            Console.WriteLine("\nRectangle object created successfully with alpha color.\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);            
        }
Beispiel #5
0
        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: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);            
        }
Beispiel #7
0
 public static void Graph2(Page pdfPage)
 {
     int alpha = 10;
     int green = 0;
     int red = 100;
     int blue = 0;
     // Create Color object using Alpha RGB 
     Aspose.Pdf.Color alphaColor = Aspose.Pdf.Color.FromArgb(alpha, red, green, blue); // Provide alpha channel
                                                                                       // Instantiate Document object
     // Create Graph object with certain dimensions
     Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph(300, 400);
     // Set border for Drawing object
     graph.Border = (new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, Aspose.Pdf.Color.Black));
     // Add graph object to paragraphs collection of Page instance
     pdfPage.Paragraphs.Add(graph);
     // Create Rectangle object with certain dimensions
     Aspose.Pdf.Drawing.Rectangle rectangle = new Aspose.Pdf.Drawing.Rectangle(0, 0, 100, 50);
     // Create graphInfo object for Rectangle instance
     Aspose.Pdf.GraphInfo graphInfo = rectangle.GraphInfo;
     // Set color information for GraphInfo instance
     graphInfo.Color = (Aspose.Pdf.Color.Red);
     // Set fill color for GraphInfo
     graphInfo.FillColor = (alphaColor);
     // Add rectangle shape to shapes collection of graph object
     graph.Shapes.Add(rectangle);
 }
        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: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: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:CreateRectangleWithAlphaColor
            // 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 PDF file
            Aspose.Pdf.Page page = doc.Pages.Add();
            // Create Graph instance
            Aspose.Pdf.Drawing.Graph canvas = new Aspose.Pdf.Drawing.Graph(100, 400);
            // Create rectangle object with specific dimensions
            Aspose.Pdf.Drawing.Rectangle rect = new Aspose.Pdf.Drawing.Rectangle(100, 100, 200, 100);
            // Set graph fill color from System.Drawing.Color structure from a 32-bit ARGB value
            rect.GraphInfo.FillColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.FromArgb(128, System.Drawing.Color.FromArgb(12957183)));
            // Add rectangle object to shapes collection of Graph instance
            canvas.Shapes.Add(rect);

            // Create second rectangle object
            Aspose.Pdf.Drawing.Rectangle rect1 = new Aspose.Pdf.Drawing.Rectangle(200, 150, 200, 100);
            rect1.GraphInfo.FillColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.FromArgb(128, System.Drawing.Color.FromArgb(16118015)));
            canvas.Shapes.Add(rect1);
            // Add graph instance to paragraph collection of page object
            page.Paragraphs.Add(canvas);

            dataDir = dataDir + "CreateRectangleWithAlphaColor_out_.pdf";
            // Save PDF file
            doc.Save(dataDir);
            // ExEnd:CreateRectangleWithAlphaColor
            Console.WriteLine("\nRectangle object created successfully with alpha color.\nFile saved at " + dataDir);
        }
Beispiel #12
0
        public static void Run()
        {
            // ExStart:CreateFilledRectangle
            // 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.Rectangle rect = new Aspose.Pdf.Drawing.Rectangle(100, 100, 200, 120);
            // Specify fill color for Graph object
            rect.GraphInfo.FillColor = Aspose.Pdf.Color.Red;
            // Add rectangle object to shapes collection of Graph object
            graph.Shapes.Add(rect);
            dataDir = dataDir + "CreateFilledRectangle_out.pdf";
            // Save PDF file
            doc.Save(dataDir);
            // ExEnd:CreateFilledRectangle
            Console.WriteLine("\nFilled rectangle object created successfully.\nFile saved at " + dataDir);
        }
Beispiel #13
0
        private void debug_createP(string fileFullName)
        {
            Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document();
            Aspose.Pdf.Page     pdfPage     = (Aspose.Pdf.Page)pdfDocument.Pages.Add();

            Console.WriteLine("pdfPage.Rect = " + pdfPage.Rect);
            Console.WriteLine("pdfPage.PageInfo: Width - Height - PureHeight = " + pdfPage.PageInfo.Width + " - " + pdfPage.PageInfo.Height + " - " + pdfPage.PageInfo.PureHeight);
            Console.WriteLine("pdfPage.PageInfo: Margin.Top - Right - Bottom - Left = " + pdfPage.PageInfo.Margin.Top + " - " + pdfPage.PageInfo.Margin.Right + " - " + pdfPage.PageInfo.Margin.Bottom + " - " + pdfPage.PageInfo.Margin.Left);

            TextParagraph paragraph = new TextParagraph();

            // append string lines
            paragraph.AppendLine("the quick brown fox jumps over the lazy dog");
            paragraph.AppendLine("line2");
            paragraph.AppendLine("line3");


            Console.WriteLine("paragraph.Rectangle = " + paragraph.Rectangle);
            Console.WriteLine("paragraph.TextRectangle = " + paragraph.TextRectangle);



            // Create Graph instance
            Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph((float)pdfPage.Rect.Width, (float)pdfPage.Rect.Height);
            // Add graph object to paragraphs collection of page instance
            pdfPage.Paragraphs.Add(graph);
            // Create Rectangle instance
            //Aspose.Pdf.Drawing.Rectangle rect = new Aspose.Pdf.Drawing.Rectangle(100, 100, 200, 120);

            Aspose.Pdf.Drawing.Rectangle rect = new Aspose.Pdf.Drawing.Rectangle((float)paragraph.Rectangle.LLX, (float)paragraph.Rectangle.LLY, (float)paragraph.Rectangle.Width, (float)paragraph.Rectangle.Height);
            //Aspose.Pdf.Drawing.Rectangle rect = new Aspose.Pdf.Drawing.Rectangle((float)paragraph.TextRectangle.LLX, (float)paragraph.TextRectangle.LLY, (float)paragraph.TextRectangle.Width, (float)paragraph.TextRectangle.Height);

            // Specify fill color for Graph object

            //rect.GraphInfo.FillColor = Aspose.Pdf.Color.Red;
            rect.GraphInfo.LineWidth = 2;
            rect.GraphInfo.Color     = Aspose.Pdf.Color.Brown;

            // Add rectangle object to shapes collection of Graph object
            graph.Shapes.Add(rect);



            TextBuilder textBuilder = new TextBuilder(pdfPage);

            textBuilder.AppendParagraph(paragraph);


            pdfDocument.Save(fileFullName);
        }
Beispiel #14
0
 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:AddDrawing
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Graphs();

            int alpha = 10;
            int green = 0;
            int red   = 100;
            int blue  = 0;

            // Create Color object using Alpha RGB
            Aspose.Pdf.Color alphaColor = Aspose.Pdf.Color.FromArgb(alpha, red, green, blue); // provide alpha channel
            // Instantiate Document object
            Document document = new Document();
            // Add page to pages collection of PDF file
            Page page = document.Pages.Add();

            // Create Graph object with certain dimensions
            Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph(300, 400);
            // Set border for Drawing object
            graph.Border = (new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, Aspose.Pdf.Color.Black));
            // Add graph object to paragraphs collection of Page instance
            page.Paragraphs.Add(graph);
            // Create Rectangle object with certain dimensions
            Aspose.Pdf.Drawing.Rectangle rectangle = new Aspose.Pdf.Drawing.Rectangle(0, 0, 100, 50);
            // Create graphInfo object for Rectangle instance
            Aspose.Pdf.GraphInfo graphInfo = rectangle.GraphInfo;
            // Set color information for GraphInfo instance
            graphInfo.Color = (Aspose.Pdf.Color.Red);
            // Set fill color for GraphInfo
            graphInfo.FillColor = (alphaColor);
            // Add rectangle shape to shapes collection of graph object
            graph.Shapes.Add(rectangle);
            dataDir = dataDir + "AddDrawing_out_.pdf";
            // Save PDF file
            document.Save(dataDir);
            // ExEnd:AddDrawing
            Console.WriteLine("\nDrawing added successfully with transparent color.\nFile saved at " + dataDir);
        }
        public static void Run()
        {
            // ExStart:AddTransparentText
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Text();

            // Create Document instance
            Document doc = new Document();

            // Create page to pages collection of PDF file
            Aspose.Pdf.Page page = doc.Pages.Add();

            // Create Graph object
            Aspose.Pdf.Drawing.Graph canvas = new Aspose.Pdf.Drawing.Graph(100, 400);
            // Create rectangle instance with certain dimensions
            Aspose.Pdf.Drawing.Rectangle rect = new Aspose.Pdf.Drawing.Rectangle(100, 100, 400, 400);
            // Create color object from Alpha color channel
            rect.GraphInfo.FillColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.FromArgb(128, System.Drawing.Color.FromArgb(12957183)));
            // Add rectanlge to shapes collection of Graph object
            canvas.Shapes.Add(rect);
            // Add graph object to paragraphs collection of page object
            page.Paragraphs.Add(canvas);
            // Set value to not change position for graph object
            canvas.IsChangePosition = false;

            // Create TextFragment instance with sample value
            TextFragment text = new TextFragment("transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text ");

            // Create color object from Alpha channel
            Aspose.Pdf.Color color = Aspose.Pdf.Color.FromArgb(30, 0, 255, 0);
            // Set color information for text instance
            text.TextState.ForegroundColor = color;
            // Add text to paragraphs collection of page instance
            page.Paragraphs.Add(text);

            dataDir = dataDir + "AddTransparentText_out.pdf";
            doc.Save(dataDir);
            // ExEnd:AddTransparentText
            Console.WriteLine("\nTransparent text added successfully.\nFile saved at " + dataDir);
        }
        public static void Run()
        {
            // ExStart:AddDrawing
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Graphs();

            int alpha = 10;
            int green = 0;
            int red = 100;
            int blue = 0;
            // Create Color object using Alpha RGB 
            Aspose.Pdf.Color alphaColor = Aspose.Pdf.Color.FromArgb(alpha, red, green, blue); // Provide alpha channel
            // Instantiate Document object
            Document document = new Document();
            // Add page to pages collection of PDF file
            Page page = document.Pages.Add();
            // Create Graph object with certain dimensions
            Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph(300, 400);
            // Set border for Drawing object
            graph.Border = (new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, Aspose.Pdf.Color.Black));
            // Add graph object to paragraphs collection of Page instance
            page.Paragraphs.Add(graph);
            // Create Rectangle object with certain dimensions
            Aspose.Pdf.Drawing.Rectangle rectangle = new Aspose.Pdf.Drawing.Rectangle(0, 0, 100, 50);
            // Create graphInfo object for Rectangle instance
            Aspose.Pdf.GraphInfo graphInfo = rectangle.GraphInfo;
            // Set color information for GraphInfo instance
            graphInfo.Color = (Aspose.Pdf.Color.Red);
            // Set fill color for GraphInfo
            graphInfo.FillColor = (alphaColor);
            // Add rectangle shape to shapes collection of graph object
            graph.Shapes.Add(rectangle);
            dataDir = dataDir + "AddDrawing_out.pdf";
            // Save PDF file
            document.Save(dataDir);
            // ExEnd:AddDrawing
            Console.WriteLine("\nDrawing added successfully with transparent color.\nFile saved at " + dataDir);            
        }
        public static void Run()
        {
            // ExStart:AddTransparentText
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Text();

            // Create Document instance
            Document doc = new Document();
            // Create page to pages collection of PDF file
            Aspose.Pdf.Page page = doc.Pages.Add();

            // Create Graph object 
            Aspose.Pdf.Drawing.Graph canvas = new Aspose.Pdf.Drawing.Graph(100, 400);
            // Create rectangle instance with certain dimensions
            Aspose.Pdf.Drawing.Rectangle rect = new Aspose.Pdf.Drawing.Rectangle(100, 100, 400, 400);
            // Create color object from Alpha color channel
            rect.GraphInfo.FillColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.FromArgb(128, System.Drawing.Color.FromArgb(12957183)));
            // Add rectanlge to shapes collection of Graph object
            canvas.Shapes.Add(rect);
            // Add graph object to paragraphs collection of page object
            page.Paragraphs.Add(canvas);
            // Set value to not change position for graph object
            canvas.IsChangePosition = false;

            // Create TextFragment instance with sample value
            TextFragment text = new TextFragment("transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text ");
            // Create color object from Alpha channel
            Aspose.Pdf.Color color = Aspose.Pdf.Color.FromArgb(30, 0, 255, 0);
            // Set color information for text instance
            text.TextState.ForegroundColor = color;
            // Add text to paragraphs collection of page instance
            page.Paragraphs.Add(text);

            dataDir = dataDir + "AddTransparentText_out.pdf";
            doc.Save(dataDir);
            // ExEnd:AddTransparentText            
            Console.WriteLine("\nTransparent text added successfully.\nFile saved at " + dataDir);
        }
 // ExStart:AddRectangle
 private static void AddRectangle(Aspose.Pdf.Page page, float x, float y, float width, float height, Aspose.Pdf.Color color, int zindex)
 {
     // Create graph object with dimensions same as specified for Rectangle object
     Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph(width, height);
     // Can we change the position of graph instance
     graph.IsChangePosition = false;
     // Set Left coordinate position for Graph instance
     graph.Left = x;
     // Set Top coordinate position for Graph object
     graph.Top = y;
     // Add a rectangle inside the "graph"
     Aspose.Pdf.Drawing.Rectangle rect = new Aspose.Pdf.Drawing.Rectangle(0, 0, width, height);
     // Set rectangle fill color
     rect.GraphInfo.FillColor = color;
     // Color of graph object
     rect.GraphInfo.Color = color;
     // Add rectangle to shapes collection of graph instance
     graph.Shapes.Add(rect);
     // Set Z-Index for rectangle object
     graph.ZIndex = zindex;
     // Add graph to paragraphs collection of page object
     page.Paragraphs.Add(graph);
 }
Beispiel #20
0
 // ExStart:AddRectangle
 private static void AddRectangle(Aspose.Pdf.Page page, float x, float y, float width, float height, Aspose.Pdf.Color color, int zindex)
 {
     // create graph object with dimensions same as specified for Rectangle object
     Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph(width, height);
     // can we change the position of graph instance
     graph.IsChangePosition = false;
     // set Left coordinate position for Graph instance
     graph.Left = x;
     // set Top coordinate position for Graph object
     graph.Top = y;
     // Add a rectangle inside the "graph"
     Aspose.Pdf.Drawing.Rectangle rect = new Aspose.Pdf.Drawing.Rectangle(0, 0, width, height);
     // set rectangle fill color
     rect.GraphInfo.FillColor = color;
     // color of graph object
     rect.GraphInfo.Color = color;
     // add rectangle to shapes collection of graph instance
     graph.Shapes.Add(rect);
     // set Z-Index for rectangle object
     graph.ZIndex = zindex;
     // add graph to paragraphs collection of page object
     page.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);
        }