Files
SourceCode/PROMS/Volian.Print.Library/vlnText.cs
T

35 lines
1.2 KiB
C#

using iTextSharp.text.pdf;
using VEPROMS.CSLA.Library;
namespace Volian.Print.Library
{
public partial class vlnText : vlnPrintObject
{
public string Text { get; set; }
public VE_Font MyFont { get; set; }
public vlnText(PdfContentByte cb, vlnParagraph myparent, string origText, string cleanText, float xoffset, float yoffset, VE_Font vFont)
{
MyContentByte = cb;
MyParent = myparent;
YOffset = yoffset;
Text = cleanText;
Rtf = GetRtf(origText, vFont);
XOffset = xoffset;
MyFont = vFont;
Width = MyFont.CharsToTwips * (Text.Length + 5);
}
public vlnText()
{
}
public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
{
// The END message was not printing for NSP. The yLocation was getting set to a negative number, thus printing off the page.
// Found that the YOffset, cacluated when the bottom message was created, is really the actual location, at least in this case.
float yLocation = CalculateYOffset(yPageStart, yTopMargin);
if (yLocation < 0) yLocation = YOffset;
Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, "", yBottomMargin);
return yPageStart;
}
}
}