This commit is contained in:
parent
7e05b609f2
commit
99cc264fb0
@ -119,6 +119,36 @@ namespace Volian.Print.Library
|
|||||||
cb.MoveTo(x + w, y-1);
|
cb.MoveTo(x + w, y-1);
|
||||||
cb.LineTo(x, 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.Stroke();
|
||||||
cb.EndLayer();
|
cb.EndLayer();
|
||||||
cb.RestoreState();
|
cb.RestoreState();
|
||||||
@ -448,12 +478,13 @@ namespace Volian.Print.Library
|
|||||||
SvgGroup svgGroup = new SvgGroup();
|
SvgGroup svgGroup = new SvgGroup();
|
||||||
foreach (VEPROMS.CSLA.Library.PageItem pageItem in pageStyle.PageItems)
|
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)
|
foreach (Match match in matches)
|
||||||
{
|
{
|
||||||
string token = match.Value;
|
string token = match.Value;
|
||||||
|
//token = Regex.Replace(token, @"[\xB3-\xDF]", " ");
|
||||||
switch (match.Value)
|
switch (match.Value)
|
||||||
{
|
{
|
||||||
case "{HEADER1}":
|
case "{HEADER1}":
|
||||||
@ -469,6 +500,7 @@ namespace Volian.Print.Library
|
|||||||
case "{BOX6}":
|
case "{BOX6}":
|
||||||
case "{BOX7}":
|
case "{BOX7}":
|
||||||
case "{BOX8}":
|
case "{BOX8}":
|
||||||
|
case "{BOX9}":
|
||||||
svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(token)));
|
svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(token)));
|
||||||
break;
|
break;
|
||||||
case "{DRAFTPAGE}":
|
case "{DRAFTPAGE}":
|
||||||
@ -478,13 +510,15 @@ namespace Volian.Print.Library
|
|||||||
//mySvg.SetValidWaterMark(token, _Watermark); // Need logic to limit watermark to tokens.
|
//mySvg.SetValidWaterMark(token, _Watermark); // Need logic to limit watermark to tokens.
|
||||||
break;
|
break;
|
||||||
case "{PROCTITLE}":
|
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;
|
break;
|
||||||
case "{EOPNUM}":
|
case "{EOPNUM}":
|
||||||
svgGroup.Add(PageItemToSvgText(pageItem, section.MyProcedure.MyContent.Number));
|
svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, section.MyProcedure.MyContent.Number)));
|
||||||
break;
|
break;
|
||||||
case "{SECTIONLEVELTITLE}":
|
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));
|
svgGroup.Add(PageItemToSvgText(pageItem, section.DisplayText));
|
||||||
break;
|
break;
|
||||||
case "{SECTIONLEVELNUMBER}":
|
case "{SECTIONLEVELNUMBER}":
|
||||||
@ -499,7 +533,7 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
int indx = token.IndexOf("-");
|
int indx = token.IndexOf("-");
|
||||||
string val = procConfig.GetValue("PSI", token.Substring(4,token.Length-5));
|
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="))
|
else if (token.Contains(@"PS="))
|
||||||
@ -536,11 +570,12 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
mySvg.Add(svgGroup);
|
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 (len == null || ItemInfo.StripRtfFormatting(title).Length < len)
|
||||||
{
|
{
|
||||||
|
if (match == "{PROCTITLE2}") return; // this would have been done in proctitle1
|
||||||
svgGroup.Add(PageItemToSvgText(pageItem, title));
|
svgGroup.Add(PageItemToSvgText(pageItem, title));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -670,7 +705,7 @@ namespace Volian.Print.Library
|
|||||||
else
|
else
|
||||||
svgText.Justify = SvgJustify.Center;
|
svgText.Justify = SvgJustify.Center;
|
||||||
svgText.Font = pageItem.Font.WindowsFont;
|
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);
|
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
|
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;
|
return svgText;
|
||||||
@ -687,7 +722,7 @@ namespace Volian.Print.Library
|
|||||||
else
|
else
|
||||||
svgText.Justify = SvgJustify.Center;
|
svgText.Justify = SvgJustify.Center;
|
||||||
svgText.Font = pageItem.Font.WindowsFont;
|
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);
|
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
|
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;
|
return svgText;
|
||||||
|
@ -33,7 +33,7 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (float)_TabAlign * _CharsToTwips;
|
return (float)_TabAlign * MyFont.CharsToTwips;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private float? _TabOffset;
|
private float? _TabOffset;
|
||||||
@ -48,19 +48,40 @@ namespace Volian.Print.Library
|
|||||||
while (Text[(int)_TabOffset] == ' ')
|
while (Text[(int)_TabOffset] == ' ')
|
||||||
_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;
|
MyContentByte = cb;
|
||||||
MyParent = myparent;
|
MyParent = myparent;
|
||||||
YOffset = yoffset;
|
YOffset = yoffset;
|
||||||
Text = cleanTab;
|
Text = cleanTab;
|
||||||
Width = _CharsToTwips * Text.Length;
|
|
||||||
Rtf = GetRtf(origTab, vFont);
|
|
||||||
XOffset = xoffset - Width;
|
|
||||||
MyFont = vFont;
|
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)
|
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ namespace Volian.Print.Library
|
|||||||
Rtf = GetRtf(origText, vFont);
|
Rtf = GetRtf(origText, vFont);
|
||||||
XOffset = xoffset;
|
XOffset = xoffset;
|
||||||
MyFont = vFont;
|
MyFont = vFont;
|
||||||
Width = _CharsToTwips * (Text.Length + 2);
|
Width = MyFont.CharsToTwips * (Text.Length + 2);
|
||||||
}
|
}
|
||||||
public vlnText()
|
public vlnText()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user