Exemplo n.º 1
0
        //---------------------------------------------------------------------
        private static void Mask()
        {
            Action <Surface> draw = surface =>
            {
                using (var ctx = new Context(surface))
                {
                    ctx.Scale(500, 500);

                    Gradient linpat = new LinearGradient(0, 0, 1, 1);
                    linpat.AddColorStop(0, new Color(0, 0.3, 0.8));
                    linpat.AddColorStop(1, new Color(1, 0.8, 0.3));

                    Gradient radpat = new RadialGradient(0.5, 0.5, 0.25, 0.5, 0.5, 0.6);
                    radpat.AddColorStop(0, new Color(0, 0, 0, 1));
                    radpat.AddColorStop(1, new Color(0, 0, 0, 0));

                    ctx.Source = linpat;
                    //ctx.Paint();
                    ctx.Mask(radpat);
                }
            };

            using (Surface surface = new ImageSurface(Format.Argb32, 500, 500))
            {
                draw(surface);
                surface.WriteToPng("mask.png");
            }

            using (Surface surface = new PdfSurface("mask.pdf", 500, 500))
                draw(surface);

            using (Surface surface = new SvgSurface("mask.svg", 500, 500))
                draw(surface);
        }
Exemplo n.º 2
0
 public static void ExportToPdf(this Report report, string path)
 {
     using (PdfSurface pdfSurface = new PdfSurface(
                path, report.WidthWithMargins, report.HeightWithMargins)) {
         Cairo.Context cr = new Cairo.Context(pdfSurface);
         cr.Translate(report.Margin.Left, report.Margin.Top);
         ReportRenderer renderer = new ReportRenderer()
         {
             Context = cr
         };
         renderer.RegisterRenderer(typeof(TextBlock), new TextBlockRenderer());
         renderer.RegisterRenderer(typeof(Line), new LineRenderer());
         renderer.RegisterRenderer(typeof(Image), new ImageRenderer()
         {
             PixbufRepository = new PixbufRepository(report.ResourceRepository)
         });
         SectionRenderer sr = new SectionRenderer();
         renderer.RegisterRenderer(typeof(ReportHeaderSection), sr);
         renderer.RegisterRenderer(typeof(ReportFooterSection), sr);
         renderer.RegisterRenderer(typeof(DetailSection), sr);
         renderer.RegisterRenderer(typeof(PageHeaderSection), sr);
         renderer.RegisterRenderer(typeof(PageFooterSection), sr);
         MonoReports.Model.Engine.ReportEngine engine = new MonoReports.Model.Engine.ReportEngine(report, renderer);
         engine.Process();
         for (int i = 0; i < report.Pages.Count; ++i)
         {
             renderer.RenderPage(report.Pages [i]);
             cr.ShowPage();
         }
         pdfSurface.Finish();
         (cr as IDisposable).Dispose();
     }
 }
Exemplo n.º 3
0
        public override void Run()
        {
            ICollection <double> chapters = this.Theory.Chapters;
            StripCanvasSize      scs      = this.Manager.GenerateStripCanvasSize(chapters.Count);
            double dw = scs.CanvasSize.Width;
            double dh = scs.CanvasSize.Height;

            using (PdfSurface surface = new PdfSurface(this.Manager.OutputFile, scs.TotalWidth, scs.TotalHeight)) {
                using (Context ctx = new Context(surface)) {
                    int     index = 0x00;
                    IPoint3 p;
                    foreach (double chapter in chapters)
                    {
                        p = scs.GetCanvasOffset(index);
                        ctx.Save();
                        ctx.Translate(p.X, p.Y);
                        ctx.Rectangle(0.0d, 0.0d, dw, dh);
                        ctx.Stroke();
                        this.Theory.Time = chapter;
                        CairoEngine engine = new CairoEngine(this.Theory);
                        engine.Context = ctx;
                        engine.Process();
                        ctx.Restore();
                        index++;
                    }
                }
            }
        }
