From 2fd42cb33b2aa42e55d90a35f460f739d821a32b Mon Sep 17 00:00:00 2001 From: John Date: Tue, 17 Nov 2015 14:44:05 +0000 Subject: [PATCH] =?UTF-8?q?Fixed=20issue=20where=20the=20first=20page=20of?= =?UTF-8?q?=20a=20word=20section=20was=20not=20properly=20rotated=20to=20a?= =?UTF-8?q?ccount=20for=20the=20contents=20being=20set=20to=20landscape=20?= =?UTF-8?q?in=20word=20(this=20section=20is=20set=20to=20use=20Word=20marg?= =?UTF-8?q?ins)=20Fixed=20issue=20where=20a=20couple=20of=20default=20butt?= =?UTF-8?q?ons=20were=20appearing=20when=20they=20shouldn=E2=80=99t.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frmSectionProperties.cs | 4 ++-- PROMS/Volian.Print.Library/PromsPrinter.cs | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/PROMS/VEPROMS User Interface/frmSectionProperties.cs b/PROMS/VEPROMS User Interface/frmSectionProperties.cs index 05b08d45..06c3c5bf 100644 --- a/PROMS/VEPROMS User Interface/frmSectionProperties.cs +++ b/PROMS/VEPROMS User Interface/frmSectionProperties.cs @@ -283,7 +283,7 @@ namespace VEPROMS ppCmbxSectPagination.ValueMember = "EValue"; ppCmbxSectPagination.SelectedIndex = -1; SectionConfig.SectionPagination sp = _SectionConfig.Section_Pagination; - if (!(sp.ToString().Equals(_DefaultPaginationStyle))) + if (!(sp.ToString().Equals(_DefaultPaginationStyle)) && _isStepSection) { ppBtnDefaultPaginationStyle.Visible = true; ppCmbxSectPagination.SelectedValue = sp; @@ -300,7 +300,7 @@ namespace VEPROMS ppCmbxNumColumns.ValueMember = "EValue"; ppCmbxNumColumns.SelectedIndex = -1; SectionConfig.SectionColumnMode sc = _SectionConfig.Section_ColumnMode; - if (!(sc.ToString().Equals(_DefaultNumColumns))) + if (!(sc.ToString().Equals(_DefaultNumColumns)) && _isStepSection) { ppBtnDefaultNumColumns.Visible = true; ppCmbxNumColumns.SelectedValue = sc; diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index d80ffa8c..30090da6 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -377,12 +377,17 @@ namespace Volian.Print.Library } public void NewPage(bool sectionChange) { + // 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) { SectionInfo currentSection = _MyHelper.MySection; SectionInfo nextSection = GetNextSection(currentSection); // _MyHelper.MySection.NextItem as SectionInfo; - SectionConfig sc = (nextSection ?? currentSection).MyConfig as SectionConfig; + //SectionConfig sc = (nextSection ?? currentSection).MyConfig as SectionConfig; + // If we are changing to a different section, then get the config from the nextSection + // else we are still printing in the same section so get the config from the current section + SectionConfig sc = ((!sectionChange || nextSection == null)? currentSection.MyConfig : nextSection.MyConfig) as SectionConfig; bool wordMargins = (sc != null && sc.Section_WordMargin == "Y"); if (wordMargins) { @@ -408,7 +413,7 @@ namespace Volian.Print.Library rct = MyReaderHelper.GetSize(LastWordSection, _PageCountOfWordSection); } } - else + else // don't use Word margins { rct = PageSize.LETTER; } @@ -1720,7 +1725,12 @@ namespace Volian.Print.Library { key = string.Format("{0}.{1}", si.ItemID, i); dicPage.Add(key, MyPromsPrinter.MyContentByte.PdfWriter.GetImportedPage(MyReader, i)); - dicSize.Add(key, MyReader.GetPageSizeWithRotation(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 (!((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); + //dicSize.Add(key, MyReader.GetPageSizeWithRotation(i)); } } catch (Exception ex)