diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 8f1a460c..fc60548a 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -448,6 +448,9 @@ namespace Volian.Print.Library } public partial class vlnParagraph : vlnPrintObject { + // B2020-115 Create Static properties for vlnParagraph to limit the size of a figure and paginate large figures properly onto their own page. + public static float wMax = 0; + public static float hMax = 0; private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public override string ToString() { @@ -1290,6 +1293,15 @@ namespace Volian.Print.Library Width = ic.Image_Width; Height = ic.Image_Height; } + // B2020-115 Limit the figure size to the space available in a page. + float mult = 1.0F; + if (Width > (vlnParagraph.wMax-12)) mult = (vlnParagraph.wMax-24) / Width; + if (Height > (vlnParagraph.hMax-36)) mult = Math.Min(mult, (vlnParagraph.hMax-36) / Height); + if (mult < 1.0F) + { + Width = Width * mult; + Height = Height * mult; + } iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(idata); // B2017-241 Adjust Bottom Message Location for the figure MyPageHelper.BottomContent = yLocation - (Height * MyPageHelper.YMultiplier); @@ -6724,6 +6736,11 @@ namespace Volian.Print.Library YTop = myParagraph.YVeryTop - yTopMost; YBottom = myParagraph.YBottom - yTopMost; StepLevel = myParagraph.MyItemInfo.StepLevel; + // B2020-115 Set a very large figure's Step Level so that pagination will happen prior to the figure. + if (myParagraph.MyItemInfo.IsFigure && myParagraph.MyParent.Height + myParagraph.Height > vlnParagraph.hMax) + { + StepLevel = 1;// Set figure as a guaranteed break location + } } public bool Overlap(vlnParagraph otherParagraph) {