PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Footer formatting for PageOrientation.Landscape
https://forum.pdfsharp.net/viewtopic.php?f=2&t=552
Page 1 of 1

Author:  jbanko [ Tue Nov 25, 2008 5:44 pm ]
Post subject:  Footer formatting for PageOrientation.Landscape

I defined new MigraDoc document m_Doc and added section:
Section sec = m_Doc.AddSection();

Then I created the footer and appropriate paragraph:
HeaderFooter footer = sec.Footers.Primary;
Paragraph footerPara = new Paragraph();

Then I defined paragraph format:
ParagraphFormat pf = new ParagraphFormat(); and set the alignment to:
ParagraphAlignment.Right;

Page definition is:
PdfPage page = docRender.PdfDocument.Pages[0];
page.Size = PageSize.Letter;

While using page.Orientation = PageOrientation.Portrait and
XRect rect = new XRect(new XPoint(0, 0), new XSize(page.Width.Point, (page.Height.Point - 30)));
my footer was aligned to the right, but when I changed to page.Orientation = PageOrientation.Landscape; my ParagraphAlignment.Right; was around the centre.

What would be the proper solution to align to the right for landscape?

Author:  jbanko [ Thu Nov 27, 2008 3:52 pm ]
Post subject:  Footer formatting for PageOrientation.Landscape

I found the way how to resolve the footer formatting issues for landscape orientation:

1. After the footer section definition I defined last section page setup orientation as landscape for my MigraDoc document m_Doc:

m_Doc.LastSection.PageSetup.Orientation = Orientation.Landscape;

2. Then after setting the footer paragraph format I used the default page orientation portrait and the whole .pdf output was rendered with landscape orientation and I have full control over footer paragraph formatting:

page.Orientation = PageOrientation.Portrait;

So if anybody had similar challenge, you may probably use the same idea.
Jan

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/