C2019-004: Allow user to define duplex blank page text (for build only).

C2019-004: Allow user to define duplex blank page text.
This commit is contained in:
2019-01-24 15:51:42 +00:00
parent b8e250f827
commit d2aadd3045
9 changed files with 380 additions and 222 deletions

View File

@@ -253,8 +253,15 @@ namespace Volian.Print.Library
get { return _MyReaderHelper; }
set { _MyReaderHelper = value; }
}
private string _BlankPageText; // C2019-004: Allow user to define duplex blank page text
public string BlankPageText
{
get { return _BlankPageText; }
set { _BlankPageText = value; }
}
public PromsPrinter(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, string backgroundFolder, bool openPDF, bool overWrite,
ChangeBarDefinition cbd, String pdfFile, bool insertBlankPages, bool batchPrint, string prefix, bool saveLinks, bool removeTrailngHardReturnsAndManualPageBreaks)
ChangeBarDefinition cbd, String pdfFile, bool insertBlankPages, bool batchPrint, string prefix, bool saveLinks, bool removeTrailngHardReturnsAndManualPageBreaks, string blankPageText)
{
Prefix = prefix; // RHM20150506 Multiline ItemID TextBox
_MyItem = myItem;
@@ -272,6 +279,7 @@ namespace Volian.Print.Library
_MyReaderHelper = new ReaderHelper(this);
_SaveLinks = saveLinks;
_RemoveTrailingHardReturnsAndManualPageBreaks = removeTrailngHardReturnsAndManualPageBreaks;
_BlankPageText = blankPageText;
//_MyReaderHelper.LoadTree(myItem);
}
// Pass 1 PDF Name
@@ -946,7 +954,8 @@ namespace Volian.Print.Library
_MyHelper.MySvg = null;
while (cb.PdfWriter.CurrentPageNumber <= _MyHelper.BackgroundPageCount)
{
PrintTextMessage(cb, "No Proms Output", _TextLayer);
iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 30, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(PrintOverride.TextColor));
PrintTextMessage(cb, "No Proms Output", _TextLayer, font);
NewPage();
//_MyLog.InfoFormat("NewPage 2 {0}", cb.PdfWriter.CurrentPageNumber);
if (DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}'",
@@ -990,7 +999,15 @@ namespace Volian.Print.Library
public void InsertBlankPage(PdfContentByte cb)
{
_MyHelper.OnBlankPage = true;
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
if (_BlankPageText != null && _BlankPageText != "") // C2019-004: Allow user to define duplex blank page text
{
string bsfontfamily = MyItem.ActiveFormat.PlantFormat.FormatData.StepDataList[0].Font.Family;
int bsfontsize = 26;
iTextSharp.text.Font font = FontFactory.GetFont(bsfontfamily, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, bsfontsize, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(PrintOverride.TextColor));
PrintTextMessage(cb, _BlankPageText, _TextLayer, font);
}
else
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
NewPage();
Volian.Base.Library.BaselineMetaFile.WriteLine("==Insert Blank Page==");
}
@@ -1654,15 +1671,15 @@ namespace Volian.Print.Library
// PdfTemplate tmp = _MyHelper.MyTOCPageCounts.AddToTemplateList(key, _MyHelper.MyPdfWriter, "{TOCPAGE}", tOfC.Font.WindowsFont, Element.ALIGN_LEFT, PrintOverride.TextColor);
// _MyHelper.MyPdfContentByte.AddTemplate(tmp, leftMargin + secPagePos, (yPageStartAdj - yLocation) - height / 2);
//}
private static void PrintTextMessage(PdfContentByte cb, string message, PdfLayer textLayer)
private static void PrintTextMessage(PdfContentByte cb, string message, PdfLayer textLayer, iTextSharp.text.Font font)
{
if (textLayer != null) cb.BeginLayer(textLayer);
float fontSize = 30;
float fontSize = font.Size;
ColumnText ct = new ColumnText(cb);
iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, fontSize,iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(PrintOverride.TextColor));
//iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, fontSize,iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(PrintOverride.TextColor));
Chunk chk = new Chunk(message, font);
float xCenter = cb.PdfDocument.PageSize.Width / 2;
float yCenter = cb.PdfDocument.PageSize.Height / 2;
float yCenter = cb.PdfDocument.PageSize.Height / 2; // 1.8f;
float width = chk.GetWidthPoint() * 1.01F;
float height = fontSize * 1.5F;
ct.SetSimpleColumn(xCenter - width / 2, yCenter - height / 2, xCenter + width / 2, yCenter + height / 2);
@@ -1739,9 +1756,12 @@ namespace Volian.Print.Library
else if (!myItemInfo.MyDocStyle.OptionalSectionContent)
{
SectionInfo si = myItemInfo.ActiveSection as SectionInfo;
if(si.IsSeparatePagination()) // Don't output this message for continuous sections
if (si.IsSeparatePagination()) // Don't output this message for continuous sections
{
// This was causing overlap of this message with previous sections
PrintTextMessage(cb, "No Section Content", _TextLayer);
iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 30, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(PrintOverride.TextColor));
PrintTextMessage(cb, "No Section Content", _TextLayer, font);
}
}
SectionConfig.SectionPagination sp = SectionConfig.SectionPagination.Separate; // always the default
ItemInfo nxtItem = section.NextItem;