C2018-004 logic to print meta file information
C2018-009 logic to print PROMS version on PDF pages
This commit is contained in:
parent
5cff214b0e
commit
72a91a6431
@ -156,6 +156,13 @@ namespace Volian.Print.Library
|
|||||||
set { _MyItem = value; }
|
set { _MyItem = value; }
|
||||||
}
|
}
|
||||||
private string _Watermark;
|
private string _Watermark;
|
||||||
|
//C2018-009 print PROMS version
|
||||||
|
private string _PromsVersion = "";
|
||||||
|
public string PromsVersion
|
||||||
|
{
|
||||||
|
get { return _PromsVersion; }
|
||||||
|
set { _PromsVersion = value; }
|
||||||
|
}
|
||||||
private string _PDFFile;
|
private string _PDFFile;
|
||||||
public string PDFFile
|
public string PDFFile
|
||||||
{
|
{
|
||||||
@ -415,6 +422,7 @@ namespace Volian.Print.Library
|
|||||||
private PdfLayer _PagelistLayer;
|
private PdfLayer _PagelistLayer;
|
||||||
private PdfLayer _DebugLayer;
|
private PdfLayer _DebugLayer;
|
||||||
private PdfLayer _WatermarkLayer;
|
private PdfLayer _WatermarkLayer;
|
||||||
|
private PdfLayer _PROMSVersionLayer; //C2018-009 print PROMS version
|
||||||
private void CreateLayers(PdfContentByte cb)
|
private void CreateLayers(PdfContentByte cb)
|
||||||
{
|
{
|
||||||
if (DebugOutput)
|
if (DebugOutput)
|
||||||
@ -426,6 +434,8 @@ namespace Volian.Print.Library
|
|||||||
_DebugLayer = new PdfLayer("Debug", cb.PdfWriter);
|
_DebugLayer = new PdfLayer("Debug", cb.PdfWriter);
|
||||||
_WatermarkLayer = new PdfLayer("Watermark", cb.PdfWriter);
|
_WatermarkLayer = new PdfLayer("Watermark", cb.PdfWriter);
|
||||||
_WatermarkLayer.SetPrint("Watermark", true);
|
_WatermarkLayer.SetPrint("Watermark", true);
|
||||||
|
_PROMSVersionLayer = new PdfLayer("PROMS Version", cb.PdfWriter); //C2018-009 print PROMS version
|
||||||
|
_PROMSVersionLayer.SetPrint("PROMS Version", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void CloseDocument(string fileName)
|
private void CloseDocument(string fileName)
|
||||||
@ -503,6 +513,11 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
rct = PageSize.LETTER;
|
rct = PageSize.LETTER;
|
||||||
}
|
}
|
||||||
|
// C2018-004 create meta file for baseline compares
|
||||||
|
if (currentSection.IsStepSection)
|
||||||
|
Volian.Base.Library.BaselineMetaFile.WriteLine("{0}", rct);
|
||||||
|
else
|
||||||
|
Volian.Base.Library.BaselineMetaFile.WriteLine("UseWordMargins={0} {1} ", (wordMargins)?"Y":"N", rct);
|
||||||
//Console.WriteLine("\"{0}\"\t\"{1}\"\t\"{2}\"\t\"{3}\"\t{4}"
|
//Console.WriteLine("\"{0}\"\t\"{1}\"\t\"{2}\"\t\"{3}\"\t{4}"
|
||||||
// , currentSection == null ? "" : currentSection.DisplayNumber + " " + currentSection.DisplayText
|
// , currentSection == null ? "" : currentSection.DisplayNumber + " " + currentSection.DisplayText
|
||||||
// , nextSection == null ? "" : nextSection.DisplayNumber + " " + nextSection.DisplayText
|
// , nextSection == null ? "" : nextSection.DisplayNumber + " " + nextSection.DisplayText
|
||||||
@ -811,11 +826,13 @@ namespace Volian.Print.Library
|
|||||||
_MyHelper.TextLayer = _TextLayer;
|
_MyHelper.TextLayer = _TextLayer;
|
||||||
_MyHelper.BackgroundLayer = _BackgroundLayer;
|
_MyHelper.BackgroundLayer = _BackgroundLayer;
|
||||||
_MyHelper.DebugLayer = _DebugLayer;
|
_MyHelper.DebugLayer = _DebugLayer;
|
||||||
|
_MyHelper.PROMSVersionLayer = _PROMSVersionLayer; //C2018-009 print PROMS version
|
||||||
}
|
}
|
||||||
_MyHelper.Rev = _Rev;
|
_MyHelper.Rev = _Rev;
|
||||||
_MyHelper.Watermark = _Watermark;
|
_MyHelper.Watermark = _Watermark;
|
||||||
_MyHelper.DoZoomOMatic = DebugOutput;
|
_MyHelper.DoZoomOMatic = DebugOutput;
|
||||||
_MyHelper.OriginalPageBreak = OriginalPageBreak;
|
_MyHelper.OriginalPageBreak = OriginalPageBreak;
|
||||||
|
_MyHelper.PROMSVersion = _PromsVersion; //C2018-009 print PROMS version
|
||||||
OnStatusChanged("After Set PageEvent", PromsPrinterStatusType.SetPageEvent);
|
OnStatusChanged("After Set PageEvent", PromsPrinterStatusType.SetPageEvent);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -873,9 +890,7 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
if (((cb.PdfWriter.CurrentPageNumber % 2 == 0 && !_MyHelper.CreatingFoldoutPage) || myProcedure.ProcHasSupInfoData) && InsertBlankPages) // Bug Fix: B2016-181 - add blank page if page count is even
|
if (((cb.PdfWriter.CurrentPageNumber % 2 == 0 && !_MyHelper.CreatingFoldoutPage) || myProcedure.ProcHasSupInfoData) && InsertBlankPages) // Bug Fix: B2016-181 - add blank page if page count is even
|
||||||
{
|
{
|
||||||
_MyHelper.OnBlankPage = true;
|
InsertBlankPage(cb);
|
||||||
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
|
|
||||||
NewPage();
|
|
||||||
}
|
}
|
||||||
GenerateTOC(mySection, myProcedure, cb, _TextLayer);
|
GenerateTOC(mySection, myProcedure, cb, _TextLayer);
|
||||||
}
|
}
|
||||||
@ -896,9 +911,7 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
// only insert a blank page if this section does not have a foldout (but the procedure as a whole does)
|
// only insert a blank page if this section does not have a foldout (but the procedure as a whole does)
|
||||||
// and the checkbox on the print dialog to add blank pages is checked
|
// and the checkbox on the print dialog to add blank pages is checked
|
||||||
_MyHelper.OnBlankPage = true;
|
InsertBlankPage(cb);
|
||||||
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
|
|
||||||
NewPage();
|
|
||||||
//_MyLog.InfoFormat("NewPage Begin Step Sect blank {0}", cb.PdfWriter.CurrentPageNumber);
|
//_MyLog.InfoFormat("NewPage Begin Step Sect blank {0}", cb.PdfWriter.CurrentPageNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -908,9 +921,7 @@ namespace Volian.Print.Library
|
|||||||
// need a blank 'facing page'. Sections after the first will get blank 'facing page' in print's pagination logic
|
// need a blank 'facing page'. Sections after the first will get blank 'facing page' in print's pagination logic
|
||||||
if (SupInfoPrintType==E_SupInfoPrintType.Merge && !mySection.HasSupInfoSteps && firstStepSec && InsertBlankPages)
|
if (SupInfoPrintType==E_SupInfoPrintType.Merge && !mySection.HasSupInfoSteps && firstStepSec && InsertBlankPages)
|
||||||
{
|
{
|
||||||
_MyHelper.OnBlankPage = true;
|
InsertBlankPage(cb);
|
||||||
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
|
|
||||||
NewPage();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -967,6 +978,14 @@ namespace Volian.Print.Library
|
|||||||
return outputFileName;
|
return outputFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void InsertBlankPage(PdfContentByte cb)
|
||||||
|
{
|
||||||
|
_MyHelper.OnBlankPage = true;
|
||||||
|
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
|
||||||
|
NewPage();
|
||||||
|
Volian.Base.Library.BaselineMetaFile.WriteLine("==Insert Blank Page==");
|
||||||
|
}
|
||||||
|
|
||||||
private void SetupProperties(PdfDocument document, ProcedureInfo myProcedure)
|
private void SetupProperties(PdfDocument document, ProcedureInfo myProcedure)
|
||||||
{
|
{
|
||||||
document.AddTitle(string.Format("{0} {1}",myProcedure.DisplayNumber,myProcedure.DisplayText));
|
document.AddTitle(string.Format("{0} {1}",myProcedure.DisplayNumber,myProcedure.DisplayText));
|
||||||
@ -1007,7 +1026,8 @@ namespace Volian.Print.Library
|
|||||||
mySection.PageNumberNextPass = _MyHelper.CurrentPageNumber;
|
mySection.PageNumberNextPass = _MyHelper.CurrentPageNumber;
|
||||||
}
|
}
|
||||||
int profileDepth = ProfileTimer.Push(">>>> CreateWordDocPdf");
|
int profileDepth = ProfileTimer.Push(">>>> CreateWordDocPdf");
|
||||||
_MyHelper.MySection = mySection;
|
if (_MyHelper.MySection != mySection) // C2018-004 create meta file for baseline compares - assigning MySection again will reprocess the Page List
|
||||||
|
_MyHelper.MySection = mySection;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OnStatusChanged("Get Section", PromsPrinterStatusType.GetSection);
|
OnStatusChanged("Get Section", PromsPrinterStatusType.GetSection);
|
||||||
@ -1021,6 +1041,8 @@ namespace Volian.Print.Library
|
|||||||
cb.SetFontAndSize(BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED), 20);
|
cb.SetFontAndSize(BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED), 20);
|
||||||
cb.SetTextMatrix(cb.PdfDocument.Left+200,cb.PdfDocument.Bottom+cb.PdfDocument.Top / 2);
|
cb.SetTextMatrix(cb.PdfDocument.Left+200,cb.PdfDocument.Bottom+cb.PdfDocument.Top / 2);
|
||||||
cb.ShowText("Word Section Invalid");
|
cb.ShowText("Word Section Invalid");
|
||||||
|
// C2018-004 create meta file for baseline compares
|
||||||
|
Volian.Base.Library.BaselineMetaFile.WriteLine("!!Word Section Invalid: ID {0} \"{1}\" \"{2}\"",mySection.ItemID, mySection.DisplayNumber, mySection.DisplayText);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1082,13 +1104,13 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
// only insert a blank page if this section does not have a foldout (but the procedure as a whole does)
|
// only insert a blank page if this section does not have a foldout (but the procedure as a whole does)
|
||||||
// and the checkbox on the print dialog to add blank pages is checked
|
// and the checkbox on the print dialog to add blank pages is checked
|
||||||
_MyHelper.OnBlankPage = true;
|
InsertBlankPage(cb);
|
||||||
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
|
|
||||||
NewPage();
|
|
||||||
//_MyLog.InfoFormat("NewPage 3 blank {0}", cb.PdfWriter.CurrentPageNumber);
|
//_MyLog.InfoFormat("NewPage 3 blank {0}", cb.PdfWriter.CurrentPageNumber);
|
||||||
}
|
}
|
||||||
float yoff = 0;
|
float yoff = 0;
|
||||||
if (_MyHelper.DidFirstPageDocStyle) yoff = origYoff - (float)mySection.MyDocStyle.Layout.TopMargin;
|
if (_MyHelper.DidFirstPageDocStyle) yoff = origYoff - (float)mySection.MyDocStyle.Layout.TopMargin;
|
||||||
|
// C2018-004 create meta file for baseline compares
|
||||||
|
Volian.Base.Library.BaselineMetaFile.WriteLine("WD Hight={0} Width={1} scPgCnt={2} locEnd={3} pdfSz={4} xOff={5} yOff={6}", fgPage.Height, fgPage.Width, sectPageCount, locEndOfWordDoc, pdfSize, (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0.0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0.0) + yoff);
|
||||||
AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0) + yoff);
|
AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0) + yoff);
|
||||||
if(DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2}",
|
if(DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2}",
|
||||||
_MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath,pageNumber);
|
_MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath,pageNumber);
|
||||||
@ -1226,6 +1248,8 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
int sectCnt = 0; // keep count of which section/sub-section we are processing
|
int sectCnt = 0; // keep count of which section/sub-section we are processing
|
||||||
bool doSubY = false;
|
bool doSubY = false;
|
||||||
|
// C2018-004 create meta file for baseline compares
|
||||||
|
Volian.Base.Library.BaselineMetaFile.WriteLine("TOC Ystart {0} LeftMar {1} ScNmPos {2} ScTtlPos {3} ScPgPos {4}", yPageStart, leftMargin, secNumPos, secTitlePos, secPagePos);
|
||||||
foreach (SectionInfo mySection in ii.Sections)
|
foreach (SectionInfo mySection in ii.Sections)
|
||||||
{
|
{
|
||||||
sectCnt++;
|
sectCnt++;
|
||||||
@ -2090,9 +2114,7 @@ namespace Volian.Print.Library
|
|||||||
if (SupInfoPdfPage.ContainsKey(itemid)) getpage = SupInfoPdfPage[itemid];
|
if (SupInfoPdfPage.ContainsKey(itemid)) getpage = SupInfoPdfPage[itemid];
|
||||||
if (getpage < 0)
|
if (getpage < 0)
|
||||||
{
|
{
|
||||||
myPageHelper.OnBlankPage = true;
|
InsertBlankPage(cb);
|
||||||
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
|
|
||||||
NewPage();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PdfImportedPage sipage = null;
|
PdfImportedPage sipage = null;
|
||||||
@ -2130,9 +2152,7 @@ namespace Volian.Print.Library
|
|||||||
// only insert a blank page if this is the very first page printed & section has a foldout
|
// only insert a blank page if this is the very first page printed & section has a foldout
|
||||||
// and the checkbox on the print dialog to add blank pages is checked. This will put out a blank page as
|
// and the checkbox on the print dialog to add blank pages is checked. This will put out a blank page as
|
||||||
// as the first page so that duplex printing is correct for this condition.
|
// as the first page so that duplex printing is correct for this condition.
|
||||||
myPageHelper.OnBlankPage = true;
|
InsertBlankPage(cb);
|
||||||
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
|
|
||||||
NewPage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SectionInfo saveSect = myPageHelper.MySection;
|
SectionInfo saveSect = myPageHelper.MySection;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user