Exemplo n.º 4
0
        //---------------------------------------------------------------------
        private static void AntiAlias()
        {
            Action <Surface> draw = surface =>
            {
                using (var ctx = new Context(surface))
                {
                    // Sets the anti-aliasing method:
                    ctx.Antialias = Antialias.Subpixel;

                    // Sets the line width:
                    ctx.LineWidth = 9;

                    // red, green, blue, alpha:
                    ctx.Color = new Color(0, 0, 0, 1);

                    // Sets the Context's start point:
                    ctx.MoveTo(10, 10);

                    // Draws a "virtual" line:
                    ctx.LineTo(40, 60);

                    // Stroke the line to the image surface:
                    ctx.Stroke();

                    ctx.Antialias = Antialias.Gray;
                    ctx.LineWidth = 8;
                    ctx.Color     = new Color(1, 0, 0, 1);
                    ctx.LineCap   = LineCap.Round;
                    ctx.MoveTo(10, 50);
                    ctx.LineTo(40, 100);
                    ctx.Stroke();

                    // Fastest method but low quality:
                    ctx.Antialias = Antialias.None;
                    ctx.LineWidth = 7;
                    ctx.MoveTo(10, 90);
                    ctx.LineTo(40, 140);
                    ctx.Stroke();
                }
            };

            using (Surface surface = new ImageSurface(Format.Argb32, 70, 150))
            {
                draw(surface);

                // Save the image as a png image:
                surface.WriteToPng("antialias.png");
            }

            using (Surface surface = new PdfSurface("antialias.pdf", 70, 150))
                draw(surface);

            using (Surface surface = new SvgSurface("antialias.svg", 70, 150))
                draw(surface);
        }
Exemplo n.º 5
0
        //---------------------------------------------------------------------
        private static void Arrows()
        {
            Action <Surface> draw = surface =>
            {
                using (var c = new Context(surface))
                {
                    c.Scale(300, 300);

                    // Is only relevant to PNG
                    c.Antialias = Antialias.Subpixel;

                    // adjust line width due scaling
                    double ux = 1, uy = 1;
                    c.DeviceToUserDistance(ref ux, ref uy);
                    c.LineWidth = Math.Max(ux, uy);

                    c.MoveTo(0, 0.1);
                    c.LineTo(1, 0.1);
                    c.MoveTo(0, 0.9);
                    c.LineTo(1, 0.9);
                    c.Stroke();

                    var arrow = new Arrow();
                    c.Color = KnownColors.Blue;
                    arrow.DrawArrow(c, 0.1, 0.1, 0.2, 0.9);
                    arrow.DrawVector(c, 0.2, 0.1, 0.3, 0.9);

                    arrow   = new OpenArrow();
                    c.Color = new Color(0, 1, 0);
                    arrow.DrawArrow(c, 0.3, 0.1, 0.4, 0.9);
                    arrow.DrawVector(c, 0.4, 0.1, 0.5, 0.9);

                    arrow   = new CircleArrow(0.01);
                    c.Color = new Color(1, 0, 0);
                    arrow.DrawArrow(c, 0.5, 0.1, 0.6, 0.9);
                    arrow.DrawVector(c, 0.6, 0.1, 0.7, 0.9);
                }
            };

            using (Surface surface = new PdfSurface("arrows.pdf", 300, 300))
            {
                draw(surface);

                // PNG can also be created this way
                surface.WriteToPng("arrows.png");
            }

            using (Surface surface = new PSSurface("arrows.eps", 300, 300))
                draw(surface);

            using (Surface surface = new SvgSurface("arrows.svg", 300, 300))
                draw(surface);
        }
Exemplo n.º 6
0
        //---------------------------------------------------------------------
        private static void Shapes()
        {
            Action <Surface> draw = surface =>
            {
                using (var c = new Context(surface))
                {
                    c.Antialias = Antialias.Subpixel;

                    // Hexagon:
                    Shape shape = new Hexagon(50);
                    shape.Draw(c, 50, 50);
                    shape.Fill(c, 50, 50, new Color(0.5, 0.5, 0.5));

                    // Square:
                    shape = new Square(50);
                    shape.Draw(c, 150, 50);
                    shape.Fill(c, 150, 50, new Color(0.5, 0.5, 0.5));

                    // Circle:
                    shape = new Circle(50);
                    shape.Draw(c, 100, 150);
                    shape.Fill(c, 100, 150, new Color(0.5, 0.5, 0.5));

                    // Bounding box:
                    var boundingBox = new Square(50);
                    c.LineWidth = 1;
                    var red = new Color(1, 0, 0);
                    boundingBox.Draw(c, 50, 50, red);
                    boundingBox.Draw(c, 150, 50, red);
                    boundingBox.Draw(c, 100, 150, red);
                }
            };

            using (Surface surface = new ImageSurface(Format.Argb32, 180, 180))
            {
                draw(surface);
                surface.WriteToPng("shapes.png");
            }

            using (Surface surface = new PdfSurface("shapes.pdf", 180, 180))
                draw(surface);

            using (Surface surface = new PSSurface("shapes.eps", 300, 300))
                draw(surface);

            using (Surface surface = new SvgSurface("shapes.svg", 180, 180))
                draw(surface);
        }
