B2017-012 Embedded Figure resizes on Facing Page
B2017-016 Equations and Visio Drawings resizes on Facing Page Releated issue where Equipment Lists containing Embedded Figures, Equations and Visio Drawings were overlapping with procedure text. Handle Embedded Figures, Equations and Visio Drawings when the Facing Page resize was occuring Figures were not being handled properly for Facing Page font resize
This commit is contained in:
parent
f4d9d38e59
commit
2aa7db1c76
@ -1845,26 +1845,35 @@ namespace Volian.Print.Library
|
||||
{
|
||||
float hBefore = pg.Height;// Save initial paragraph height
|
||||
AdjustSupInfoTable(pg, scaler,cb);
|
||||
// B2017-112: Don't do the font size change if images.
|
||||
if (pg.ImageText == null)
|
||||
{
|
||||
NewSupInfoFixChunks(pg, scaler);// Apply multiplier to font size
|
||||
pg.IParagraph.Leading = scaler * pg.IParagraph.Leading; // Adjust leading (line spacing)
|
||||
float hAfter = pg.GetParagraphHeight(cb, pg.IParagraph, "", pg.Width); // Calculate new paragraph height
|
||||
pg.Height = hAfter; // Save new Height;
|
||||
pg.YBottomMost += hAfter - hBefore; // Adjust YbottomMost for font size and leading
|
||||
float hleading = hBefore * scaler; // Calcuate leading change
|
||||
// If the change in font size effects the paragraph height due to word wrapping save the impact to adjust
|
||||
// Offsets below
|
||||
if ((hleading > hAfter + 1 && scaler < 1f) || (hleading < hAfter + 1 && scaler > 1f))
|
||||
// B2017-112: Don't do the font size change if images.
|
||||
// B2017-116: Don;t do the font size change for RTF Raw
|
||||
if (pg.ImageText == null && !pg.MyItemInfo.IsRtfRaw)
|
||||
{
|
||||
if (!_AdjustForParagraphShrinkage.ContainsKey(pg.YOffset))
|
||||
_AdjustForParagraphShrinkage.Add(pg.YOffset, hleading - hAfter);
|
||||
float hAfter = pg.GetParagraphHeight(cb, pg.IParagraph, "", pg.Width); // Calculate new paragraph height
|
||||
pg.Height = hAfter; // Save new Height;
|
||||
pg.YBottomMost += hAfter - hBefore; // Adjust YbottomMost for font size and leading
|
||||
float hleading = hBefore * scaler; // Calcuate leading change
|
||||
// If the change in font size effects the paragraph height due to word wrapping save the impact to adjust
|
||||
// Offsets below
|
||||
if ((hleading > hAfter + 1 && scaler < 1f) || (hleading < hAfter + 1 && scaler > 1f))
|
||||
{
|
||||
if (!_AdjustForParagraphShrinkage.ContainsKey(pg.YOffset))
|
||||
{
|
||||
_AdjustForParagraphShrinkage.Add(pg.YOffset, hleading - hAfter);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Adjust the Image Size B2017-112 And B2017-116
|
||||
{
|
||||
pg.ImageScaler *= scaler;
|
||||
pg.Height *= scaler;
|
||||
pg.Width *= scaler;
|
||||
}
|
||||
float yoBefore = pg.YOffset;// Save the offset before
|
||||
float yoAfter = pg.YOffset = NewSupInfoFixOffset(pg, scaler);// Calculate the offset after
|
||||
pg.YBottomMost += yoAfter - yoBefore;// Adjust YbottomMost for changes to yOffset
|
||||
}
|
||||
foreach (vlnParagraph cpg in pg.ChildrenAbove)// Process Children Above
|
||||
ReduceSupInfoGroupFontSize(cpg, scaler, cb);
|
||||
foreach (vlnParagraph cpg in pg.ChildrenBelow)// Process Children Below
|
||||
|
@ -641,7 +641,8 @@ namespace Volian.Print.Library
|
||||
System.Drawing.Image image = new System.Drawing.Bitmap((int)Width, (int)Height);
|
||||
System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(image);
|
||||
myRtb.RenderClipped(gr, new System.Drawing.Rectangle(0, 0, (int)Width, (int)Height));
|
||||
retval = Rtf2Pdf.RtfRawAt(cb, image, XOffset + MyItemInfo.FormatStepData.Font.CharsToTwips, yLocation, Width * MyPageHelper.YMultiplier, Height * MyPageHelper.YMultiplier, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.ToUpper().Contains("BORDERLESS"));
|
||||
// B2017-116 Adjust Image Size by Scaler (Used for Facing Pages - Sup Info)
|
||||
retval = Rtf2Pdf.RtfRawAt(cb, image, XOffset + MyItemInfo.FormatStepData.Font.CharsToTwips, yLocation, Width * MyPageHelper.YMultiplier * ImageScaler, Height * MyPageHelper.YMultiplier * ImageScaler, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.ToUpper().Contains("BORDERLESS"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -1251,6 +1252,15 @@ namespace Volian.Print.Library
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
private float _ImageScaler = 1F;
|
||||
/// <summary>
|
||||
/// Scaler used to adjust the Image Size on Sup Info (Facing Pages)
|
||||
/// </summary>
|
||||
public float ImageScaler
|
||||
{
|
||||
get { return _ImageScaler; }
|
||||
set { _ImageScaler = value; }
|
||||
}
|
||||
//private bool _TextDebug = false; //true; this will turn on a writeline with debug in DrawText()
|
||||
private float DrawFigure(PdfContentByte cb, float yBottomMargin, float yLocation, float yPageStart, float yTopMargin)
|
||||
{
|
||||
@ -1275,7 +1285,8 @@ namespace Volian.Print.Library
|
||||
Height = ic.Image_Height;
|
||||
}
|
||||
iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(idata);
|
||||
retval = Rtf2Pdf.FigureAt(cb, it_image, XOffset + MyItemInfo.FormatStepData.Font.CharsToTwips, yLocation, Width * MyPageHelper.YMultiplier, Height * MyPageHelper.YMultiplier, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless"));
|
||||
// B2017-112 Adjust Image Size by Scaler (Used for Facing Pages - Sup Info)
|
||||
retval = Rtf2Pdf.FigureAt(cb, it_image, XOffset + MyItemInfo.FormatStepData.Font.CharsToTwips, yLocation, Width * MyPageHelper.YMultiplier * ImageScaler, Height * MyPageHelper.YMultiplier * ImageScaler, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless"));
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -4822,6 +4833,8 @@ namespace Volian.Print.Library
|
||||
if (chld != null && chld.MyContent.Type == MyItemInfo.MyContent.Type) return 0;
|
||||
}
|
||||
if (MyItemInfo.Ordinal % everyNLines == 0 || MyItemInfo.NextItem == null) return SixLinesPerInch;
|
||||
// If the next table child is a figure, equation or a visio drawing add a blank line
|
||||
if (MyItemInfo.Tables != null && MyItemInfo.Tables.Count > 0 && MyItemInfo.Tables[0].MyContent.MyGrid == null) return SixLinesPerInch;
|
||||
// Pagination issue to be used with yEndsWithBlankLine in Pagination code, but not checked in yet.
|
||||
//if (MyItemInfo.Ordinal % everyNLines == 0 || MyItemInfo.NextItem == null) return SixLinesPerInch;
|
||||
return 0;
|
||||
|
@ -51,7 +51,10 @@ namespace Volian.Print.Library
|
||||
public float YOffset
|
||||
{
|
||||
get { return _YOffset; }
|
||||
set { _YOffset = value; }
|
||||
set
|
||||
{
|
||||
_YOffset = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected vlnParagraph _MyParent;
|
||||
@ -435,9 +438,10 @@ namespace Volian.Print.Library
|
||||
para.FirstLineIndent = fi;
|
||||
}
|
||||
// Change the chunks to only split on spaces rather than spaces and hyphens
|
||||
foreach (Chunk chk in para)
|
||||
foreach (object obj in para)//Fix the code to check for chunks before assuming chunks
|
||||
{
|
||||
if (chk.Attributes==null || !chk.Attributes.ContainsKey("NoSplit"))
|
||||
Chunk chk = obj as Chunk;
|
||||
if (chk != null && (chk.Attributes==null || !chk.Attributes.ContainsKey("NoSplit")))
|
||||
{
|
||||
if (chk.Attributes == null) chk.Attributes = new System.Collections.Hashtable();
|
||||
chk.SetSplitCharacter(mySplitter);
|
||||
|
Loading…
x
Reference in New Issue
Block a user