public void Text(PdfStyleText textStyle, PdfPoint point, PdfTextAlign align, string txt) { if (textStyle is null) { throw new ArgumentNullException(nameof(textStyle)); } if (!string.IsNullOrEmpty(txt)) { SetTextStyle(textStyle); if (align != PdfTextAlign.Left) { PdfDistance Width = textStyle.Font.TextWidth(textStyle.FontSize, txt); switch (align) { case PdfTextAlign.Right: point.x -= Width; break; case PdfTextAlign.Center: point.x -= Width / 2; break; } } SetTextMatrixH(point); opShowText(txt, 0, txt.Length); } }
public PdfRectangle(PdfDistance llx, PdfDistance lly, PdfDistance urx, PdfDistance ury) { this.llx = llx; this.lly = lly; this.urx = urx; this.ury = ury; }
public void Text(PdfStyleText textStyle, PdfPoint point, PdfTextAlign align, double rotation, string txt) { if (textStyle is null) { throw new ArgumentNullException(nameof(textStyle)); } if (!string.IsNullOrEmpty(txt)) { SetTextStyle(textStyle); rotation *= Math.PI / 180.0; double Rotation_Sin = Math.Round(Math.Sin(rotation), 5); double Rotation_Cos = Math.Round(Math.Cos(rotation), 5); if (align != PdfTextAlign.Left) { PdfDistance Width = textStyle.Font.TextWidth(textStyle.FontSize, txt); if (align == PdfTextAlign.Center) { Width = Width / 2.0; } point.x -= Width * Rotation_Cos; point.y -= Width * Rotation_Sin; } SetTextMatrix(point, Rotation_Sin, Rotation_Cos); opShowText(txt, 0, txt.Length); } }
public PdfStyleText() { _locked = false; _font = null; _fontSize = new PdfDistance(12.0); _lineSpacing = 1; _textColor = null; }
public PdfDistance CharWidth(PdfDistance FontSize, char c) { if (Encode(c) == '?') { c = '?'; } AfmCharMetric metric = _charMetric[c]; return(new PdfDistance(FontSize.pnts * (double)(metric != null ? metric.Width : _fontBBox.urX) / 1000.0)); }
public PdfStyleLine() { _locked = false; _lineColor = null; _lineWidth = new PdfDistance(1.0); _capStyle = PdfLineCapStyle.Butt; _joinStyle = PdfLineJoinStyle.Bevel; _miterLimit = 1.0; _dashArray = null; _dashPhase = new PdfDistance(0); }
public PdfStyleText(PdfStyleText style) { if (style is null) { throw new ArgumentNullException(nameof(style)); } _locked = false; _font = style._font; _fontSize = style._fontSize; _lineSpacing = style._lineSpacing; _textColor = style._textColor; }
public PdfStyleText(PdfFont font, PdfDistance size) { if (font is null) { throw new ArgumentNullException(nameof(font)); } _locked = true; _font = font; _fontSize = size; _lineSpacing = 1.1; _textColor = PdfColorCMYK.ncBlack; }
public void opSelectFont(PdfFont font, PdfDistance size) { if (font is null) { throw new ArgumentNullException(nameof(font)); } WriteResourceName(font); WriteNumber(size.pnts, 2, true); WriteStr(bs_Tf); _curFont = font; _curFontSize = size; }
public PdfStyleText(PdfFont font, PdfDistance size, double lineSpacing, PdfColor textColor) { if (font is null) { throw new ArgumentNullException(nameof(font)); } _locked = true; _font = font; _fontSize = size; _lineSpacing = lineSpacing; _textColor = textColor; }
private void _init() { _resources = new PdfResourceEntryList(); _dataStream = new StreamBuffer(); _curStrokeColorSpace = null; _curNonStrokeColorSpace = null; _curStrokeColor = null; _curNonStrokeColor = null; _curLineWidth = new PdfDistance(-1); _curLineCap = PdfLineCapStyle.Unknown; _curLineJoin = PdfLineJoinStyle.Unknown; _curMiterLimit = -1; _curDashArray = null; _curDashPhase = new PdfDistance(-1); }
public PdfStyleLine(PdfColor lineColor, PdfDistance lineWidth) { if (lineColor is null) { throw new ArgumentNullException(nameof(lineColor)); } _locked = true; _lineColor = lineColor; _lineWidth = lineWidth; _capStyle = PdfLineCapStyle.Butt; _joinStyle = PdfLineJoinStyle.Bevel; _miterLimit = 1.0; _dashArray = null; _dashPhase = new PdfDistance(0); }
public PdfStyleLine(PdfStyleLine style) { if (style is null) { throw new ArgumentNullException(nameof(style)); } _locked = false; _lineColor = style._lineColor; _lineWidth = style._lineWidth; _capStyle = style._capStyle; _joinStyle = style._joinStyle; _miterLimit = style._miterLimit; _dashArray = style._dashArray; _dashPhase = style._dashPhase; }
public PdfStyleLine(PdfColor lineColor, PdfDistance lineWith, PdfLineCapStyle CapStyle, PdfLineJoinStyle joinStyle, double miterLimit, PdfDistance[] dashArray, PdfDistance dashPhase) { if (lineColor is null) { throw new ArgumentNullException(nameof(lineColor)); } _locked = true; _lineColor = lineColor; _lineWidth = lineWith; _capStyle = CapStyle; _joinStyle = joinStyle; _miterLimit = miterLimit; _dashArray = dashArray; _dashPhase = dashPhase; }
public void opSetDash(PdfDistance[] dashArray, PdfDistance dashPhase) { WriteByte((byte)'['); if (dashArray != null) { for (int i = 0; i < dashArray.Length; ++i) { WriteNumber(dashArray[i].pnts, 2, i < dashArray.Length - 1); } } WriteByte((byte)']'); WriteByte((byte)' '); WriteNumber(dashPhase.pnts, 2, true); WriteStr(bs_d); _curDashArray = dashArray; _curDashPhase = dashPhase; }
public PdfDistance TextWidth(PdfDistance fontSize, string text) { int width = 0; if (text != null) { for (int i = 0; i < text.Length; ++i) { char c = text[i]; if (Encode(c) == '?') { c = '?'; } AfmCharMetric Metric = _charMetric[c]; width += (Metric != null) ? Metric.Width : _fontBBox.urX; } } return(new PdfDistance(fontSize.pnts * (double)width / 1000.0)); }
public PdfSize(PdfDistance width, PdfDistance height) { this.width = width; this.height = height; }
public void TextBox(PdfPoint upperLeftCorner, PdfStyleText style, PdfTextAlign align, PdfDistance width, int maxLines, string text) { if (!string.IsNullOrEmpty(text)) { Formatter.TextBox TextBox = new Formatter.TextBox(style, align, width, maxLines, text); TextBox.Print(upperLeftCorner, this); } }
public void opSetLineWidth(PdfDistance width) { WriteNumber(width.pnts, 2, true); WriteStr(bs_w); _curLineWidth = width; }
public PdfPoint SubY(PdfDistance d) { return(new PdfPoint(x, y - d)); }
public PdfPoint SubX(PdfDistance d) { return(new PdfPoint(x - d, y)); }
public PdfPoint AddY(PdfDistance d) { return(new PdfPoint(x, y + d)); }
public PdfPoint AddX(PdfDistance d) { return(new PdfPoint(x + d, y)); }
public PdfPoint(PdfDistance x, PdfDistance y) { this.x = x; this.y = y; }