Exemplo n.º 7
0
        public bool GeneratePdf(Game [] games, int games_page, string file)
        {
            int columns, rows;

            switch (games_page)
            {
            case 1:
                columns = 1;
                rows    = 1;
                break;

            case 2:
                columns = 2;
                rows    = 1;
                break;

            case 4:
                columns = 2;
                rows    = 2;
                break;

            default:
                throw new InvalidOperationException("Invalid games per page value");
            }

            try {
                PdfSurface pdf = new PdfSurface(file, page_width * columns, page_height * rows);

                if (pdf.Status != Status.Success)
                {
                    return(false);
                }

                CairoContextEx cr = new CairoContextEx(pdf, "sans 12", 72);

                GenerateQuestions(cr, games, columns, rows);
                GenerateAnswers(cr, games, columns, rows);

                pdf.Finish();
                ((IDisposable)cr).Dispose();
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine("PdfExporter.GeneratePdf. Exception: {0}", e);
                return(false);
            }
        }
Exemplo n.º 8
0
        public static void Main(string[] args)
        {
            // call the snippets
            Snippets snip    = new Snippets();
            Surface  surface = new PdfSurface("snippets.pdf", IMAGE_WIDTH, IMAGE_WIDTH);
            Context  cr      = new Context(surface);

            foreach (string snippet in Snippets.snippets)
            {
                cr.Save();
                Snippets.InvokeSnippet(snip, snippet, cr, IMAGE_WIDTH, IMAGE_HEIGHT);
                cr.ShowPage();
                cr.Restore();
            }
            surface.Finish();
        }
Exemplo n.º 9
0
        //---------------------------------------------------------------------
        private static void Demo02()
        {
            Action <Surface> draw = surface =>
            {
                using (var c = new Context(surface))
                {
                    c.Scale(500, 500);

                    Gradient radpat = new RadialGradient(0.25, 0.25, 0.1, 0.5, 0.5, 0.5);
                    radpat.AddColorStop(0, new Color(1.0, 0.8, 0.8));
                    radpat.AddColorStop(1, new Color(0.9, 0.0, 0.0));

                    for (int i = 1; i < 10; i++)
                    {
                        for (int j = 1; j < 10; j++)
                        {
                            c.Rectangle(i / 10d - 0.04, j / 10d - 0.04, 0.08, 0.08);
                        }
                    }
                    c.Source = radpat;
                    c.Fill();

                    Gradient linpat = new LinearGradient(0.25, 0.35, 0.75, 0.65);
                    linpat.AddColorStop(0.00, new Color(1, 1, 1, 0));
                    linpat.AddColorStop(0.25, new Color(0, 1, 0, 0.5));
                    linpat.AddColorStop(0.50, new Color(1, 1, 1, 0));
                    linpat.AddColorStop(0.75, new Color(0, 0, 1, 0.5));
                    linpat.AddColorStop(1.00, new Color(1, 1, 1, 0));

                    c.Rectangle(0, 0, 1, 1);
                    c.Source = linpat;
                    c.Fill();
                }
            };

            using (Surface surface = new ImageSurface(Format.Argb32, 500, 500))
            {
                draw(surface);
                surface.WriteToPng("demo02.png");
            }

            using (Surface surface = new PdfSurface("demo02.pdf", 500, 500))
                draw(surface);

            using (Surface surface = new SvgSurface("demo02.svg", 500, 500))
                draw(surface);
        }
