87 lines
2.0 KiB
C#
87 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Drawing;
|
|
using iTextSharp.text.pdf;
|
|
using iTextSharp.text;
|
|
using VEPROMS.CSLA.Library;
|
|
|
|
namespace Volian.Print.Library
|
|
{
|
|
public partial class vlnTab : vlnPrintObject
|
|
{
|
|
public float TabWidth
|
|
{
|
|
get { return _CharsToTwips * TabText.Length; }
|
|
}
|
|
private float? _TabAlign;
|
|
/// <summary>
|
|
/// Used to Align Tabs for numeric tabs that can go to 2 digits
|
|
/// </summary>
|
|
public float TabAlign // Offset to Last printable character
|
|
{
|
|
get
|
|
{
|
|
if (_TabAlign == null)
|
|
{
|
|
_TabAlign = 0;
|
|
if (_TabText != null)
|
|
{
|
|
while (_TabText[(int)_TabAlign] == ' ')
|
|
_TabAlign++;
|
|
if ("0123456789".Contains(_TabText[(int)_TabAlign].ToString()))
|
|
{
|
|
while ("0123456789".Contains(_TabText[(int)_TabAlign].ToString()))
|
|
_TabAlign++;
|
|
_TabAlign--;
|
|
}
|
|
}
|
|
}
|
|
return (float)_TabAlign * _CharsToTwips;
|
|
}
|
|
}
|
|
private float? _TabOffset;
|
|
public float TabOffset // Offset to first printable character
|
|
{
|
|
get
|
|
{
|
|
if (_TabOffset == null)
|
|
{
|
|
_TabOffset = 0;
|
|
if (_TabText != null)
|
|
while (_TabText[(int)_TabOffset] == ' ')
|
|
_TabOffset++;
|
|
}
|
|
return (float)_TabOffset * _CharsToTwips;
|
|
}
|
|
}
|
|
private string _TabText;
|
|
public string TabText
|
|
{
|
|
get { return _TabText; }
|
|
set { _TabText = value; }
|
|
}
|
|
private VE_Font _MyFont;
|
|
public VE_Font MyFont
|
|
{
|
|
get { return _MyFont; }
|
|
set { _MyFont = value; }
|
|
}
|
|
public vlnTab(PdfContentByte cb, string origTab, string cleanTab, float xoffset, float yoffset, VE_Font vFont)
|
|
{
|
|
MyContentByte = cb;
|
|
YOffset = yoffset;
|
|
TabText = cleanTab;
|
|
Rtf = GetRtf(origTab, vFont);
|
|
XOffset = xoffset - TabWidth;
|
|
MyFont = vFont;
|
|
}
|
|
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
|
|
{
|
|
float yLocation = CalculateYOffset(yPageStart, yTopMargin);
|
|
Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, TabWidth, 100, "");
|
|
return yPageStart;
|
|
}
|
|
}
|
|
}
|