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
|
||||
// space characters
|
||||
float heightTtl = vlnPrintObject.GetHeight(cb, myparagrapht, savTitleWid, false);
|
||||
float heightTtl = vlnPrintObject.GetHeight(cb, myparagrapht, string.Empty, savTitleWid, false);
|
||||
string spaceStr = "";
|
||||
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)
|
||||
|
@ -33,7 +33,7 @@ namespace Volian.Print.Library
|
||||
get
|
||||
{
|
||||
if (_Height == 0)
|
||||
_Height = GetParagraphHeight(MyContentByte, IParagraph, Width);
|
||||
_Height = GetParagraphHeight(MyContentByte, IParagraph,string.Empty, Width);
|
||||
return _Height;
|
||||
}
|
||||
set { _Height = value; }
|
||||
|
@ -207,7 +207,7 @@ namespace Volian.Print.Library
|
||||
myparagraph.Alignment = MessageAlignment;
|
||||
myparagraph.Leading = iFont.Size;
|
||||
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);
|
||||
float yloc = yBottom + h - Rtf2Pdf.Offset.Y + 2.7F;
|
||||
if (_MsgAtTop)
|
||||
|
@ -1097,6 +1097,24 @@ namespace Volian.Print.Library
|
||||
return (prTab + thisTab.Trim()).TrimEnd(".".ToCharArray());
|
||||
}
|
||||
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)
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.ToPdf");
|
||||
|
@ -125,21 +125,21 @@ namespace Volian.Print.Library
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> vlnPrintObject.Height");
|
||||
if (_Height == 0)
|
||||
_Height = GetParagraphHeight(MyContentByte, IParagraph, Width);
|
||||
_Height = GetParagraphHeight(MyContentByte, IParagraph, string.Empty, Width);
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return _Height;
|
||||
}
|
||||
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;
|
||||
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)
|
||||
{
|
||||
vlnParagraph myParagraph = this as vlnParagraph;
|
||||
@ -192,11 +192,20 @@ namespace Volian.Print.Library
|
||||
}
|
||||
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);
|
||||
myColumnText.SetSimpleColumn(0, 792F, width, 0); // Bottom margin
|
||||
myColumnText.AddElement(iParagraph);
|
||||
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.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.
|
||||
if (ColumnText.HasMoreText(status) && throwException)
|
||||
@ -207,13 +216,13 @@ namespace Volian.Print.Library
|
||||
public float GetTableWidth(PdfContentByte cb, Paragraph iParagraph, float? maxWidth)
|
||||
{
|
||||
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 iDelta = iWidth / 2;
|
||||
iWidth = iWidth / 2;
|
||||
while (iDelta > 0)
|
||||
{
|
||||
float h2 = GetParagraphHeight(cb, iParagraph, iWidth,false);
|
||||
float h2 = GetParagraphHeight(cb, iParagraph, string.Empty, iWidth,false);
|
||||
iDelta = iDelta / 2;
|
||||
if (h2 == h) iWidthMax = iWidth;
|
||||
iWidth += (h2>h ? 1: -1) * iDelta;
|
||||
|
Loading…
x
Reference in New Issue
Block a user