Exemplo n.º 10
0
        public override void Run()
        {
            StripCanvasSize scs = this.Manager.GenerateStripCanvasSize(0x01);

            using (PdfSurface surface = new PdfSurface(this.Manager.OutputFile, scs.TotalWidth, scs.TotalHeight)) {
                using (Context ctx = new Context(surface)) {
                    IPoint3 p = scs.GetCanvasOffset(0x00);
                    ctx.Save();
                    ctx.Translate(p.X, p.Y);
                    this.Theory.Time = this.Manager.Time;
                    CairoEngine engine = new CairoEngine(this.Theory);
                    engine.Context = ctx;
                    engine.Process();
                    ctx.Restore();
                }
            }
        }
Exemplo n.º 11
0
        //---------------------------------------------------------------------
        private static void Gradient()
        {
            Action <Surface> draw = surface =>
            {
                using (var c = new Context(surface))
                {
                    Gradient pat = new LinearGradient(0.0, 0.0, 0.0, 256.0);
                    pat.AddColorStopRgba(1, 0, 0, 0, 1);
                    pat.AddColorStopRgba(0, 1, 1, 1, 1);
                    c.Rectangle(0, 0, 256, 256);
                    c.SetSource(pat);
                    c.Fill();
                    pat.Dispose();

                    pat = new RadialGradient(115.2, 102.4, 25.6,
                                             102.4, 102.4, 128.0);
                    pat.AddColorStopRgba(0, 1, 1, 1, 1);
                    pat.AddColorStopRgba(1, 0, 0, 0, 1);
                    c.SetSource(pat);
                    c.Arc(128.0, 128.0, 76.8, 0, 2 * Math.PI);
                    c.Fill();
                    pat.Dispose();
                }
            };

            using (Surface surface = new ImageSurface(Format.Argb32, 500, 500))
            {
                draw(surface);
                surface.WriteToPng("gradient.png");
            }

            using (Surface surface = new PdfSurface("gradient.pdf", 500, 500))
            {
                draw(surface);
                surface.WriteToPng("gradient1.png");
            }

            using (Surface surface = new SvgSurface("gradient.svg", 500, 500))
            {
                draw(surface);
                surface.WriteToPng("gradient2.png");
            }
        }
Exemplo n.º 12
0
        //---------------------------------------------------------------------
        private static void Demo01()
        {
            Action <Surface> draw = surface =>
            {
                using (var c = new Context(surface))
                {
                    c.Scale(500, 500);

                    c.Color = new Color(0, 0, 0);
                    c.MoveTo(0, 0);         // absetzen und neu beginnen
                    c.LineTo(1, 1);
                    c.MoveTo(1, 0);
                    c.LineTo(0, 1);
                    c.LineWidth = 0.2;
                    c.Stroke();             // Lininen zeichnen

                    c.Rectangle(0, 0, 0.5, 0.5);
                    c.Color = new Color(1, 0, 0, 0.8);
                    c.Fill();

                    c.Rectangle(0, 0.5, 0.5, 0.5);
                    c.Color = new Color(0, 1, 0, 0.6);
                    c.Fill();

                    c.Rectangle(0.5, 0, 0.5, 0.5);
                    c.Color = new Color(0, 0, 0, 0.4);
                    c.Fill();
                }
            };

            using (Surface surface = new ImageSurface(Format.Argb32, 500, 500))
            {
                draw(surface);
                surface.WriteToPng("demo01.png");
            }

            using (Surface surface = new PdfSurface("demo01.pdf", 500, 500))
                draw(surface);

            using (Surface surface = new SvgSurface("demo01.svg", 500, 500))
                draw(surface);
        }
Exemplo n.º 13
0
        //---------------------------------------------------------------------
        private static void Arrow()
        {
            Action <Surface> draw = surface =>
            {
                using (var c = new Context(surface))
                {
                    c.Scale(500, 500);

                    // Hat nur für PNG Relevanz:
                    c.Antialias = Antialias.Subpixel;

                    // Linienweite, wegen Maßstab so:
                    double ux = 1, uy = 1;
                    c.InverseTransformDistance(ref ux, ref uy);
                    c.LineWidth = Math.Max(ux, uy);

                    c.Color = new Color(0, 0, 1);
                    c.MoveTo(0.1, 0.10);
                    c.LineTo(0.9, 0.45);
                    c.Stroke();

                    c.Arrow(0.1, 0.50, 0.9, 0.95, 0.05, 10);
                    c.Stroke();
                }
            };

            using (Surface surface = new ImageSurface(Format.Argb32, 500, 500))
            {
                draw(surface);
                surface.WriteToPng("arrow.png");
            }

            using (Surface surface = new PdfSurface("arrow.pdf", 500, 500))
                draw(surface);

            using (Surface surface = new SvgSurface("arrow.svg", 500, 500))
                draw(surface);
        }
