Exemplo n.º 1
0
        public PDFPen(Color color, double thickness, PenStyle style = PenStyle.Solid)
        {
            Color     = color;
            Thickness = thickness;
            Style     = style;

            pdfColor = new PDFColor(Color);

            //and somehow this have to translate into  0 0 0 RG [] 0 d 1 w thickness
            // color  = 0 0 0 RG color.R + color.G + color.B + RG
            // style either normal or dashed for now = [] or [3] the number inside the parenthesis represent the length of each each dash
            //thickness will replace number infront of w
        }
Exemplo n.º 2
0
        public void DrawString(string text, PDFFont font, Color color, double x, double y)
        {
            var initString = new StringBuilder();

            pdfColor = new PDFColor(color);

            var pdfFont = pdfBuilder.GetFont(font);

            initString.Append(pdfColor.R.ToString("N2"));
            initString.Append(PDFConstant.Space);
            initString.Append(pdfColor.G.ToString("N2"));
            initString.Append(PDFConstant.Space);
            initString.Append(pdfColor.B.ToString("N2"));
            initString.Append(PDFConstant.Space);
            initString.Append(PDFConstant.ColorInside);
            initString.Append(PDFConstant.Space);

            initString.Append(PDFConstant.BeginText);
            initString.Append(pdfFont); // to distinguish if FontOne or FontTwo later
            initString.Append(PDFConstant.Space);
            initString.Append(font.FontSize);
            initString.Append(PDFConstant.Space);
            initString.Append(PDFConstant.TextLocation);
            initString.Append(PDFConstant.Space);
            initString.Append(x);
            initString.Append(PDFConstant.Space);
            initString.Append(Height - y);
            initString.Append(PDFConstant.Space);
            initString.Append(PDFConstant.TextOpen);
            initString.Append(PDFConstant.Space);
            initString.Append(text);
            initString.Append(PDFConstant.Space);
            initString.Append(PDFConstant.TextClose);
            initString.Append(PDFConstant.Space);
            initString.Append(PDFConstant.EndText);
            initString.Append(PDFConstant.NewLine);

            pdfBuilder.BuildNewObject(initString);
        }