|
|
|
@@ -1735,9 +1735,7 @@ namespace Volian.Print.Library
|
|
|
|
|
myPageHealper.ChangeBarDefinition = MyChangeBarDefinition;
|
|
|
|
|
float yPageStart = yTopMargin;
|
|
|
|
|
vlnParagraph._yPageStartForSupInfo = yTopMargin;
|
|
|
|
|
FindSupInfoLengths(vlnParagraph); // creates a dictionary of the sup info paragraph heights
|
|
|
|
|
_AdjustForParagraphShrinkage = new Dictionary<float, float>();
|
|
|
|
|
AdjustSupInfoFontSize(vlnParagraph,cb); // try to shrink the sup info page font to fix on the page
|
|
|
|
|
SupInfoAjustGroupings(vlnParagraph,cb);
|
|
|
|
|
vlnParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
@@ -1753,40 +1751,208 @@ namespace Volian.Print.Library
|
|
|
|
|
MyReaderHelper = savMyReaderHelper;
|
|
|
|
|
}
|
|
|
|
|
#region ShrinkSupInfoGroupAtATime
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Find Groups
|
|
|
|
|
* Foreach group
|
|
|
|
|
* while measure group is greater than page length
|
|
|
|
|
* reduce the size for the group
|
|
|
|
|
*/
|
|
|
|
|
private float _Decrement = 2f;
|
|
|
|
|
private void SupInfoAjustGroupings(vlnParagraph vlnParagraph)
|
|
|
|
|
private Dictionary<float, float> _AdjustForParagraphShrinkage;
|
|
|
|
|
private float _LastOffset;
|
|
|
|
|
private float _LastBottom;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Adjust the font size so that the Supplemental Information will fit on a single page.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="vlnParagraph">supinfo paragraphs</param>
|
|
|
|
|
/// <param name="cb">pdfcontentbyte</param>
|
|
|
|
|
private void SupInfoAjustGroupings(vlnParagraph vlnParagraph, PdfContentByte cb)
|
|
|
|
|
{
|
|
|
|
|
// Get groups of SupInfo paragraphs
|
|
|
|
|
List<List<vlnParagraph>> supInfoGroups = FindSupInfoGroups(vlnParagraph);
|
|
|
|
|
float pageLength = (float)vlnParagraph.MyItemInfo.MyDocStyle.Layout.PageLength;
|
|
|
|
|
// Process Each Group of SupInfo paragraphs
|
|
|
|
|
foreach (List<vlnParagraph> grp in supInfoGroups)
|
|
|
|
|
{
|
|
|
|
|
// Initialize font decrement
|
|
|
|
|
float decrement = 2f;
|
|
|
|
|
float fontSize = grp[0].IParagraph.Leading; // current font size
|
|
|
|
|
// reduce the font size by _Decrement until the entire grouping fits on one page
|
|
|
|
|
while (MeasureLength(grp) > pageLength)
|
|
|
|
|
float mpglen = MeasureSupInfoGroupLength(grp, cb,pageLength); // Measure the length of the group of supinfo paragraphs
|
|
|
|
|
// If the group does not fit on a page then reduce the font size
|
|
|
|
|
if (mpglen > pageLength)
|
|
|
|
|
{
|
|
|
|
|
float newFontSize = fontSize - _Decrement;
|
|
|
|
|
float scaler = newFontSize / fontSize;
|
|
|
|
|
ReduceGroupFontSize(grp, scaler);
|
|
|
|
|
fontSize = newFontSize;
|
|
|
|
|
float newFontSize=fontSize;
|
|
|
|
|
// reduce the font size by _Decrement until the entire grouping fits on one page
|
|
|
|
|
while (mpglen > pageLength) // While the measured supinfo group length is greatere than the page length
|
|
|
|
|
{
|
|
|
|
|
newFontSize = fontSize - decrement;
|
|
|
|
|
float scaler = newFontSize / fontSize;// Calculate the reduction
|
|
|
|
|
ReduceSupInfoGroupFontSize(grp, scaler, cb); // Apply the smaller font size
|
|
|
|
|
fontSize = newFontSize; // adjust the base font size
|
|
|
|
|
mpglen = MeasureSupInfoGroupLength(grp, cb, pageLength);// Measure the length of the group of supinfo paragraphs
|
|
|
|
|
}
|
|
|
|
|
// Binary Search to find proper font size within .1
|
|
|
|
|
while (decrement > .1f)
|
|
|
|
|
{
|
|
|
|
|
decrement = decrement / 2f; //Reduce the decrement by half
|
|
|
|
|
if (mpglen > pageLength) // If the measured length is too big
|
|
|
|
|
newFontSize -= decrement;// Reduce the font size
|
|
|
|
|
else
|
|
|
|
|
newFontSize += decrement;//Otherwise increase the font size
|
|
|
|
|
float scaler = newFontSize / fontSize;// Calculate the reduction
|
|
|
|
|
ReduceSupInfoGroupFontSize(grp, scaler, cb);// apply the new font size
|
|
|
|
|
fontSize = newFontSize;// adjust the base font size
|
|
|
|
|
mpglen = MeasureSupInfoGroupLength(grp, cb, pageLength);// Measure the length of the group of supinfo paragraphs
|
|
|
|
|
}
|
|
|
|
|
if (mpglen > pageLength) //If the measured lenght is greater than the page length reduce the font size
|
|
|
|
|
{
|
|
|
|
|
newFontSize -= decrement;// Reduce the font size
|
|
|
|
|
float scaler = newFontSize / fontSize;// Calculate the reduction
|
|
|
|
|
ReduceSupInfoGroupFontSize(grp, scaler, cb);// apply the new font size
|
|
|
|
|
fontSize = newFontSize;// adjust the base font size
|
|
|
|
|
mpglen = MeasureSupInfoGroupLength(grp, cb, pageLength);// Measure the length of the group of supinfo paragraphs
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ReduceGroupFontSize(List<vlnParagraph> grp, float scaler)
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Method to apply a multiplier to the font size to a group of supinfo paragraphs
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="grp">group of SupInfo paragraphs</param>
|
|
|
|
|
/// <param name="scaler">multiplier for font size</param>
|
|
|
|
|
/// <param name="cb">The PDFContentByte which is needed to calculate the adjusted the paragraph height</param>
|
|
|
|
|
private void ReduceSupInfoGroupFontSize(List<vlnParagraph> grp, float scaler, PdfContentByte cb)
|
|
|
|
|
{
|
|
|
|
|
foreach (vlnParagraph pg in grp) // For each paragraph and children apply the scaler
|
|
|
|
|
{
|
|
|
|
|
// When adjusting the font size if the change causes the paragraph to change due to the number of characters
|
|
|
|
|
// per line these changes will impact the paragraphs below the affected paragraph
|
|
|
|
|
// This is kept in a dictionary. The key is the vertical offset to the affected paragraph.
|
|
|
|
|
// The value is the impact on the paragraph height.
|
|
|
|
|
_AdjustForParagraphShrinkage = new Dictionary<float, float>();
|
|
|
|
|
// Apply the scaler to each paragraph
|
|
|
|
|
ReduceSupInfoGroupFontSize(pg, scaler, cb);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private float MeasureLength(List<vlnParagraph> grp)
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Method to apply a multiplier to the font size to a supinfo paragraph and children
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="pg">supinfo paragraph</param>
|
|
|
|
|
/// <param name="scaler">font multiplier</param>
|
|
|
|
|
/// <param name="cb">pdfcontentbyte</param>
|
|
|
|
|
private void ReduceSupInfoGroupFontSize(vlnParagraph pg, float scaler, PdfContentByte cb)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
float hBefore = pg.Height;// Save initial paragraph height
|
|
|
|
|
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))
|
|
|
|
|
{
|
|
|
|
|
if (!_AdjustForParagraphShrinkage.ContainsKey(pg.YOffset))
|
|
|
|
|
_AdjustForParagraphShrinkage.Add(pg.YOffset, hleading - hAfter);
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
ReduceSupInfoGroupFontSize(cpg, scaler, cb);
|
|
|
|
|
foreach (vlnParagraph cpg in pg.ChildrenLeft)// Process Children Left
|
|
|
|
|
ReduceSupInfoGroupFontSize(cpg, scaler, cb);
|
|
|
|
|
foreach (vlnParagraph cpg in pg.ChildrenRight)// Process Children Right
|
|
|
|
|
ReduceSupInfoGroupFontSize(cpg, scaler, cb);
|
|
|
|
|
foreach (vlnPrintObject po in pg.PartsAbove) // Process Parts Above (headers)
|
|
|
|
|
NewSupInfoFixParts(po, scaler);
|
|
|
|
|
foreach (vlnPrintObject po in pg.PartsBelow) // Process Parts Below (unknown)
|
|
|
|
|
NewSupInfoFixParts(po, scaler);
|
|
|
|
|
foreach (vlnPrintObject po in pg.PartsLeft) // Process Parts Left (Tabs)
|
|
|
|
|
NewSupInfoFixParts(po, scaler);
|
|
|
|
|
foreach (vlnPrintObject po in pg.PartsRight) // Process Parts Right (unknown)
|
|
|
|
|
NewSupInfoFixParts(po, scaler);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Adjust YOffset for Print Objects
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="vpo">Print Object (tab, paragraph, etc.)</param>
|
|
|
|
|
/// <param name="scaler">multiplier</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private float NewSupInfoFixOffset(vlnPrintObject vpo, float scaler)
|
|
|
|
|
{
|
|
|
|
|
float fixOffSet = 0;
|
|
|
|
|
// determine impact of paragraphs above due to word-wrap
|
|
|
|
|
foreach (float off in _AdjustForParagraphShrinkage.Keys)
|
|
|
|
|
if (off < vpo.YOffset)
|
|
|
|
|
fixOffSet += _AdjustForParagraphShrinkage[off];
|
|
|
|
|
// combine this impact with the scaler on the YOffset
|
|
|
|
|
return scaler * vpo.YOffset - fixOffSet;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Adjust Font Size and offset for Parts
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="po">PrintObject</param>
|
|
|
|
|
/// <param name="scaler">Multiplier</param>
|
|
|
|
|
private void NewSupInfoFixParts(vlnPrintObject po, float scaler)
|
|
|
|
|
{
|
|
|
|
|
// Adjust the font size by the multiplier
|
|
|
|
|
foreach (Chunk chk in po.IParagraph.Chunks)
|
|
|
|
|
chk.Font.Size = scaler * chk.Font.Size;
|
|
|
|
|
po.IParagraph.Leading = scaler * po.IParagraph.Leading;// Apply the multiplier to the leading (line spacing)
|
|
|
|
|
po.YOffset = NewSupInfoFixOffset(po,scaler);// Adjust the YOffset
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Adjust the Font Size
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="vlnParagraph">Paragraph</param>
|
|
|
|
|
/// <param name="scaler">Multiplier</param>
|
|
|
|
|
private void NewSupInfoFixChunks(vlnParagraph vlnParagraph, float scaler)
|
|
|
|
|
{
|
|
|
|
|
// Adjust the font size by the multiplier
|
|
|
|
|
foreach (Chunk chk in vlnParagraph.IParagraph.Chunks)
|
|
|
|
|
chk.Font.Size = scaler * chk.Font.Size;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Measure the Length of the Group
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="grp">Group of SupInfo Paragraphs</param>
|
|
|
|
|
/// <param name="cb">pdfContentByte</param>
|
|
|
|
|
/// <param name="pagelength">Page Length</param>
|
|
|
|
|
/// <returns>Length</returns>
|
|
|
|
|
private float MeasureSupInfoGroupLength(List<vlnParagraph> grp, PdfContentByte cb, float pagelength)
|
|
|
|
|
{
|
|
|
|
|
_LastBottom = 0;
|
|
|
|
|
_LastOffset = 12;// 24; // account for the Sup Info header (two lines)
|
|
|
|
|
float fontSize = grp[0].IParagraph.Leading; // current font size
|
|
|
|
|
// For each SupInfo Paragraph calculate length
|
|
|
|
|
foreach (vlnParagraph pg in grp)
|
|
|
|
|
{
|
|
|
|
|
MeasureSupInfoGroupLength(pg, cb);// Measure a SupInfo Paragraph and children
|
|
|
|
|
_LastOffset += _LastBottom;
|
|
|
|
|
_LastBottom = 0;
|
|
|
|
|
}
|
|
|
|
|
//Console.WriteLine("MeasureSupInfoGroupLength {0} {1} {2} {3}", grp[0].MyItemInfo.ItemID, _LastOffset, fontSize, pagelength);
|
|
|
|
|
return _LastOffset;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Measure the height of a supinfo paragraph and children
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="pg">SupInfo paragraph</param>
|
|
|
|
|
/// <param name="cb">pdfContentByte</param>
|
|
|
|
|
private void MeasureSupInfoGroupLength(vlnParagraph pg, PdfContentByte cb)
|
|
|
|
|
{
|
|
|
|
|
_LastBottom = pg.YBottomMost;
|
|
|
|
|
foreach (vlnParagraph cpg in pg.ChildrenAbove) // Measure Children Above
|
|
|
|
|
MeasureSupInfoGroupLength(cpg, cb);
|
|
|
|
|
foreach (vlnParagraph cpg in pg.ChildrenBelow) // Measure Children Below
|
|
|
|
|
MeasureSupInfoGroupLength(cpg, cb);
|
|
|
|
|
foreach (vlnParagraph cpg in pg.ChildrenLeft) // Measure Children Left
|
|
|
|
|
MeasureSupInfoGroupLength(cpg, cb);
|
|
|
|
|
foreach (vlnParagraph cpg in pg.ChildrenRight) // Measure Children Right
|
|
|
|
|
MeasureSupInfoGroupLength(cpg, cb);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Find Groups of SupInfo Paragraphs
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="vlnParagraph">SupInfo Paragraph</param>
|
|
|
|
|
/// <returns>List of supinfo paragraph groups</returns>
|
|
|
|
|
private List<List<vlnParagraph>> FindSupInfoGroups(vlnParagraph vlnParagraph)
|
|
|
|
|
{
|
|
|
|
|
List<List<vlnParagraph>> supInfoGroups;
|
|
|
|
@@ -1801,153 +1967,8 @@ namespace Volian.Print.Library
|
|
|
|
|
return supInfoGroups;
|
|
|
|
|
}
|
|
|
|
|
#endregion //ShrinkSupInfoGroupAtATime
|
|
|
|
|
#region ShrinkSupplementInfoTextFont
|
|
|
|
|
/*
|
|
|
|
|
* The logic in this region will look a the text that should appear on a supplemental information page
|
|
|
|
|
* and reduce the size of the text and spacing between paragraphs so that it will fit on the one page.
|
|
|
|
|
*/
|
|
|
|
|
private Dictionary<int, float> _SupInfoLengths;
|
|
|
|
|
static int _LastSupInfoItemID;
|
|
|
|
|
static float _LastBottom;
|
|
|
|
|
static float _LastOffset;
|
|
|
|
|
|
|
|
|
|
// create a dictionary of Supplemental Info pargraph heights
|
|
|
|
|
private void FindSupInfoLengths(vlnParagraph vlnParagraph)
|
|
|
|
|
{
|
|
|
|
|
_SupInfoLengths = new Dictionary<int,float>();
|
|
|
|
|
_LastBottom = 0;
|
|
|
|
|
_LastSupInfoItemID = 0;
|
|
|
|
|
_LastOffset = 0;
|
|
|
|
|
FindSupInfoLength(vlnParagraph);
|
|
|
|
|
if (_LastSupInfoItemID != 0)
|
|
|
|
|
_SupInfoLengths.Add(_LastSupInfoItemID, _LastBottom);
|
|
|
|
|
//ShowSupInfoPages(); //debug
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//private void ShowSupInfoPages() // used for debug
|
|
|
|
|
//{
|
|
|
|
|
// foreach (int key in _SupInfoPages.Keys)
|
|
|
|
|
// Console.WriteLine("SupInfoPage {0} {1}", key, _SupInfoPages[key]);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
// add the supplemental info page paragraph length (height) the dictionary
|
|
|
|
|
private void FindSupInfoLength(vlnParagraph vlnParagraph)
|
|
|
|
|
{
|
|
|
|
|
//Console.WriteLine("{0} {1} ybottommost {2} yoffset {3} LastOffSet {4} LastBottom {5} PrefPgBreak {6}", vlnParagraph.MyItemInfo.ItemID, vlnParagraph.MyItemInfo.ShortPath, vlnParagraph.YBottomMost, vlnParagraph.YOffset, _LastOffset, _LastBottom,vlnParagraph.PrefPageBreak);
|
|
|
|
|
SectionInfo supInfoSect = vlnParagraph.MyItemInfo.MyActiveSection as SectionInfo;
|
|
|
|
|
if (supInfoSect.StepSectPageBreaksForSupInfo != null && supInfoSect.StepSectPageBreaksForSupInfo.Contains(vlnParagraph.MyItemInfo.ItemID))
|
|
|
|
|
{
|
|
|
|
|
if (_LastSupInfoItemID != 0)
|
|
|
|
|
_SupInfoLengths.Add(_LastSupInfoItemID, _LastBottom + _LastOffset);
|
|
|
|
|
_LastOffset = 24; // account for the Sup Info header (two lines)
|
|
|
|
|
_LastBottom = 0;
|
|
|
|
|
_LastSupInfoItemID = vlnParagraph.MyItemInfo.ItemID;
|
|
|
|
|
}
|
|
|
|
|
if (vlnParagraph.YOffset == 0)
|
|
|
|
|
_LastOffset += _LastBottom + 12f; // the +12 accounts for blank lines between paragraphs
|
|
|
|
|
_LastBottom = vlnParagraph.YBottomMost;
|
|
|
|
|
foreach (vlnParagraph pg in vlnParagraph.ChildrenAbove)
|
|
|
|
|
FindSupInfoLength(pg);
|
|
|
|
|
foreach (vlnParagraph pg in vlnParagraph.ChildrenBelow)
|
|
|
|
|
FindSupInfoLength(pg);
|
|
|
|
|
foreach (vlnParagraph pg in vlnParagraph.ChildrenLeft)
|
|
|
|
|
FindSupInfoLength(pg);
|
|
|
|
|
foreach (vlnParagraph pg in vlnParagraph.ChildrenRight)
|
|
|
|
|
FindSupInfoLength(pg);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private Dictionary<float, float> _AdjustForParagraphShrinkage;
|
|
|
|
|
private float _AdjustSupInfoSize = 0;
|
|
|
|
|
private void AdjustSupInfoFontSize(vlnParagraph vlnParagraph, PdfContentByte cb)
|
|
|
|
|
{
|
|
|
|
|
AdjustSupInfoFontSize(vlnParagraph, cb, 0);
|
|
|
|
|
}
|
|
|
|
|
// if there is too much supplemental info text to fit on the page at the normal font,
|
|
|
|
|
// reduce the size of font so it fits on the page, but only if the reduced font size is still easly readable.
|
|
|
|
|
private void AdjustSupInfoFontSize(vlnParagraph vlnParagraph, PdfContentByte cb, int level)
|
|
|
|
|
{
|
|
|
|
|
if (vlnParagraph.MyItemInfo.ItemID == 62805)
|
|
|
|
|
Console.WriteLine("stop");
|
|
|
|
|
if (_SupInfoLengths.ContainsKey(vlnParagraph.MyItemInfo.ItemID))
|
|
|
|
|
{
|
|
|
|
|
float hsize = _SupInfoLengths[vlnParagraph.MyItemInfo.ItemID];
|
|
|
|
|
//if (hsize > 900)
|
|
|
|
|
// Console.WriteLine("stop");
|
|
|
|
|
//if (hsize < 504 || hsize > 900) // not bigger than the page and not too big to shrink
|
|
|
|
|
float hMin = (float)vlnParagraph.MyItemInfo.MyDocStyle.Layout.PageLength;
|
|
|
|
|
float hMax = 1.75f * hMin;
|
|
|
|
|
float hMult = (1.0f - .67f) / (hMin - hMax);
|
|
|
|
|
float hOffSet = 1.0f - (hMult * hMin);
|
|
|
|
|
if (hsize < hMin)// || hsize > hMax) // not bigger than the page and not too big to shrink
|
|
|
|
|
_AdjustSupInfoSize = 1f; // don't adjust the font size
|
|
|
|
|
else
|
|
|
|
|
_AdjustSupInfoSize = hOffSet + hsize * hMult; // shrink the font size and line spacing
|
|
|
|
|
//_AdjustSupInfoSize = 1.4447F - hsize * .00088F; // shrink the font size and line spacing
|
|
|
|
|
}
|
|
|
|
|
//if (vlnParagraph.PrefPageBreak || vlnParagraph.HasPrefPageBreak)
|
|
|
|
|
// Console.WriteLine("path {0}, PrePageBeak = {1}, ItemID = {2}", vlnParagraph.MyItemInfo.ShortPath, vlnParagraph.PrefPageBreak, vlnParagraph.MyItemInfo.ItemID);
|
|
|
|
|
//if (level == 1)
|
|
|
|
|
// Console.WriteLine("bottom most {0}", vlnParagraph.YBottomMost - vlnParagraph.YOffset);
|
|
|
|
|
float hBefore = vlnParagraph.Height;
|
|
|
|
|
SupInfoFixChunks(vlnParagraph);
|
|
|
|
|
//Console.WriteLine("Orig Font Size {0}", vlnParagraph.IParagraph.Leading);
|
|
|
|
|
vlnParagraph.IParagraph.Leading = _AdjustSupInfoSize * vlnParagraph.IParagraph.Leading;
|
|
|
|
|
float hAfter = vlnParagraph.GetParagraphHeight(cb, vlnParagraph.IParagraph, "", vlnParagraph.Width);
|
|
|
|
|
float hleading = hBefore * _AdjustSupInfoSize;
|
|
|
|
|
if (vlnParagraph.YOffset == 0)
|
|
|
|
|
_AdjustForParagraphShrinkage = new Dictionary<float, float>();
|
|
|
|
|
if (hleading > hAfter +1)
|
|
|
|
|
{
|
|
|
|
|
if (!_AdjustForParagraphShrinkage.ContainsKey(vlnParagraph.YOffset))
|
|
|
|
|
_AdjustForParagraphShrinkage.Add(vlnParagraph.YOffset, hleading - hAfter);
|
|
|
|
|
//Console.WriteLine("hbefore = {0} hAfter {1} hLeading {2}", hBefore, hAfter, hleading);
|
|
|
|
|
}
|
|
|
|
|
vlnParagraph.YOffset = SupInfoFixOffset(vlnParagraph);
|
|
|
|
|
foreach (vlnParagraph pg in vlnParagraph.ChildrenAbove)
|
|
|
|
|
AdjustSupInfoFontSize(pg,cb,level +1);
|
|
|
|
|
foreach (vlnParagraph pg in vlnParagraph.ChildrenBelow)
|
|
|
|
|
AdjustSupInfoFontSize(pg,cb,level +1);
|
|
|
|
|
foreach (vlnParagraph pg in vlnParagraph.ChildrenLeft)
|
|
|
|
|
AdjustSupInfoFontSize(pg,cb,level +1);
|
|
|
|
|
foreach (vlnParagraph pg in vlnParagraph.ChildrenRight)
|
|
|
|
|
AdjustSupInfoFontSize(pg,cb,level +1);
|
|
|
|
|
foreach (vlnPrintObject po in vlnParagraph.PartsAbove)
|
|
|
|
|
SupInfoFixParts(po);
|
|
|
|
|
foreach (vlnPrintObject po in vlnParagraph.PartsBelow)
|
|
|
|
|
SupInfoFixParts(po);
|
|
|
|
|
foreach (vlnPrintObject po in vlnParagraph.PartsLeft)
|
|
|
|
|
SupInfoFixParts(po);
|
|
|
|
|
foreach (vlnPrintObject po in vlnParagraph.PartsRight)
|
|
|
|
|
SupInfoFixParts(po);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// adjust the step tabs
|
|
|
|
|
private float SupInfoFixOffset( vlnPrintObject vpo)
|
|
|
|
|
{
|
|
|
|
|
float fixOffSet = 0;
|
|
|
|
|
foreach (float off in _AdjustForParagraphShrinkage.Keys)
|
|
|
|
|
if (off < vpo.YOffset)
|
|
|
|
|
fixOffSet += _AdjustForParagraphShrinkage[off];
|
|
|
|
|
return _AdjustSupInfoSize * vpo.YOffset - fixOffSet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// adjust the space between the paragraphs
|
|
|
|
|
private void SupInfoFixParts(vlnPrintObject po)
|
|
|
|
|
{
|
|
|
|
|
foreach (Chunk chk in po.IParagraph.Chunks)
|
|
|
|
|
chk.Font.Size = _AdjustSupInfoSize * chk.Font.Size;
|
|
|
|
|
po.IParagraph.Leading = _AdjustSupInfoSize * po.IParagraph.Leading;
|
|
|
|
|
po.YOffset = SupInfoFixOffset(po);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// adjust the font size of the paragraph text
|
|
|
|
|
private void SupInfoFixChunks(vlnParagraph vlnParagraph)
|
|
|
|
|
{
|
|
|
|
|
foreach (Chunk chk in vlnParagraph.IParagraph.Chunks)
|
|
|
|
|
chk.Font.Size = _AdjustSupInfoSize * chk.Font.Size;
|
|
|
|
|
}
|
|
|
|
|
#endregion // ShrinkSupplementInfoTextFont
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void DoSupInfoPage(PdfContentByte cb, string str, PdfLayer textLayer, VlnSvgPageHelper myPageHelper, int itemid, bool insertBlankPages)
|
|
|
|
|
{
|
|
|
|
|
// see if the ID is in the facing page pdf - if so, get the page:
|
|
|
|
|