This commit is contained in:
parent
7e05b609f2
commit
99cc264fb0
@ -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();
|
||||
@ -447,13 +477,14 @@ 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)
|
||||
{
|
||||
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;
|
||||
|
@ -33,7 +33,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
return (float)_TabAlign * _CharsToTwips;
|
||||
return (float)_TabAlign * MyFont.CharsToTwips;
|
||||
}
|
||||
}
|
||||
private float? _TabOffset;
|
||||
@ -48,19 +48,40 @@ namespace Volian.Print.Library
|
||||
while (Text[(int)_TabOffset] == ' ')
|
||||
_TabOffset++;
|
||||
}
|
||||
return (float)_TabOffset * _CharsToTwips;
|
||||
return (float)_TabOffset * MyFont.CharsToTwips;
|
||||
}
|
||||
}
|
||||
public vlnTab(PdfContentByte cb, vlnParagraph myparent, string origTab, string cleanTab, float xoffset, float yoffset, VE_Font vFont)
|
||||
private vlnMacro _MyMacro;
|
||||
public vlnMacro MyMacro
|
||||
{
|
||||
get { return _MyMacro; }
|
||||
set { _MyMacro = value; }
|
||||
}
|
||||
|
||||
public vlnTab(PdfContentByte cb, vlnParagraph myparent, string origTab, string cleanTab, float xoffset, float yoffset, VE_Font vFont, bool doSectTab)
|
||||
{
|
||||
MyContentByte = cb;
|
||||
MyParent = myparent;
|
||||
YOffset = yoffset;
|
||||
Text = cleanTab;
|
||||
Width = _CharsToTwips * Text.Length;
|
||||
Rtf = GetRtf(origTab, vFont);
|
||||
XOffset = xoffset - Width;
|
||||
MyFont = vFont;
|
||||
Width = MyFont.CharsToTwips * (Text != null ? Text.Length : origTab.Length);
|
||||
if (origTab.Contains(@"{!"))
|
||||
{
|
||||
int mindx = origTab.IndexOf(@"{!");
|
||||
int meindx = origTab.IndexOf(@"}", mindx);
|
||||
string macro = origTab.Substring(mindx, meindx - mindx+1);
|
||||
MyMacro = new vlnMacro(xoffset - Width, yoffset, macro.Substring(2, macro.Length - 3));
|
||||
origTab = origTab.Replace(macro,"");
|
||||
}
|
||||
Rtf = GetRtf(origTab, vFont);
|
||||
// do positioning based on whether format has locations for section 'header'. If it's not centered, treat
|
||||
// it's location more like a 'tab'.
|
||||
if (doSectTab)
|
||||
XOffset = xoffset;
|
||||
else
|
||||
XOffset = xoffset - Width;
|
||||
|
||||
}
|
||||
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ namespace Volian.Print.Library
|
||||
Rtf = GetRtf(origText, vFont);
|
||||
XOffset = xoffset;
|
||||
MyFont = vFont;
|
||||
Width = _CharsToTwips * (Text.Length + 2);
|
||||
Width = MyFont.CharsToTwips * (Text.Length + 2);
|
||||
}
|
||||
public vlnText()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user