Fixed issue where the first page of a word section was not properly rotated to account for the contents being set to landscape in word (this section is set to use Word margins)

Fixed issue where a couple of default buttons were appearing when they shouldn’t.
This commit is contained in:
John Jenko 2015-11-17 14:44:05 +00:00
parent 9f0d28440b
commit 2fd42cb33b
2 changed files with 15 additions and 5 deletions

View File

@ -283,7 +283,7 @@ namespace VEPROMS
ppCmbxSectPagination.ValueMember = "EValue"; ppCmbxSectPagination.ValueMember = "EValue";
ppCmbxSectPagination.SelectedIndex = -1; ppCmbxSectPagination.SelectedIndex = -1;
SectionConfig.SectionPagination sp = _SectionConfig.Section_Pagination; SectionConfig.SectionPagination sp = _SectionConfig.Section_Pagination;
if (!(sp.ToString().Equals(_DefaultPaginationStyle))) if (!(sp.ToString().Equals(_DefaultPaginationStyle)) && _isStepSection)
{ {
ppBtnDefaultPaginationStyle.Visible = true; ppBtnDefaultPaginationStyle.Visible = true;
ppCmbxSectPagination.SelectedValue = sp; ppCmbxSectPagination.SelectedValue = sp;
@ -300,7 +300,7 @@ namespace VEPROMS
ppCmbxNumColumns.ValueMember = "EValue"; ppCmbxNumColumns.ValueMember = "EValue";
ppCmbxNumColumns.SelectedIndex = -1; ppCmbxNumColumns.SelectedIndex = -1;
SectionConfig.SectionColumnMode sc = _SectionConfig.Section_ColumnMode; SectionConfig.SectionColumnMode sc = _SectionConfig.Section_ColumnMode;
if (!(sc.ToString().Equals(_DefaultNumColumns))) if (!(sc.ToString().Equals(_DefaultNumColumns)) && _isStepSection)
{ {
ppBtnDefaultNumColumns.Visible = true; ppBtnDefaultNumColumns.Visible = true;
ppCmbxNumColumns.SelectedValue = sc; ppCmbxNumColumns.SelectedValue = sc;

View File

@ -377,12 +377,17 @@ namespace Volian.Print.Library
} }
public void NewPage(bool sectionChange) 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; iTextSharp.text.Rectangle rct = MyReaderHelper.MyPromsPrinter.MyContentByte.PdfDocument.PageSize;
if (_MyHelper != null) if (_MyHelper != null)
{ {
SectionInfo currentSection = _MyHelper.MySection; SectionInfo currentSection = _MyHelper.MySection;
SectionInfo nextSection = GetNextSection(currentSection); // _MyHelper.MySection.NextItem as SectionInfo; 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"); bool wordMargins = (sc != null && sc.Section_WordMargin == "Y");
if (wordMargins) if (wordMargins)
{ {
@ -408,7 +413,7 @@ namespace Volian.Print.Library
rct = MyReaderHelper.GetSize(LastWordSection, _PageCountOfWordSection); rct = MyReaderHelper.GetSize(LastWordSection, _PageCountOfWordSection);
} }
} }
else else // don't use Word margins
{ {
rct = PageSize.LETTER; rct = PageSize.LETTER;
} }
@ -1720,7 +1725,12 @@ namespace Volian.Print.Library
{ {
key = string.Format("{0}.{1}", si.ItemID, i); key = string.Format("{0}.{1}", si.ItemID, i);
dicPage.Add(key, MyPromsPrinter.MyContentByte.PdfWriter.GetImportedPage(MyReader, 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) catch (Exception ex)