Added suffix to GetParagraphHeight to calculate the height of the Continue Message.
Added ContinueHeight property to calculate tthe height of the Section continue message.
This commit is contained in:
parent
5d227213c5
commit
6732e6c9fc
@ -978,7 +978,7 @@ namespace Volian.Print.Library
|
|||||||
|
|
||||||
// get height - if two lines high, need width of 2nd line for adding
|
// get height - if two lines high, need width of 2nd line for adding
|
||||||
// space characters
|
// space characters
|
||||||
float heightTtl = vlnPrintObject.GetHeight(cb, myparagrapht, savTitleWid, false);
|
float heightTtl = vlnPrintObject.GetHeight(cb, myparagrapht, string.Empty, savTitleWid, false);
|
||||||
string spaceStr = "";
|
string spaceStr = "";
|
||||||
float startSpace = 0;
|
float startSpace = 0;
|
||||||
// the '6's in the next few code lines & in the 'while' loop below allows the placement of the dots (or other space character)
|
// the '6's in the next few code lines & in the 'while' loop below allows the placement of the dots (or other space character)
|
||||||
|
@ -33,7 +33,7 @@ namespace Volian.Print.Library
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_Height == 0)
|
if (_Height == 0)
|
||||||
_Height = GetParagraphHeight(MyContentByte, IParagraph, Width);
|
_Height = GetParagraphHeight(MyContentByte, IParagraph,string.Empty, Width);
|
||||||
return _Height;
|
return _Height;
|
||||||
}
|
}
|
||||||
set { _Height = value; }
|
set { _Height = value; }
|
||||||
|
@ -207,7 +207,7 @@ namespace Volian.Print.Library
|
|||||||
myparagraph.Alignment = MessageAlignment;
|
myparagraph.Alignment = MessageAlignment;
|
||||||
myparagraph.Leading = iFont.Size;
|
myparagraph.Leading = iFont.Size;
|
||||||
float w = GetTableWidth(cb, myparagraph, MyParent.MyItemInfo.MyDocStyle.Layout.PageWidth);
|
float w = GetTableWidth(cb, myparagraph, MyParent.MyItemInfo.MyDocStyle.Layout.PageWidth);
|
||||||
float h = GetParagraphHeight(cb, myparagraph, w);
|
float h = GetParagraphHeight(cb, myparagraph, string.Empty, w);
|
||||||
cb.SetColorFill(changeBarColor);
|
cb.SetColorFill(changeBarColor);
|
||||||
float yloc = yBottom + h - Rtf2Pdf.Offset.Y + 2.7F;
|
float yloc = yBottom + h - Rtf2Pdf.Offset.Y + 2.7F;
|
||||||
if (_MsgAtTop)
|
if (_MsgAtTop)
|
||||||
|
@ -1097,6 +1097,24 @@ namespace Volian.Print.Library
|
|||||||
return (prTab + thisTab.Trim()).TrimEnd(".".ToCharArray());
|
return (prTab + thisTab.Trim()).TrimEnd(".".ToCharArray());
|
||||||
}
|
}
|
||||||
private static bool DoSubs = true; // flag whether to print substeps (don't if doing continued checklist header)
|
private static bool DoSubs = true; // flag whether to print substeps (don't if doing continued checklist header)
|
||||||
|
protected float _ContinueHeight=0;
|
||||||
|
public virtual float ContinueHeight
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
int profileDepth = ProfileTimer.Push(">>>> vlnPrintObject.ContinueHeight");
|
||||||
|
if (_ContinueHeight == 0
|
||||||
|
&& MyItemInfo.MyDocStyle.Continue.Top.Message.Contains("%s")
|
||||||
|
&& MyItemInfo.MyDocStyle.Continue.Top.Message.ToUpper().EndsWith(" (Continued)".ToUpper()))
|
||||||
|
{
|
||||||
|
string suffix = MyItemInfo.MyDocStyle.Continue.Top.Message.Replace("%sR","").Replace("%s","");
|
||||||
|
_ContinueHeight = GetParagraphHeight(MyContentByte, IParagraph, suffix, Width);
|
||||||
|
}
|
||||||
|
ProfileTimer.Pop(profileDepth);
|
||||||
|
return _ContinueHeight;
|
||||||
|
}
|
||||||
|
set { _Height = value; }
|
||||||
|
}
|
||||||
public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
|
public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
|
||||||
{
|
{
|
||||||
int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.ToPdf");
|
int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.ToPdf");
|
||||||
|
@ -125,21 +125,21 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
int profileDepth = ProfileTimer.Push(">>>> vlnPrintObject.Height");
|
int profileDepth = ProfileTimer.Push(">>>> vlnPrintObject.Height");
|
||||||
if (_Height == 0)
|
if (_Height == 0)
|
||||||
_Height = GetParagraphHeight(MyContentByte, IParagraph, Width);
|
_Height = GetParagraphHeight(MyContentByte, IParagraph, string.Empty, Width);
|
||||||
ProfileTimer.Pop(profileDepth);
|
ProfileTimer.Pop(profileDepth);
|
||||||
return _Height;
|
return _Height;
|
||||||
}
|
}
|
||||||
set { _Height = value; }
|
set { _Height = value; }
|
||||||
}
|
}
|
||||||
public float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, float width)
|
public float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width)
|
||||||
{
|
{
|
||||||
return GetParagraphHeight(cb, iParagraph, width, true);
|
return GetParagraphHeight(cb, iParagraph, suffix, width, true);
|
||||||
}
|
}
|
||||||
public float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, float width, bool throwException)
|
public float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width, bool throwException)
|
||||||
{
|
{
|
||||||
VlnSvgPageHelper ph = null;
|
VlnSvgPageHelper ph = null;
|
||||||
if(cb != null) ph = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
if(cb != null) ph = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||||
float heightAll = GetHeight(cb, iParagraph, width, throwException);
|
float heightAll = GetHeight(cb, iParagraph, suffix, width, throwException);
|
||||||
if (ph != null && ph.MyPromsPrinter.DebugOutput && !MyPageHelper.Back32BitPROMS)
|
if (ph != null && ph.MyPromsPrinter.DebugOutput && !MyPageHelper.Back32BitPROMS)
|
||||||
{
|
{
|
||||||
vlnParagraph myParagraph = this as vlnParagraph;
|
vlnParagraph myParagraph = this as vlnParagraph;
|
||||||
@ -192,11 +192,20 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
return chk;
|
return chk;
|
||||||
}
|
}
|
||||||
public static float GetHeight(PdfContentByte cb, Paragraph iParagraph, float width, bool throwException)
|
public static float GetHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width, bool throwException)
|
||||||
{
|
{
|
||||||
ColumnText myColumnText = new ColumnText(cb);
|
ColumnText myColumnText = new ColumnText(cb);
|
||||||
myColumnText.SetSimpleColumn(0, 792F, width, 0); // Bottom margin
|
myColumnText.SetSimpleColumn(0, 792F, width, 0); // Bottom margin
|
||||||
|
if (suffix != string.Empty)
|
||||||
|
{
|
||||||
|
Chunk chk = iParagraph.Chunks[0] as Chunk;
|
||||||
|
iParagraph.Add(new Chunk(suffix, chk.Font));
|
||||||
|
myColumnText.AddText(iParagraph);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
myColumnText.AddElement(iParagraph);
|
myColumnText.AddElement(iParagraph);
|
||||||
|
}
|
||||||
//myColumnText.UseAscender = true;// Adjusts to the top of the text box.
|
//myColumnText.UseAscender = true;// Adjusts to the top of the text box.
|
||||||
int status = myColumnText.Go(true); // Check to see if it will fit on the page.
|
int status = myColumnText.Go(true); // Check to see if it will fit on the page.
|
||||||
if (ColumnText.HasMoreText(status) && throwException)
|
if (ColumnText.HasMoreText(status) && throwException)
|
||||||
@ -207,13 +216,13 @@ namespace Volian.Print.Library
|
|||||||
public float GetTableWidth(PdfContentByte cb, Paragraph iParagraph, float? maxWidth)
|
public float GetTableWidth(PdfContentByte cb, Paragraph iParagraph, float? maxWidth)
|
||||||
{
|
{
|
||||||
int iWidth = (int)(maxWidth ?? 72 * 8.5F);
|
int iWidth = (int)(maxWidth ?? 72 * 8.5F);
|
||||||
float h = GetParagraphHeight(cb, iParagraph, iWidth);
|
float h = GetParagraphHeight(cb, iParagraph, string.Empty, iWidth);
|
||||||
int iWidthMax = iWidth; // maximum width in Characters
|
int iWidthMax = iWidth; // maximum width in Characters
|
||||||
int iDelta = iWidth / 2;
|
int iDelta = iWidth / 2;
|
||||||
iWidth = iWidth / 2;
|
iWidth = iWidth / 2;
|
||||||
while (iDelta > 0)
|
while (iDelta > 0)
|
||||||
{
|
{
|
||||||
float h2 = GetParagraphHeight(cb, iParagraph, iWidth,false);
|
float h2 = GetParagraphHeight(cb, iParagraph, string.Empty, iWidth,false);
|
||||||
iDelta = iDelta / 2;
|
iDelta = iDelta / 2;
|
||||||
if (h2 == h) iWidthMax = iWidth;
|
if (h2 == h) iWidthMax = iWidth;
|
||||||
iWidth += (h2>h ? 1: -1) * iDelta;
|
iWidth += (h2>h ? 1: -1) * iDelta;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user