Esempio n. 1
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);
 }
Esempio n. 2
0
        public PDocument(string fileFullName, HDocument hDocument)
        {
            /*
             * //DEBUG
             * PDocument_debug(fileFullName, hDocument);
             * return;
             */


            bodyNode = hDocument.BodyNode;

            pageTextState = PUtil.TextStateUtil.TextState_Default();
            PUtil.TextStateUtil.TextState_ModifyFromHStyles((bodyNode as HNodeTag).Styles, pageTextState);

            pageMargin     = new MarginInfo(4, 4, 4, 12);
            pageBackground = Aspose.Pdf.Color.FromRgb(1.00, 1.00, 1.00);

            pdfDocument           = new Document();
            pdfPage               = null;
            pdfTextFragment       = null;
            pdfImage              = null;
            hyperlinkNode         = null;
            pdfNewLine            = null;
            inlineParagraphMargin = null;
            pdfFormField          = null;
            pdfRadioButtonFields  = new Dictionary <string, RadioButtonField>();

            updateCurrentPage();
            createBody();

            pdfDocument.Save(fileFullName);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 5
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);
 }