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:
Rich 2017-06-12 12:56:18 +00:00
parent f4d9d38e59
commit 2aa7db1c76
3 changed files with 44 additions and 18 deletions

View File

@ -1845,26 +1845,35 @@ namespace Volian.Print.Library
{ {
float hBefore = pg.Height;// Save initial paragraph height float hBefore = pg.Height;// Save initial paragraph height
AdjustSupInfoTable(pg, scaler,cb); 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 NewSupInfoFixChunks(pg, scaler);// Apply multiplier to font size
pg.IParagraph.Leading = scaler * pg.IParagraph.Leading; // Adjust leading (line spacing) pg.IParagraph.Leading = scaler * pg.IParagraph.Leading; // Adjust leading (line spacing)
float hAfter = pg.GetParagraphHeight(cb, pg.IParagraph, "", pg.Width); // Calculate new paragraph height // B2017-112: Don't do the font size change if images.
pg.Height = hAfter; // Save new Height; // B2017-116: Don;t do the font size change for RTF Raw
pg.YBottomMost += hAfter - hBefore; // Adjust YbottomMost for font size and leading if (pg.ImageText == null && !pg.MyItemInfo.IsRtfRaw)
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)) float hAfter = pg.GetParagraphHeight(cb, pg.IParagraph, "", pg.Width); // Calculate new paragraph height
_AdjustForParagraphShrinkage.Add(pg.YOffset, hleading - hAfter); 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 yoBefore = pg.YOffset;// Save the offset before
float yoAfter = pg.YOffset = NewSupInfoFixOffset(pg, scaler);// Calculate the offset after float yoAfter = pg.YOffset = NewSupInfoFixOffset(pg, scaler);// Calculate the offset after
pg.YBottomMost += yoAfter - yoBefore;// Adjust YbottomMost for changes to yOffset pg.YBottomMost += yoAfter - yoBefore;// Adjust YbottomMost for changes to yOffset
}
foreach (vlnParagraph cpg in pg.ChildrenAbove)// Process Children Above foreach (vlnParagraph cpg in pg.ChildrenAbove)// Process Children Above
ReduceSupInfoGroupFontSize(cpg, scaler, cb); ReduceSupInfoGroupFontSize(cpg, scaler, cb);
foreach (vlnParagraph cpg in pg.ChildrenBelow)// Process Children Below foreach (vlnParagraph cpg in pg.ChildrenBelow)// Process Children Below

View File

@ -641,7 +641,8 @@ namespace Volian.Print.Library
System.Drawing.Image image = new System.Drawing.Bitmap((int)Width, (int)Height); System.Drawing.Image image = new System.Drawing.Bitmap((int)Width, (int)Height);
System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(image); System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(image);
myRtb.RenderClipped(gr, new System.Drawing.Rectangle(0, 0, (int)Width, (int)Height)); 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) catch (Exception ex)
{ {
@ -1251,6 +1252,15 @@ namespace Volian.Print.Library
return retval; 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 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) 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; Height = ic.Image_Height;
} }
iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(idata); 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 catch
{ {
@ -4822,6 +4833,8 @@ namespace Volian.Print.Library
if (chld != null && chld.MyContent.Type == MyItemInfo.MyContent.Type) return 0; if (chld != null && chld.MyContent.Type == MyItemInfo.MyContent.Type) return 0;
} }
if (MyItemInfo.Ordinal % everyNLines == 0 || MyItemInfo.NextItem == null) return SixLinesPerInch; 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. // 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; //if (MyItemInfo.Ordinal % everyNLines == 0 || MyItemInfo.NextItem == null) return SixLinesPerInch;
return 0; return 0;

View File

@ -51,7 +51,10 @@ namespace Volian.Print.Library
public float YOffset public float YOffset
{ {
get { return _YOffset; } get { return _YOffset; }
set { _YOffset = value; } set
{
_YOffset = value;
}
} }
protected vlnParagraph _MyParent; protected vlnParagraph _MyParent;
@ -435,9 +438,10 @@ namespace Volian.Print.Library
para.FirstLineIndent = fi; para.FirstLineIndent = fi;
} }
// Change the chunks to only split on spaces rather than spaces and hyphens // 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(); if (chk.Attributes == null) chk.Attributes = new System.Collections.Hashtable();
chk.SetSplitCharacter(mySplitter); chk.SetSplitCharacter(mySplitter);