Exemplo n.º 14
0
        //---------------------------------------------------------------------
        private static void Primitives()
        {
            Action <Surface> draw = surface =>
            {
                using (var c = new Context(surface))
                {
                    c.Scale(4, 4);

                    // Stroke:
                    c.LineWidth = 0.1;
                    c.Color     = new Color(0, 0, 0);
                    c.Rectangle(10, 10, 10, 10);
                    c.Stroke();

                    c.Save();
                    {
                        c.Color = new Color(0, 0, 0);
                        c.Translate(20, 5);
                        c.MoveTo(0, 0);
                        c.LineTo(10, 5);
                        c.Stroke();
                    }
                    c.Restore();

                    // Fill:
                    c.Color = new Color(0, 0, 0);
                    c.SetSourceRGB(0, 0, 0);
                    c.Rectangle(10, 30, 10, 10);
                    c.Fill();

                    // Text:
                    c.Color = new Color(0, 0, 0);
                    c.SelectFontFace("Georgia", FontSlant.Normal, FontWeight.Bold);
                    c.SetFontSize(10);
                    TextExtents te = c.TextExtents("a");
                    c.MoveTo(
                        0.5 - te.Width / 2 - te.XBearing + 10,
                        0.5 - te.Height / 2 - te.YBearing + 50);
                    c.ShowText("a");

                    c.Color = new Color(0, 0, 0);
                    c.SelectFontFace("Arial", FontSlant.Normal, FontWeight.Bold);
                    c.SetFontSize(10);
                    te = c.TextExtents("a");
                    c.MoveTo(
                        0.5 - te.Width / 2 - te.XBearing + 10,
                        0.5 - te.Height / 2 - te.YBearing + 60);
                    c.ShowText("a");
                }
            };

            using (Surface surface = new ImageSurface(Format.Argb32, 200, 3200))
            {
                draw(surface);
                surface.WriteToPng("primitives.png");
            }

            using (Surface surface = new PdfSurface("primitives.pdf", 200, 3200))
                draw(surface);

            using (Surface surface = new SvgSurface("primitives.svg", 200, 3200))
                draw(surface);
        }
Exemplo n.º 15
0
        //---------------------------------------------------------------------
        private static void Hexagon()
        {
            Func <double, PointD[]> getHexagonPoints = cellSize =>
            {
                double ri = cellSize / 2;
                double r  = 2 * ri / Math.Sqrt(3);

                var      p1      = new PointD(0, r);
                var      p2      = new PointD(ri, r / 2);
                var      p3      = new PointD(ri, -r / 2);
                var      p4      = new PointD(0, -r);
                var      p5      = new PointD(-ri, -r / 2);
                var      p6      = new PointD(-ri, r / 2);
                PointD[] hexagon = { p1, p2, p3, p4, p5, p6 };

                return(hexagon);
            };

            Action <Surface> draw = surface =>
            {
                using (var c = new Context(surface))
                {
                    c.Scale(500, 500);

                    // Hat nur für PNG Relevanz:
                    c.Antialias = Antialias.Subpixel;

                    // Linienweite, wegen Maßstab so:
                    double ux = 1, uy = 1;
                    c.InverseTransformDistance(ref ux, ref uy);
                    c.LineWidth = Math.Max(ux, uy);

                    PointD[] hexagon = getHexagonPoints(0.5);
                    c.Save();
                    {
                        c.Translate(0.5, 0.5);
                        c.MoveTo(hexagon[0]);
                        c.LineTo(hexagon[1]);
                        c.LineTo(hexagon[2]);
                        c.LineTo(hexagon[3]);
                        c.LineTo(hexagon[4]);
                        c.LineTo(hexagon[5]);
                        c.ClosePath();
                        c.Stroke();
                    }
                    c.Restore();

                    c.Color = new Color(0, 0, 1);
                    ux      = 0.1; uy = 0.1;
                    c.InverseTransformDistance(ref ux, ref uy);
                    c.LineWidth = Math.Max(ux, uy);

                    c.MoveTo(0.5, 0);
                    c.LineTo(0.5, 1);
                    c.MoveTo(0, 0.5);
                    c.LineTo(1, 0.5);
                    c.Stroke();
                }
            };

            using (Surface surface = new ImageSurface(Format.Argb32, 500, 500))
            {
                draw(surface);
                surface.WriteToPng("hexagon.png");
            }

            using (Surface surface = new PdfSurface("hexagon.pdf", 500, 500))
            {
                draw(surface);
                surface.WriteToPng("hexagon1.png");
            }

            using (Surface surface = new SvgSurface("hexagon.svg", 500, 500))
            {
                draw(surface);
                surface.WriteToPng("hexagon2.png");
            }
        }
