This commit is contained in:
@@ -73,6 +73,7 @@ namespace Volian.Print.Library
|
||||
get { return _MyPdfContentByte; }
|
||||
set { _MyPdfContentByte = value; }
|
||||
}
|
||||
|
||||
public override void OnCloseDocument(PdfWriter writer, iTextSharp.text.Document document)
|
||||
{
|
||||
AddBookmarks(writer);
|
||||
@@ -80,12 +81,24 @@ namespace Volian.Print.Library
|
||||
}
|
||||
public override void OnEndPage(PdfWriter writer, iTextSharp.text.Document document)
|
||||
{
|
||||
AddBookmarks(writer);
|
||||
MyPageCounts.CanIncrement = true;
|
||||
base.OnEndPage(writer, document);
|
||||
DrawChangeBars(writer.DirectContent);
|
||||
DrawMessages(writer.DirectContent);
|
||||
DrawRuler(writer.DirectContent);
|
||||
if (!OnFoldoutPage)
|
||||
{
|
||||
AddBookmarks(writer);
|
||||
MyPageCounts.CanIncrement = true;
|
||||
base.OnEndPage(writer, document);
|
||||
DrawChangeBars(writer.DirectContent);
|
||||
DrawMessages(writer.DirectContent);
|
||||
if (!CreatingFoldoutPage)
|
||||
DrawRuler(writer.DirectContent);
|
||||
}
|
||||
else
|
||||
{
|
||||
MyPageCounts.CanIncrement = true;
|
||||
base.OnEndPage(writer, document);
|
||||
if (!CreatingFoldoutPage)
|
||||
DrawRuler(writer.DirectContent);
|
||||
|
||||
}
|
||||
}
|
||||
private void DrawRuler(PdfContentByte cb)
|
||||
{
|
||||
@@ -120,7 +133,7 @@ namespace Volian.Print.Library
|
||||
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.Rectangle((float)layout.LeftMargin, (float)(cb.PdfWriter.PageSize.Height - layout.TopMargin), (float)layout.PageWidth - (float)layout.LeftMargin, (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
|
||||
@@ -377,18 +390,26 @@ namespace Volian.Print.Library
|
||||
mySvg.ProcessText += new SvgProcessTextEvent(mySvg_ProcessText);
|
||||
return mySvg;
|
||||
}
|
||||
PageCounts MyPageCounts = null;
|
||||
public PageCounts MyPageCounts = null;
|
||||
private static Regex regexFindToken = new Regex("{[^{}]*}");
|
||||
private string mySvg_ProcessText(object sender, SvgProcessTextArgs args)
|
||||
{
|
||||
if (args.MyText == null) return string.Empty; // KBR needed for WCN crash
|
||||
if (args.MyText == null) return string.Empty; // Needed for empty genmac text (was space in 16bit files)
|
||||
if (!args.MyText.Contains("{"))
|
||||
return args.MyText;
|
||||
/*
|
||||
* Check if tokens for handling page counts ({PAGE} {OF} etc). if so, do templates.
|
||||
*/
|
||||
if (args.MyText.Contains("{DOCCURPAGE}") || args.MyText.Contains("{DOCTOTPAGE}"))
|
||||
{
|
||||
string key = "DocCurPage." + MySection.ItemID;
|
||||
string txt = args.MyText.Replace("{DOCCURPAGE}", "{PAGE}").Replace("{DOCTOTPAGE}", "{OF}");
|
||||
MyPdfContentByte.AddTemplate(MyPageCounts.AddToTemplateList(key, MyPdfWriter, txt, 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("{PAGE}") || args.MyText.Contains("{OF}"))
|
||||
{
|
||||
#region numberingseq
|
||||
/*
|
||||
public enum E_NumberingSequence : uint
|
||||
{
|
||||
@@ -405,6 +426,7 @@ namespace Volian.Print.Library
|
||||
Like6_ButDoesntNeedSubsection1 = 10
|
||||
};
|
||||
*/
|
||||
#endregion
|
||||
// default for the key is to make it NumberingSequence. Then handle
|
||||
// specific cases.
|
||||
string key = ((int)MySection.MyDocStyle.NumberingSequence).ToString();
|
||||
@@ -503,6 +525,17 @@ namespace Volian.Print.Library
|
||||
case "{BOX9}":
|
||||
svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(token)));
|
||||
break;
|
||||
case "{PMODEBOX}": // need to set either 1 or 2 depending on number of columns
|
||||
string box = "1";
|
||||
if (_MySection.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.Four)
|
||||
box = "4";
|
||||
else if (_MySection.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.Three)
|
||||
box = "3";
|
||||
else if (_MySection.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.Two)
|
||||
box = "2";
|
||||
box = "{BOX" + box + "}";
|
||||
svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(box)));
|
||||
break;
|
||||
case "{DRAFTPAGE}":
|
||||
case "{REFERENCEPAGE}":
|
||||
case "{MASTERPAGE}":
|
||||
@@ -522,7 +555,7 @@ namespace Volian.Print.Library
|
||||
svgGroup.Add(PageItemToSvgText(pageItem, section.DisplayText));
|
||||
break;
|
||||
case "{SECTIONLEVELNUMBER}":
|
||||
svgGroup.Add(PageItemToSvgText(pageItem, section.DisplayNumber));
|
||||
svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token,section.DisplayNumber)));
|
||||
break;
|
||||
default:
|
||||
// see if it's a PSI token:
|
||||
|
Reference in New Issue
Block a user