Use vlnParagraph for footnotes so that Change Bars will print (rather than vlnText)

This commit is contained in:
2014-12-02 15:26:25 +00:00
parent 4ba00691c2
commit 234f55ea77
2 changed files with 49 additions and 30 deletions

View File

@@ -84,8 +84,8 @@ namespace Volian.Print.Library
get { return _NotesToFootNotesHLS; }
set { _NotesToFootNotesHLS = value; }
}
private List<vlnText> _NotesToFootNotes = new List<vlnText>();
public List<vlnText> NotesToFootNotes
private List<vlnParagraph> _NotesToFootNotes = new List<vlnParagraph>();
public List<vlnParagraph> NotesToFootNotes
{
get { return _NotesToFootNotes; }
set { _NotesToFootNotes = value; }
@@ -213,6 +213,7 @@ namespace Volian.Print.Library
AddBookmarks(writer);
MyPageCounts.CanIncrement = true;
base.OnEndPage(writer, document);
DrawFootnotes(writer.DirectContent);
DrawChangeBars(writer.DirectContent);
DrawMessages(writer.DirectContent);
if (!CreatingFoldoutPage)
@@ -582,6 +583,28 @@ namespace Volian.Print.Library
}
PageBookmarks.Clear();
}
private void DrawFootnotes(PdfContentByte cb)
{
float tmp = 0;
if (NotesToFootNotes != null && NotesToFootNotes.Count > 0)
{
float _PointsPerPage = 792;
float yTopMargin = _PointsPerPage - (float)MySection.MyDocStyle.Layout.TopMargin;
float myYOff = NotesToFootNotesYoffset;
foreach (vlnParagraph ntfn in NotesToFootNotes)
{
// subtract from yTopMargin to take the location from the 'roll of paper'
// to the physical page location.
ntfn.YOffset = yTopMargin - myYOff;
ntfn.YTopMost = yTopMargin - myYOff;
ntfn.Processed = false; // process from here
ntfn.ToPdf(cb, yTopMargin, ref yTopMargin, ref tmp);
myYOff -= (ntfn.Height); // - vlnPrintObject.SixLinesPerInch);
}
NotesToFootNotes = null;
}
}
private void DrawMessages(PdfContentByte cb)
{
float tmp = 0;
@@ -631,17 +654,6 @@ namespace Volian.Print.Library
BottomMessageA.ToPdf(cb, 0, ref tmp, ref tmp);
BottomMessageA = null; // Only output it once.
}
if (NotesToFootNotes != null)
{
float myYOff = NotesToFootNotesYoffset;
foreach (vlnText ntfn in NotesToFootNotes)
{
ntfn.YOffset = myYOff;
myYOff -= ntfn.Height;
ntfn.ToPdf(cb, 0, ref tmp, ref tmp);
}
NotesToFootNotes = null;
}
}
public void DrawBottomMessage(PdfContentByte cb)
{
@@ -829,8 +841,8 @@ namespace Volian.Print.Library
float tolerance = vlnPrintObject.SixLinesPerInch;
if (cb.MyParent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm &&
(vcb.MyParent.MyItemInfo.IsTable || cb.MyParent.MyItemInfo.IsTable || cb.BottomIsTable)) tolerance *= 1.5f;
if (cb.MyParent.MyItemInfo.MyHLS.ItemID != vcb.MyParent.MyItemInfo.MyHLS.ItemID) return false;
bool bothFootnotes = cb.MyParent.MyItemInfo.IsFootnote && vcb.MyParent.MyItemInfo.IsFootnote;
if (!bothFootnotes && cb.MyParent.MyItemInfo.MyHLS.ItemID != vcb.MyParent.MyItemInfo.MyHLS.ItemID) return false;
// cb.Yoffset is within range of vcb:
if (cb.YOffset <= vcb.YOffset &&
cb.YOffset >= (vcb.YChangeBarBottomExtend - tolerance)) return true;