B2019-165 check for use of the “Don’t Include Duplex Foldout” checkbox to prevent the foldout from printing on the back side of the last page of a Word section (Byron/Braidwood)

B2019-166 corrected issue where the margins for the next section was being gotten prematurely (when current section had multiple pages)
This commit is contained in:
John Jenko 2019-11-13 17:12:37 +00:00
parent 22978ffff5
commit 72fda5e4ae

View File

@ -508,7 +508,10 @@ namespace Volian.Print.Library
// the first time we come in here we already printed the first page.
// we are now setting up the page size for the next page
iTextSharp.text.Rectangle rct = MyReaderHelper.MyPromsPrinter.MyContentByte.PdfDocument.PageSize;
if (_MyHelper != null)
// B2019-166 Only check for Word margins if the section changed
// - was getting next section's page margins prematurely (while still processing the a multi-page section)
// - this was changing the margins/orientation of other pages in the same Word section.
if (_MyHelper != null && sectionChange)
{
SectionInfo currentSection = _MyHelper.MySection;
SectionInfo nextSection = GetNextSection(currentSection); // _MyHelper.MySection.NextItem as SectionInfo;
@ -558,7 +561,8 @@ namespace Volian.Print.Library
// Bug Fix: B2016-135 when using a large page size word section, that large page size was being used for the foldout page
// save this for the next section which will be the large page size word section.
// Bug Fix: B2018-049 supplemental printing throws off page sizes (need to do same thing as fix for foldouts)
if (_MyFoldoutReader.Count > 0 || (_MyHelper!=null && _MyHelper.MySection != null && _MyHelper.MySection.MyProcedure.ProcHasSupInfoData))
// Bug Fix: B2019-165 (Byron/Braidwood) also don't do this if the current section has Don't Include Duplex Foldout checkbox checked (automation tab of section properties)
if ((_MyFoldoutReader.Count > 0) && (_MyHelper != null && !((_MyHelper.MySection.MyConfig as SectionConfig).Section_DontIncludeDuplexFoldout) || (_MyHelper != null && _MyHelper.MySection != null && _MyHelper.MySection.MyProcedure.ProcHasSupInfoData)))
MyContentByte.PdfDocument.SetPageSize(NxtRCT);
else
MyContentByte.PdfDocument.SetPageSize(rct);
@ -758,7 +762,7 @@ namespace Volian.Print.Library
// Setup a pdf Document for printing
OnStatusChanged("Before OpenDoc", PromsPrinterStatusType.Before);
iTextSharp.text.Rectangle rct = PageSize.LETTER;
if (myProcedure.Sections != null && !myProcedure.Sections[0].IsStepSection)
if (myProcedure.Sections != null && !myProcedure.Sections[0].IsStepSection && !doingFoldout) // B2019-166 also don't do this if doing a foldout else it will use the margins set in word
{
SectionInfo si = myProcedure.Sections[0] as SectionInfo;
SectionConfig sc = si.MyConfig as SectionConfig;
@ -943,7 +947,8 @@ namespace Volian.Print.Library
{
// get first step to send to floating foldout indx.&& MyItemInfo.FoldoutIndex>-1)
ItemInfo firstStep = mySection.Steps[0];
if (firstStep.FoldoutIndex() > -1)
// B2019-165 Don't print the duplex foldout (on the back of the page) if the Don't Include Duplex Foldout check box was checked in section properties
if (firstStep.FoldoutIndex() > -1 && (mySection.MyPrevious == null || !((mySection.MyPrevious.MyConfig as SectionConfig).Section_DontIncludeDuplexFoldout)))
DoFoldoutPage(cb, "Beginning of Step Section", _TextLayer, _MyHelper, firstStep.FoldoutIndex(), InsertBlankPages);
else if (!_MyHelper.CreatingFoldoutPage && _MyFoldoutReader.Count > 0 && InsertBlankPages)
{
@ -2417,7 +2422,7 @@ namespace Volian.Print.Library
key = string.Format("{0}.{1}", si.ItemID, i);
dicPage.Add(key, MyPromsPrinter.MyContentByte.PdfWriter.GetImportedPage(MyReader, i));
iTextSharp.text.Rectangle rectgl = MyReader.GetPageSizeWithRotation(i);
// If the word page is set to landscape, but the the document sytle is not landscape, then flip the height and width (put back to portrait)
// If the word page is set to landscape, but the document style is not landscape, then flip the height and width (put back to portrait)
if (!((si.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_WordContentLandscaped) == E_DocStructStyle.DSS_WordContentLandscaped) && rectgl.Height < rectgl.Width)
rectgl = new iTextSharp.text.Rectangle(rectgl.Height, rectgl.Width);
dicSize.Add(key, rectgl);