Exemplo n.º 16
0
        //---------------------------------------------------------------------
        private static void PaintAfter()
        {
            Pattern pattern = null;

            using (Surface surface = new SvgSurface("test.svg", 300, 300))
                using (var c = new Context(surface))
                {
                    // Draw to group
                    c.PushGroup();
                    {
                        var hex = new Hexagon(150);
                        hex.Fill(c, 150, 150, new Color(0.8, 0.8, 0.8));
                    }
                    // Get group
                    pattern = c.PopGroup();

                    c.Source = pattern;

                    // Draw (without mask, hence everything that's in the source)
                    c.Paint();
                }

            using (Surface pdfSurface = new PdfSurface("test1.pdf", 300, 300))
                using (Surface svgSurface = new SvgSurface("test1.svg", 300, 300))
                    using (var c = new Context(svgSurface))
                    {
                        c.PushGroup();
                        {
                            c.Source = pattern;
                            c.Paint();
                            //pattern.Destroy();

                            c.Color = new Color(0, 0, 1);

                            c.LineWidth = 0.1;
                            c.MoveTo(0, 150);
                            c.LineTo(300, 150);
                            c.MoveTo(150, 0);
                            c.LineTo(150, 300);
                            c.Stroke();

                            c.Color = new Color(0, 0, 0);
                            //c.SelectFontFace("Georgia", FontSlant.Normal, FontWeight.Bold);
                            //c.SelectFontFace("Rockwell", FontSlant.Normal, FontWeight.Normal);
                            c.SelectFontFace("Arial", FontSlant.Normal, FontWeight.Normal);
                            //c.SelectFontFace("Times New Roman", FontSlant.Normal, FontWeight.Normal);
                            c.SetFontSize(16);
                            string text = "Hexagon with coordinate-axis";
                            //string text = "III";

                            // Determine the width of the text
                            double textWidth = c.GetTextWidth(text);

                            c.Save();
                            c.Translate((300 - textWidth) / 2, 16);
                            {
                                c.ShowText(text);
                            }
                            c.Restore();

                            c.MoveTo(0, 0);
                            c.LineTo(300, 300);
                            c.MoveTo(0, 300);
                            c.LineTo(300, 0);
                            c.Stroke();

                            c.Save();
                            c.Translate(16, 300);
                            c.Rotate(-Math.PI / 2);
                            c.Translate((300 - textWidth) / 2, 0);
                            {
                                c.ShowText(text);
                            }
                            c.Restore();

                            // Draw scala
                            c.Save();
                            c.Translate(270, 20);
                            {
                                // Farbverlauf:
                                Gradient linpat = new LinearGradient(0, 0, 0, 260);
                                linpat.AddColorStop(0, new Color(0, 1, 0));
                                linpat.AddColorStop(0.5, new Color(0, 0, 1));
                                linpat.AddColorStop(1, new Color(1, 0, 0));
                                c.Rectangle(0, 0, 20, 260);
                                c.Source = linpat;
                                //c.Fill();
                                c.FillPreserve();

                                c.Color     = new Color(0, 0, 0);
                                c.LineWidth = 1;
                                //c.Rectangle(0, 0, 20, 260);
                                c.Stroke();
                            }
                            c.Restore();
                        }
                        pattern  = c.PopGroup();
                        c.Source = pattern;
                        c.Paint();

                        using (var c1 = new Context(pdfSurface))
                        {
                            c1.Color = new Color(1, 1, 1, 0);
                            c1.Rectangle(0, 0, 300, 300);
                            c1.Fill();

                            c1.Source = pattern;
                            c1.Paint();

                            pdfSurface.WriteToPng("test1.png");
                        }
                    }
        }