This commit is contained in:
parent
ef5f141b03
commit
7b018d1abb
@ -14,6 +14,18 @@ namespace Volian.Print.Library
|
|||||||
|
|
||||||
public class VlnSvgPageHelper:SvgPageHelper
|
public class VlnSvgPageHelper:SvgPageHelper
|
||||||
{
|
{
|
||||||
|
private vlnText _TopMessage;
|
||||||
|
public vlnText TopMessage
|
||||||
|
{
|
||||||
|
get { return _TopMessage; }
|
||||||
|
set { _TopMessage = value; }
|
||||||
|
}
|
||||||
|
private vlnText _BottomMessage;
|
||||||
|
public vlnText BottomMessage
|
||||||
|
{
|
||||||
|
get { return _BottomMessage; }
|
||||||
|
set { _BottomMessage = value; }
|
||||||
|
}
|
||||||
//vlnParagraphs _MyParagraphs = new vlnParagraphs(null);
|
//vlnParagraphs _MyParagraphs = new vlnParagraphs(null);
|
||||||
//public vlnParagraphs MyParagraphs
|
//public vlnParagraphs MyParagraphs
|
||||||
//{
|
//{
|
||||||
@ -36,12 +48,26 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
base.OnEndPage(writer, document);
|
base.OnEndPage(writer, document);
|
||||||
DrawChangeBars(writer.DirectContent);
|
DrawChangeBars(writer.DirectContent);
|
||||||
|
DrawMessages(writer.DirectContent);
|
||||||
//DrawBackground(writer.DirectContentUnder);
|
//DrawBackground(writer.DirectContentUnder);
|
||||||
//DrawPageList(writer.DirectContent);
|
//DrawPageList(writer.DirectContent);
|
||||||
//DrawWatermark(writer.DirectContentUnder);
|
//DrawWatermark(writer.DirectContentUnder);
|
||||||
//DrawZoomOMatic(writer.DirectContent);
|
//DrawZoomOMatic(writer.DirectContent);
|
||||||
//CurrentPageNumber++;
|
//CurrentPageNumber++;
|
||||||
}
|
}
|
||||||
|
private void DrawMessages(PdfContentByte cb)
|
||||||
|
{
|
||||||
|
if (TopMessage != null)
|
||||||
|
{
|
||||||
|
TopMessage.ToPdf(cb, 0, 0, 0);
|
||||||
|
TopMessage = null; // Only output it once.
|
||||||
|
}
|
||||||
|
if (BottomMessage != null)
|
||||||
|
{
|
||||||
|
BottomMessage.ToPdf(cb, 0, 0, 0);
|
||||||
|
BottomMessage = null; // Only output it once.
|
||||||
|
}
|
||||||
|
}
|
||||||
private void DrawChangeBars(PdfContentByte cb)
|
private void DrawChangeBars(PdfContentByte cb)
|
||||||
{
|
{
|
||||||
foreach (vlnChangeBar vcb in MyChangeBars)
|
foreach (vlnChangeBar vcb in MyChangeBars)
|
||||||
@ -195,16 +221,16 @@ namespace Volian.Print.Library
|
|||||||
if (cb.MyParent.MyItemInfo.MyHLS.ItemID != vcb.MyParent.MyItemInfo.MyHLS.ItemID) return false;
|
if (cb.MyParent.MyItemInfo.MyHLS.ItemID != vcb.MyParent.MyItemInfo.MyHLS.ItemID) return false;
|
||||||
// cb.Yoffset is within range of vcb:
|
// cb.Yoffset is within range of vcb:
|
||||||
if (cb.YOffset <= vcb.YOffset &&
|
if (cb.YOffset <= vcb.YOffset &&
|
||||||
cb.YOffset >= (vcb.YChangeBarBottomExtend - vlnPrintObject._SixLinesPerInch)) return true;
|
cb.YOffset >= (vcb.YChangeBarBottomExtend - vlnPrintObject.SixLinesPerInch)) return true;
|
||||||
// cb.YChangeBarBottom is within range of vcb:
|
// cb.YChangeBarBottom is within range of vcb:
|
||||||
if ((cb.YChangeBarBottomExtend-vlnPrintObject._SixLinesPerInch) <= vcb.YOffset &&
|
if ((cb.YChangeBarBottomExtend-vlnPrintObject.SixLinesPerInch) <= vcb.YOffset &&
|
||||||
cb.YChangeBarBottomExtend >= (vcb.YChangeBarBottomExtend - vlnPrintObject._SixLinesPerInch)) return true;
|
cb.YChangeBarBottomExtend >= (vcb.YChangeBarBottomExtend - vlnPrintObject.SixLinesPerInch)) return true;
|
||||||
// vcb.Yoffset is within range of cb:
|
// vcb.Yoffset is within range of cb:
|
||||||
if (vcb.YOffset <= cb.YOffset &&
|
if (vcb.YOffset <= cb.YOffset &&
|
||||||
vcb.YOffset >= (cb.YChangeBarBottomExtend - vlnPrintObject._SixLinesPerInch)) return true;
|
vcb.YOffset >= (cb.YChangeBarBottomExtend - vlnPrintObject.SixLinesPerInch)) return true;
|
||||||
// vcb.YChangeBarBottom is within range of cb:
|
// vcb.YChangeBarBottom is within range of cb:
|
||||||
if ((vcb.YChangeBarBottomExtend - vlnPrintObject._SixLinesPerInch) <= cb.YOffset &&
|
if ((vcb.YChangeBarBottomExtend - vlnPrintObject.SixLinesPerInch) <= cb.YOffset &&
|
||||||
vcb.YChangeBarBottomExtend >= (cb.YChangeBarBottomExtend - vlnPrintObject._SixLinesPerInch)) return true;
|
vcb.YChangeBarBottomExtend >= (cb.YChangeBarBottomExtend - vlnPrintObject.SixLinesPerInch)) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public VlnSvgPageHelper(VEPROMS.CSLA.Library.SectionInfo mySection)
|
public VlnSvgPageHelper(VEPROMS.CSLA.Library.SectionInfo mySection)
|
||||||
|
@ -32,7 +32,12 @@ namespace Volian.Print.Library
|
|||||||
protected static float _WidthAdjust = 1; // 1 Point - adjusted to match 16-bit line wrapping. For editting it's 3.
|
protected static float _WidthAdjust = 1; // 1 Point - adjusted to match 16-bit line wrapping. For editting it's 3.
|
||||||
protected static float _WidthAdjustBox = 6;
|
protected static float _WidthAdjustBox = 6;
|
||||||
protected static float _CharsToTwips = 6; // assumes 12 char per inch
|
protected static float _CharsToTwips = 6; // assumes 12 char per inch
|
||||||
internal static float _SixLinesPerInch = 12; // twips
|
private static float _SixLinesPerInch = 12; // twips
|
||||||
|
public static float SixLinesPerInch
|
||||||
|
{
|
||||||
|
get { return vlnPrintObject._SixLinesPerInch; }
|
||||||
|
set { vlnPrintObject._SixLinesPerInch = value; }
|
||||||
|
}
|
||||||
protected static float _SevenLinesPerInch = 10.1F;//72F / 7F;
|
protected static float _SevenLinesPerInch = 10.1F;//72F / 7F;
|
||||||
|
|
||||||
protected float _XOffset;
|
protected float _XOffset;
|
||||||
@ -196,7 +201,8 @@ namespace Volian.Print.Library
|
|||||||
StringBuilder rtfSB = new StringBuilder();
|
StringBuilder rtfSB = new StringBuilder();
|
||||||
//DisplayText vlntxt = new DisplayText(text.TrimStart(" ".ToCharArray()), vFont, false);
|
//DisplayText vlntxt = new DisplayText(text.TrimStart(" ".ToCharArray()), vFont, false);
|
||||||
DisplayText vlntxt = new DisplayText(text, vFont, false);
|
DisplayText vlntxt = new DisplayText(text, vFont, false);
|
||||||
rtfSB.Append(AddFontTable(vlntxt.TextFont.WindowsFont));
|
//rtfSB.Append(AddFontTable(vlntxt.TextFont.WindowsFont));
|
||||||
|
rtfSB.Append(AddFontTable(vFont.WindowsFont));
|
||||||
rtfSB.Append(vlntxt.StartText);
|
rtfSB.Append(vlntxt.StartText);
|
||||||
rtfSB.Append("}");
|
rtfSB.Append("}");
|
||||||
return rtfSB.ToString();
|
return rtfSB.ToString();
|
||||||
@ -266,19 +272,20 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
public void DebugPdf(PdfContentByte cb, float left, float top)
|
public void DebugPdf(PdfContentByte cb, float left, float top)
|
||||||
{
|
{
|
||||||
cb.SaveState();
|
|
||||||
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||||
PdfLayer debugLayer = _MyPageHelper == null ? null : _MyPageHelper.DebugLayer;
|
PdfLayer debugLayer = _MyPageHelper == null ? null : _MyPageHelper.DebugLayer;
|
||||||
if (debugLayer != null) cb.BeginLayer(debugLayer);
|
if (debugLayer == null) return;
|
||||||
|
cb.SaveState();
|
||||||
|
cb.BeginLayer(debugLayer);
|
||||||
ColumnText ct = new ColumnText(cb);
|
ColumnText ct = new ColumnText(cb);
|
||||||
ct.SetSimpleColumn(left, top, left+50, top - 50);
|
ct.SetSimpleColumn(left, top, left+50, top - 50);
|
||||||
iTextSharp.text.Font font = FontFactory.GetFont("Arial", 2);
|
iTextSharp.text.Font font = FontFactory.GetFont("Arial", 2);
|
||||||
Chunk chk = new Chunk(DebugId.ToString(), font);
|
Chunk chk = new Chunk(DebugId.ToString(), font);
|
||||||
Phrase ph = new Phrase(chk);
|
Phrase ph = new Phrase(chk);
|
||||||
ct.AddElement(ph);
|
ct.AddElement(ph);
|
||||||
cb.SetColorFill(new iTextSharp.text.Color(System.Drawing.Color.CadetBlue));
|
cb.SetColorFill(new iTextSharp.text.Color(PrintOverride.OverrideDebugColor(System.Drawing.Color.Gray)));
|
||||||
ct.Go();
|
ct.Go();
|
||||||
if (debugLayer != null) cb.EndLayer();
|
cb.EndLayer();
|
||||||
cb.RestoreState();
|
cb.RestoreState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
MyContentByte = cb;
|
MyContentByte = cb;
|
||||||
float yLocation = CalculateYOffset(yPageStart, yTopMargin);
|
float yLocation = CalculateYOffset(yPageStart, yTopMargin);
|
||||||
Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, "");
|
Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, "", yBottomMargin);
|
||||||
return yPageStart;
|
return yPageStart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,16 +8,12 @@ using VEPROMS.CSLA.Library;
|
|||||||
|
|
||||||
namespace Volian.Print.Library
|
namespace Volian.Print.Library
|
||||||
{
|
{
|
||||||
public partial class vlnTab : vlnPrintObject
|
public partial class vlnTab : vlnText
|
||||||
{
|
{
|
||||||
public float TabWidth
|
|
||||||
{
|
|
||||||
get { return _CharsToTwips * TabText.Length; }
|
|
||||||
}
|
|
||||||
private float? _TabAlign;
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to Align Tabs for numeric tabs that can go to 2 digits
|
/// Used to Align Tabs for numeric tabs that can go to 2 digits
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
private float? _TabAlign;
|
||||||
public float TabAlign // Offset to Last printable character
|
public float TabAlign // Offset to Last printable character
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -25,13 +21,13 @@ namespace Volian.Print.Library
|
|||||||
if (_TabAlign == null)
|
if (_TabAlign == null)
|
||||||
{
|
{
|
||||||
_TabAlign = 0;
|
_TabAlign = 0;
|
||||||
if (_TabText != null)
|
if (Text != null)
|
||||||
{
|
{
|
||||||
while (_TabText[(int)_TabAlign] == ' ')
|
while (Text[(int)_TabAlign] == ' ')
|
||||||
_TabAlign++;
|
_TabAlign++;
|
||||||
if ("0123456789".Contains(_TabText[(int)_TabAlign].ToString()))
|
if ("0123456789".Contains(Text[(int)_TabAlign].ToString()))
|
||||||
{
|
{
|
||||||
while ("0123456789".Contains(_TabText[(int)_TabAlign].ToString()))
|
while ("0123456789".Contains(Text[(int)_TabAlign].ToString()))
|
||||||
_TabAlign++;
|
_TabAlign++;
|
||||||
_TabAlign--;
|
_TabAlign--;
|
||||||
}
|
}
|
||||||
@ -48,38 +44,28 @@ namespace Volian.Print.Library
|
|||||||
if (_TabOffset == null)
|
if (_TabOffset == null)
|
||||||
{
|
{
|
||||||
_TabOffset = 0;
|
_TabOffset = 0;
|
||||||
if (_TabText != null)
|
if (Text != null)
|
||||||
while (_TabText[(int)_TabOffset] == ' ')
|
while (Text[(int)_TabOffset] == ' ')
|
||||||
_TabOffset++;
|
_TabOffset++;
|
||||||
}
|
}
|
||||||
return (float)_TabOffset * _CharsToTwips;
|
return (float)_TabOffset * _CharsToTwips;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private string _TabText;
|
public vlnTab(PdfContentByte cb, vlnParagraph myparent, string origTab, string cleanTab, float xoffset, float yoffset, VE_Font vFont)
|
||||||
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;
|
MyContentByte = cb;
|
||||||
|
MyParent = myparent;
|
||||||
YOffset = yoffset;
|
YOffset = yoffset;
|
||||||
TabText = cleanTab;
|
Text = cleanTab;
|
||||||
|
Width = _CharsToTwips * Text.Length;
|
||||||
Rtf = GetRtf(origTab, vFont);
|
Rtf = GetRtf(origTab, vFont);
|
||||||
XOffset = xoffset - TabWidth;
|
XOffset = xoffset - Width;
|
||||||
MyFont = vFont;
|
MyFont = vFont;
|
||||||
}
|
}
|
||||||
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
|
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
|
||||||
{
|
{
|
||||||
float yLocation = CalculateYOffset(yPageStart, yTopMargin);
|
float yLocation = CalculateYOffset(yPageStart, yTopMargin);
|
||||||
Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, TabWidth, 100, "");
|
Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, "", yBottomMargin);
|
||||||
return yPageStart;
|
return yPageStart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
50
PROMS/Volian.Print.Library/vlnText.cs
Normal file
50
PROMS/Volian.Print.Library/vlnText.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
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; // -Width;
|
||||||
|
MyFont = vFont;
|
||||||
|
Width = _CharsToTwips * (Text.Length + 2);
|
||||||
|
}
|
||||||
|
public vlnText()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
|
||||||
|
{
|
||||||
|
float yLocation = CalculateYOffset(yPageStart, yTopMargin);
|
||||||
|
Rtf2Pdf.TextAt(cb, IParagraph, XOffset, YOffset, Width, 100, "", yBottomMargin);
|
||||||
|
return yPageStart;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user