2012-11-08 17:10:04 +00:00

54 lines
1.5 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 vlnText : vlnPrintObject
{
//public float Width
//{
// get { return _CharsToTwips * Text.Length; }
//}
private string _Text;
public string Text
{
get { return _Text; }
set { _Text = value; }
}
private VE_Font _MyFont;
public VE_Font MyFont
{
get { return _MyFont; }
set { _MyFont = value; }
}
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 + 2);
}
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;
}
}
}