Added Unit Specif logic
Added “Final Page” logic Added “Final Page” logic, fixed PDF compare where it wasn’t finding the file in the Compare folder Added Caution and Note boxes for Turkey Point Null check and logic for PosAdjust format variable Added “Final Page” message logic Fix to get proper with of tabs containing a solid bullet
This commit is contained in:
@@ -73,7 +73,13 @@ namespace Volian.Print.Library
|
||||
get { return _MyPdfContentByte; }
|
||||
set { _MyPdfContentByte = value; }
|
||||
}
|
||||
|
||||
private int _FinalMessageSectionID;
|
||||
|
||||
public int FinalMessageSectionID
|
||||
{
|
||||
get { return _FinalMessageSectionID; }
|
||||
set { _FinalMessageSectionID = value; }
|
||||
}
|
||||
public override void OnCloseDocument(PdfWriter writer, iTextSharp.text.Document document)
|
||||
{
|
||||
AddBookmarks(writer);
|
||||
@@ -456,6 +462,12 @@ namespace Volian.Print.Library
|
||||
MyPdfContentByte.AddTemplate(MyPageCounts.AddToTemplateList(key, MyPdfWriter, args.MyText, args.MySvgText.Font, args.MySvgText.Align, args.MySvgText.FillColor), args.MySvgScale.X(args.MySvgText.X), args.MySvgScale.Y(MyPdfContentByte, args.MySvgText.Y));
|
||||
return string.Empty;
|
||||
}
|
||||
if (args.MyText.Contains("{FINALPAGE}") && MySection.ItemID == FinalMessageSectionID)
|
||||
{
|
||||
string key = "FinalPage";
|
||||
MyPdfContentByte.AddTemplate(MyPageCounts.AddToTemplateList(key, MyPdfWriter, args.MyText,MySection.MyDocStyle.Final.Message, args.MySvgText.Font, args.MySvgText.Align, args.MySvgText.FillColor), args.MySvgScale.X(args.MySvgText.X), args.MySvgScale.Y(MyPdfContentByte, args.MySvgText.Y));
|
||||
return string.Empty;
|
||||
}
|
||||
return regexFindToken.Replace(args.MyText, new MatchEvaluator(ReplacePageListToken));
|
||||
}
|
||||
private string BuildMyText(VEPROMS.CSLA.Library.FormatInfo activeFormat)
|
||||
@@ -497,8 +509,25 @@ namespace Volian.Print.Library
|
||||
private void AddPageListItems(Volian.Svg.Library.Svg mySvg, VEPROMS.CSLA.Library.PageStyle pageStyle, VEPROMS.CSLA.Library.SectionInfo section)
|
||||
{
|
||||
SvgGroup svgGroup = new SvgGroup();
|
||||
//int defPtPerRow = 72 / 6;
|
||||
//int curLPI = 6; // default
|
||||
//int prevLPI = 6;
|
||||
//float PrevRow = 0;
|
||||
//float rowAdj = 0; // = 18;
|
||||
foreach (VEPROMS.CSLA.Library.PageItem pageItem in pageStyle.PageItems)
|
||||
{
|
||||
//if (PrevRow > 0)
|
||||
//{
|
||||
// //float pgRow = (float)(pageItem.Row + rowAdj);
|
||||
// if (curLPI != prevLPI)
|
||||
// {
|
||||
// int prow = (int)(PrevRow / defPtPerRow);
|
||||
// int nrows = ((int)(pageItem.Row / defPtPerRow)) - prow;
|
||||
// rowAdj += (float)Math.Abs(((nrows * (72 / curLPI)) - ((nrows * defPtPerRow) + rowAdj)));
|
||||
// //rowAdj += (float)(((pgRow - PrevRow) / (72 * prevLPI)) * (72 / curLPI));
|
||||
// prevLPI = curLPI;
|
||||
// }
|
||||
//}
|
||||
MatchCollection matches = regexFindToken.Matches(pageItem.Token);
|
||||
if (matches.Count>0)
|
||||
{
|
||||
@@ -544,12 +573,25 @@ namespace Volian.Print.Library
|
||||
case "{PROCTITLE}":
|
||||
case "{PROCTITLE1}":
|
||||
case "{PROCTITLE2}":
|
||||
case "{COVERPROCTITLE}":
|
||||
float linelen = (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength * (float)pageItem.Font.CPI / 12;
|
||||
SplitTitle(svgGroup, pageItem, section.MyProcedure.MyContent.Text, (int)linelen, token);
|
||||
SplitTitle(svgGroup, pageItem, section.MyProcedure.MyContent.Text, (int)linelen, token); //,rowAdj);
|
||||
//SplitTitle(svgGroup, pageItem, section.MyProcedure.MyContent.Text, (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength, token);
|
||||
break;
|
||||
case "{COVERTITLE1}":
|
||||
case "{COVERTITLE2}":
|
||||
int ctlen = section.ActiveFormat.PlantFormat.FormatData.ProcData.CoverTitleLength??0;
|
||||
float coverlinelen = ((ctlen == 0) ? (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength : ctlen) * (float)pageItem.Font.CPI / 12;
|
||||
SplitCoverTitle(svgGroup, pageItem, section.MyProcedure.MyContent.Text, (int)coverlinelen, token);//, rowAdj);
|
||||
//SplitTitle(svgGroup, pageItem, section.MyProcedure.MyContent.Text, (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength, token);
|
||||
break;
|
||||
case "{EOPNUM}":
|
||||
svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, section.MyProcedure.MyContent.Number)));
|
||||
string eopnum = section.MyProcedure.MyContent.Number;
|
||||
string unitnum = MySection.MyDocVersion.DocVersionConfig.Unit_ProcedureNumber;
|
||||
if (unitnum.Length > 0)
|
||||
eopnum = unitnum.Replace("#", eopnum);
|
||||
svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, eopnum)));
|
||||
//svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, section.MyProcedure.MyContent.Number)));
|
||||
break;
|
||||
case "{SECTIONLEVELTITLE}":
|
||||
SplitTitle(svgGroup, pageItem, section.DisplayText, section.ActiveFormat.PlantFormat.FormatData.SectData.SectionTitleLength, token);
|
||||
@@ -558,6 +600,9 @@ namespace Volian.Print.Library
|
||||
case "{SECTIONLEVELNUMBER}":
|
||||
svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token,section.DisplayNumber)));
|
||||
break;
|
||||
case "{UNITTEXT}":
|
||||
svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token,MySection.MyDocVersion.DocVersionConfig.Unit_Text)));
|
||||
break;
|
||||
default:
|
||||
// see if it's a PSI token:
|
||||
if (token.Contains(@"PS-"))
|
||||
@@ -590,6 +635,15 @@ namespace Volian.Print.Library
|
||||
if (val != null && val != "")svgGroup.Add(PageItemToSvgText(pageItem, val));
|
||||
}
|
||||
}
|
||||
//else if (token.Contains(@"{DRV:Lpi "))
|
||||
//{
|
||||
// int indx = token.IndexOf("{DRV:Lpi ") + 9;
|
||||
// int endindx = token.IndexOf("}", indx);
|
||||
// string str = token.Substring(indx, endindx - indx);
|
||||
// curLPI = Convert.ToInt32(str) / 2;
|
||||
// //PrevRow = (float)(pageItem.Row + rowAdj);
|
||||
// PrevRow = (float)pageItem.Row;
|
||||
//}
|
||||
else
|
||||
svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token));
|
||||
//_MyLog.InfoFormat("Token not processed {0}", token);
|
||||
@@ -626,6 +680,36 @@ namespace Volian.Print.Library
|
||||
yOffset += 12;
|
||||
}
|
||||
}
|
||||
private void SplitCoverTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match)
|
||||
{
|
||||
if (len == null || ItemInfo.StripRtfFormatting(title).Length < len)
|
||||
{
|
||||
if (match == "{COVERTITLE2}") return; // this would have been done in COVERTITLE1
|
||||
svgGroup.Add(PageItemToSvgText(pageItem, title));
|
||||
return;
|
||||
}
|
||||
// Otherwise determine how many line to split the text into
|
||||
List<string> titleLines = SplitText(title, (int)len);
|
||||
|
||||
if (match == "{COVERTITLE1}")
|
||||
{
|
||||
svgGroup.Add(PageItemToSvgText(pageItem, titleLines[0]));
|
||||
return;
|
||||
}
|
||||
// if the token was proctitle, dont' adjust. If the token was PROCTITLE1/2 then
|
||||
// move down 6.
|
||||
// int adj = pageItem.Token.Contains("1") || pageItem.Token.Contains("2") ? 0 : -6;
|
||||
int adj = (titleLines.Count > 2) ? -6 : 0;
|
||||
float yOffset = adj * (titleLines.Count - 2);
|
||||
int lnCnt = 0;
|
||||
foreach (string line in titleLines)
|
||||
{
|
||||
lnCnt++;
|
||||
if (lnCnt == 1) continue;
|
||||
svgGroup.Add(PageItemToSvgText(pageItem, line, yOffset));
|
||||
yOffset += 12;
|
||||
}
|
||||
}
|
||||
private List<string> SplitText(string text, int len)
|
||||
{
|
||||
List<string> results = new List<string>();
|
||||
|
Reference in New Issue
Block a user