vlnParagraph.cs

•	B2020-115 Create Static properties for vlnParagraph to limit
	the size of a figure and paginate large figures properly onto
	their own page.
•	B2020-115 Limit the figure size to the space available in a
	page.
•	B2020-115 Set a very large figure's Step Level so that
	pagination will happen prior to the figure.
This commit is contained in:
Rich 2020-08-18 12:23:45 +00:00
parent 10b6dcfef6
commit d8f41f3dcb

View File

@ -448,6 +448,9 @@ namespace Volian.Print.Library
} }
public partial class vlnParagraph : vlnPrintObject 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); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public override string ToString() public override string ToString()
{ {
@ -1290,6 +1293,15 @@ namespace Volian.Print.Library
Width = ic.Image_Width; Width = ic.Image_Width;
Height = ic.Image_Height; 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); iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(idata);
// B2017-241 Adjust Bottom Message Location for the figure // B2017-241 Adjust Bottom Message Location for the figure
MyPageHelper.BottomContent = yLocation - (Height * MyPageHelper.YMultiplier); MyPageHelper.BottomContent = yLocation - (Height * MyPageHelper.YMultiplier);
@ -6724,6 +6736,11 @@ namespace Volian.Print.Library
YTop = myParagraph.YVeryTop - yTopMost; YTop = myParagraph.YVeryTop - yTopMost;
YBottom = myParagraph.YBottom - yTopMost; YBottom = myParagraph.YBottom - yTopMost;
StepLevel = myParagraph.MyItemInfo.StepLevel; 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) public bool Overlap(vlnParagraph otherParagraph)
{ {