- Fixed Header for EquipmentWBlank

- Aligned Tables properly
- Skip Section Title
- Calculated Table Width
- Fixed ChangeBar logic
- Added Text and Debug layers
- Adedd debug output to PDF
- Changed Paginate logic
- Adedd debug output to PDF
- Move GetParagraphHeight
- Added GetTableWidth
- Added ChangeBar Properties
- Added Debug and Text layers
Removed fixed override color for SVG
Removed simple PageBreak
This commit is contained in:
Rich
2010-05-25 16:15:26 +00:00
parent 9cc6174ad1
commit b00005780b
7 changed files with 249 additions and 54 deletions

View File

@@ -48,20 +48,17 @@ namespace Volian.Print.Library
if (_PartsAbove != null && _PartsAbove.Count > 0) yPageStart = PartsAbove.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
float yLocation = yPageStart - YOffset;
float retval = yLocation;
if (MyItemInfo.IsStepSection)
if (!MyItemInfo.IsStepSection) // Don't ouput the Step Section title
{
Console.WriteLine("Step Section - {0}", MyItemInfo.Path);
}
else
{
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100);
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, PdfDebugText);
if (retval == 0)
{
cb.PdfDocument.NewPage();
yPageStart = yTopMargin + YTop;
yLocation = yPageStart - YOffset;
Console.WriteLine("Other Paginate");
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100);
//MyItemInfo.ItemID, YSize, yPageSize, yLocation
Console.WriteLine("-1,'Yes','Forced Pagination',{0},{1},,{3},'{4}'", MyItemInfo.ItemID,YSize,0,yLocation,MyItemInfo.ShortPath);
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, PdfDebugText);
}
}
//Height = yLocation - retval;
@@ -71,12 +68,17 @@ namespace Volian.Print.Library
if (_PartsContainer != null && _PartsContainer.Count > 0) yPageStart = PartsContainer.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
return yPageStart;
}
private string PdfDebugText
{
get
{
return string.Format("ID={0} Type={1} TypeName='{2}' EveryNLines= {3}", MyItemInfo.ItemID, MyItemInfo.FormatStepType, MyItemInfo.FormatStepData.Type, MyItemInfo.FormatStepData.StepLayoutData.EveryNLines);
}
}
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{
float yLocation = yPageStart - YTopMost;
int paginate = Paginate(yLocation, yTopMargin - yBottomMargin);
int paginate = Paginate(yLocation, yTopMargin, yBottomMargin);
switch (paginate)
{
case 1: // Break on High Level Step
@@ -96,12 +98,47 @@ namespace Volian.Print.Library
return yPageStart;
}
private int Paginate(float yLocation, float yPageSize)
private int Paginate(float yLocation, float yTopMargin, float yBottomMargin)
{
if (YSize <= yLocation) return 0; // Don't Paginate if there is enough room
float yPageSize = yTopMargin - yBottomMargin;
float yWithinMargins = yLocation - yBottomMargin;
if (MyItemInfo.ItemID == 879)
Console.Write(",'Here'");
if (MyItemInfo.IsStepSection) return 0; // Don't Paginate on a Step Section
if (YSize <= yWithinMargins)
{
if(MyItemInfo.IsHigh)
Console.WriteLine("1,'No','HLS will fit on page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
return 0; // Don't Paginate if there is enough room
}
if (MyItemInfo.IsRNOPart && MyParent.XOffset < XOffset) return 0; // Don't paginate on an RNO to the right
if (MyItemInfo.IsHigh && YSize < yPageSize) return 1; // Paginate on High Level Steps
if (yLocation > yPageSize / 2) return 0;
if (MyItemInfo.IsHigh)
{
if (YSize < yPageSize) // if the entire step can fit on one page, do a page break
{
Console.WriteLine("2,'Yes','HLS will fit on 1 Page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
return 1; // Paginate on High Level Steps
}
else // The entire step cannot fit go ahead and kick to the next page
{
if (yWithinMargins > yPageSize / 2)
{
// If High level Step will not fit, kick to the next page
Console.WriteLine("3,'No','HLS will have to split anyway',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
return 0;// Otherwise stay on this page
}
Console.WriteLine("3,'Yes','HLS will have to split',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
return 1; // Paginate on High Level Steps
}
}
if (yWithinMargins > yPageSize / 4)
{
Console.WriteLine("4,'No','Not Half way down the page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
return 0; // More than half way down the page
}
//if (ChildrenBelow.Count > 0 && ChildrenBelow[0].YSize < yWithinMargins)
// return 0;
Console.WriteLine("5,'Yes','At least half the page is filled',{0},{1},{2},{3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
return 2;
}
}
@@ -110,7 +147,7 @@ namespace Volian.Print.Library
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{
float yLocation = yPageStart - YOffset;
Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, HeaderWidth, 100);
Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, HeaderWidth, 100,"");
return yPageStart;
}
}
@@ -120,7 +157,7 @@ namespace Volian.Print.Library
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{
float yLocation = yPageStart - YOffset;
Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, TabWidth, 100);
Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, TabWidth, 100, "");
return yPageStart;
}
}
@@ -152,7 +189,7 @@ namespace Volian.Print.Library
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{
float yLocation = yPageStart - YOffset;
Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100);
Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, "");
return yPageStart;
}
}
@@ -161,12 +198,16 @@ namespace Volian.Print.Library
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{
float yLocation = yPageStart - YOffset;
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
if (textLayer != null) cb.BeginLayer(textLayer);
MyContentByte = cb;
System.Drawing.Color push = PrintOverride.SvgColor;
PrintOverride.SvgColor = PrintOverride.TextColor == System.Drawing.Color.Empty ? System.Drawing.Color.Black : PrintOverride.TextColor ;
if (MyPageHelper != null && MyPageHelper.MySvg != null)
MyPageHelper.MySvg.DrawMacro(MacroDef, XOffset, yLocation, cb);
PrintOverride.SvgColor = push;
if (textLayer != null) cb.EndLayer();
return yPageStart;
}
}