This commit is contained in:
2011-05-19 13:39:30 +00:00
parent 7e05b609f2
commit 99cc264fb0
3 changed files with 73 additions and 17 deletions

View File

@@ -119,6 +119,36 @@ namespace Volian.Print.Library
cb.MoveTo(x + w, y-1);
cb.LineTo(x, y-1);
}
Layout layout = MySection.MyDocStyle.Layout;
cb.Rectangle((float)layout.LeftMargin, (float)(cb.PdfWriter.PageSize.Height - layout.TopRow), (float)layout.PageWidth, (float)-layout.PageLength);
cb.MoveTo(0, 504);
cb.LineTo(612, 504);
for (float x1 = 0; x1 < 612; x1 += 6) // tic marks every 1/8 inch
{
if (x1 % 72 == 0)
{
cb.MoveTo(x1, 484);
cb.LineTo(x1, 524);
}
else if (x1 % 36 == 0)
{
cb.MoveTo(x1, 494);
cb.LineTo(x1, 514);
}
else
{
cb.MoveTo(x1, 499);
cb.LineTo(x1, 509);
}
}
//cb.MoveTo(122.4F, 0); //WCN2 HLS
//cb.LineTo(122.4F, cb.PdfWriter.PageSize.Height);
//cb.MoveTo(78, 0); // HLP HLS
//cb.LineTo(78, cb.PdfWriter.PageSize.Height);
//cb.MoveTo(441, 0); // HLP cover page date
//cb.LineTo(441, cb.PdfWriter.PageSize.Height);
//cb.MoveTo(71.4F, 0); // WCN Purpose page, Revision: {REV}
//cb.LineTo(71.4F, cb.PdfWriter.PageSize.Height);
cb.Stroke();
cb.EndLayer();
cb.RestoreState();
@@ -448,12 +478,13 @@ namespace Volian.Print.Library
SvgGroup svgGroup = new SvgGroup();
foreach (VEPROMS.CSLA.Library.PageItem pageItem in pageStyle.PageItems)
{
if (regexJustTokens.IsMatch(pageItem.Token))
MatchCollection matches = regexFindToken.Matches(pageItem.Token);
if (matches.Count>0)
{
MatchCollection matches = regexFindToken.Matches(pageItem.Token);
foreach (Match match in matches)
{
string token = match.Value;
//token = Regex.Replace(token, @"[\xB3-\xDF]", " ");
switch (match.Value)
{
case "{HEADER1}":
@@ -469,6 +500,7 @@ namespace Volian.Print.Library
case "{BOX6}":
case "{BOX7}":
case "{BOX8}":
case "{BOX9}":
svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(token)));
break;
case "{DRAFTPAGE}":
@@ -478,13 +510,15 @@ namespace Volian.Print.Library
//mySvg.SetValidWaterMark(token, _Watermark); // Need logic to limit watermark to tokens.
break;
case "{PROCTITLE}":
SplitTitle(svgGroup, pageItem, section.MyProcedure.MyContent.Text, (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength);
case "{PROCTITLE1}":
case "{PROCTITLE2}":
SplitTitle(svgGroup, pageItem, section.MyProcedure.MyContent.Text, (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength, token);
break;
case "{EOPNUM}":
svgGroup.Add(PageItemToSvgText(pageItem, section.MyProcedure.MyContent.Number));
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);
SplitTitle(svgGroup, pageItem, section.DisplayText, section.ActiveFormat.PlantFormat.FormatData.SectData.SectionTitleLength, token);
svgGroup.Add(PageItemToSvgText(pageItem, section.DisplayText));
break;
case "{SECTIONLEVELNUMBER}":
@@ -499,7 +533,7 @@ namespace Volian.Print.Library
{
int indx = token.IndexOf("-");
string val = procConfig.GetValue("PSI", token.Substring(4,token.Length-5));
svgGroup.Add(PageItemToSvgText(pageItem, val));
svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token,val)));
}
}
else if (token.Contains(@"PS="))
@@ -536,11 +570,12 @@ namespace Volian.Print.Library
}
mySvg.Add(svgGroup);
}
private void SplitTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len)
private void SplitTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match)
{
// TODO: need to calculate len in either points or inches and use the font from the pageItem to determine the number of characters
if (match == "{PROCTITLE2}") return;
if (len == null || ItemInfo.StripRtfFormatting(title).Length < len)
{
if (match == "{PROCTITLE2}") return; // this would have been done in proctitle1
svgGroup.Add(PageItemToSvgText(pageItem, title));
return;
}
@@ -670,7 +705,7 @@ namespace Volian.Print.Library
else
svgText.Justify = SvgJustify.Center;
svgText.Font = pageItem.Font.WindowsFont;
svgText.X = new SvgMeasurement((float)(pageItem.Col ?? 0), E_MeasurementUnits.PT);
svgText.X = new SvgMeasurement((float)(pageItem.Col), E_MeasurementUnits.PT);
svgText.Y = new SvgMeasurement((float)(pageItem.Row ?? 0), E_MeasurementUnits.PT);
if (svgText.Font.Underline && svgText.Text.EndsWith(" ")) svgText.Text = svgText.Text.Substring(0, svgText.Text.Length - 1) + "\xA0";// replace last space with a hardspace
return svgText;
@@ -687,7 +722,7 @@ namespace Volian.Print.Library
else
svgText.Justify = SvgJustify.Center;
svgText.Font = pageItem.Font.WindowsFont;
svgText.X = new SvgMeasurement((float)(pageItem.Col ?? 0), E_MeasurementUnits.PT);
svgText.X = new SvgMeasurement((float)pageItem.Col, E_MeasurementUnits.PT); // new SvgMeasurement((float)(pageItem.Col ?? 0), E_MeasurementUnits.PT);
svgText.Y = new SvgMeasurement((float)(yOffset + pageItem.Row ?? 0), E_MeasurementUnits.PT);
if (svgText.Font.Underline && svgText.Text.EndsWith(" ")) svgText.Text = svgText.Text.Substring(0, svgText.Text.Length - 1) + "\xA0";// replace last space with a hardspace
return svgText;