44 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.6 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 vlnHeader: vlnText
 | |
| 	{
 | |
| 		private string _OrigStr;
 | |
| 		public float HeaderWidth
 | |
| 		{
 | |
| 			get { return _WidthAdjust + (MyFont.CharsToTwips * Text.Length); }
 | |
| 		}
 | |
| 		public vlnHeader(vlnParagraph myParent, PdfContentByte cb, string origStr, string cleanStr, float xoffset, float yoffset, VE_Font vFont)
 | |
| 		{
 | |
| 			MyParent = myParent;
 | |
| 			MyContentByte = cb;
 | |
| 			YOffset = yoffset;
 | |
| 			Width = MyParent.Width;
 | |
| 			Text = cleanStr;
 | |
| 			_OrigStr = (origStr.StartsWith("  ") && !origStr.Contains(@"\"))?origStr:null;
 | |
| 			Rtf = GetRtf(origStr, vFont);
 | |
| 			XOffset = xoffset;
 | |
| 			MyFont = vFont;
 | |
| 		}
 | |
| 		public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
 | |
| 		{
 | |
| 			string fontFace = MyFont.WindowsFont.Name;
 | |
| 			int fontStyle = (MyFont.WindowsFont.Bold ? iTextSharp.text.Font.BOLD : 0) + (MyFont.WindowsFont.Italic ? iTextSharp.text.Font.ITALIC : 0);
 | |
| 			iTextSharp.text.Font itextFont = Volian.Svg.Library.Svg.GetFont(fontFace, MyFont.WindowsFont.Size, fontStyle, System.Drawing.Color.Black);
 | |
| 			float hdrwidth = itextFont.BaseFont.GetWidthPoint(Text, MyFont.WindowsFont.Size);
 | |
| 			if (_OrigStr != null) hdrwidth = itextFont.BaseFont.GetWidthPoint(_OrigStr, MyFont.WindowsFont.Size);
 | |
| 			hdrwidth += 5;
 | |
| 			float yLocation = CalculateYOffset(yPageStart, yTopMargin);
 | |
| 			Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, hdrwidth, 100, "", yBottomMargin);
 | |
| 			return yPageStart;
 | |
| 		}
 | |
| 	}
 | |
| }
 |