Exemplo n.º 1
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 3, m_name);

            SfPdf pdf = args[0] as SfPdf;

            Utils.CheckNotNull(pdf, m_name, script);

            //m_grapics.DrawLine(pen, x1, y1, x2, y2);
            //m_grapics.DrawRectangle(color, x, y, w, h);
            //m_grapics.DrawPie(pen, x, y, w, h, startAngle, swipeAngle);

            int x = Utils.GetSafeInt(args, 1);
            int y = Utils.GetSafeInt(args, 2);
            int w = Utils.GetSafeInt(args, 3);
            int h = Utils.GetSafeInt(args, 4);

            string   colorStr = Utils.GetSafeString(args, 5, "black");
            PdfBrush color    = SfUtils.String2PdfColor(colorStr);

            float startAngle = (float)Utils.GetSafeDouble(args, 6);
            float sweepAngle = (float)Utils.GetSafeDouble(args, 7);
            float lineWidth  = (float)Utils.GetSafeDouble(args, 8);

            pdf.Init();
            pdf.AddPie(x, y, w, h, startAngle, sweepAngle, color, lineWidth);

            ParserFunction.UpdateFunction(pdf);
            return(pdf);
        }
Exemplo n.º 2
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            SfPdf pdf = new SfPdf(true);

            return(pdf);
        }
Exemplo n.º 3
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 1, m_name);

            string filename = Utils.GetSafeString(args, 0);

            SfPdf pdf = new SfPdf(true);

            pdf.Open(filename);

            return(pdf);
        }
Exemplo n.º 4
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 2, m_name);

            SfPdf pdf = args[0] as SfPdf;

            Utils.CheckNotNull(pdf, m_name, script);

            string filename = Utils.GetSafeString(args, 1);

            pdf.Save(filename);

            ParserFunction.UpdateFunction(pdf);
            return(pdf);
        }
Exemplo n.º 5
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 3, m_name);

            SfPdf pdf = args[0] as SfPdf;

            Utils.CheckNotNull(pdf, m_name, script);

            string image = Utils.GetSafeString(args, 1);
            int    x     = Utils.GetSafeInt(args, 2);
            int    y     = Utils.GetSafeInt(args, 3);
            int    w     = Utils.GetSafeInt(args, 4);
            int    h     = Utils.GetSafeInt(args, 5);

            pdf.Init();
            pdf.AddImage(image, x, y, w, h);
            return(pdf);
        }
Exemplo n.º 6
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 3, m_name);

            SfPdf pdf = args[0] as SfPdf;

            Utils.CheckNotNull(pdf, m_name, script);

            string fontName = Utils.GetSafeString(args, 1);
            double newSize  = Utils.GetSafeDouble(args, 2);
            bool   bold     = Utils.GetSafeInt(args, 3) == 1;
            bool   italic   = Utils.GetSafeInt(args, 4) == 1;

            pdf.Init();
            pdf.SetFontOptions(fontName, (float)newSize, bold, italic);

            ParserFunction.UpdateFunction(pdf);
            return(pdf);
        }
Exemplo n.º 7
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 3, m_name);

            SfPdf pdf = args[0] as SfPdf;

            Utils.CheckNotNull(pdf, m_name, script);

            string text = Utils.GetSafeString(args, 1);
            int    x    = Utils.GetSafeInt(args, 2);
            int    y    = Utils.GetSafeInt(args, 3);

            string   colorStr = Utils.GetSafeString(args, 4, "black");
            PdfBrush color    = SfUtils.String2PdfColor(colorStr);

            pdf.Init();
            pdf.AddText(text, x, y, color);

            ParserFunction.UpdateFunction(pdf);
            return(pdf);
        }
Exemplo n.º 8
0
        public override Variable Clone()
        {
            SfPdf newVar = (SfPdf)this.MemberwiseClone();

            return(newVar);
        }