From d8f41f3dcb34bea673870f0aaf72187e41c2725c Mon Sep 17 00:00:00 2001 From: Rich Date: Tue, 18 Aug 2020 12:23:45 +0000 Subject: [PATCH] =?UTF-8?q?vlnParagraph.cs=20=E2=80=A2=09B2020-115=20Creat?= =?UTF-8?q?e=20Static=20properties=20for=20vlnParagraph=20to=20limit=20=09?= =?UTF-8?q?the=20size=20of=20a=20figure=20and=20paginate=20large=20figures?= =?UTF-8?q?=20properly=20onto=20=09their=20own=20page.=20=E2=80=A2=09B2020?= =?UTF-8?q?-115=20Limit=20the=20figure=20size=20to=20the=20space=20availab?= =?UTF-8?q?le=20in=20a=20=09page.=20=E2=80=A2=09B2020-115=20Set=20a=20very?= =?UTF-8?q?=20large=20figure's=20Step=20Level=20so=20that=20=09pagination?= =?UTF-8?q?=20will=20happen=20prior=20to=20the=20figure.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PROMS/Volian.Print.Library/vlnParagraph.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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) {