PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.de/

Having the header Logo print only on the first page
http://forum.pdfsharp.de/viewtopic.php?f=2&t=1506
Page 1 of 1

Author:  csalerno [ Thu Jan 13, 2011 9:34 pm ]
Post subject:  Having the header Logo print only on the first page

I'm new to MigraDoc and have picked up the maintenance of an existing application that has suddenly started printing the header logo on all of the pages instead of only the first. I have set the DifferentFirstPageHeaderFooter flag to True and when I do that the logo disappears from the first page and is still on all preceding pages.

Thanks
Chuck

Author:  JohnHodkinson [ Tue Feb 22, 2011 1:25 pm ]
Post subject:  Re: Having the header Logo print only on the first page

Hi, I too was having the same problem. All I did to solve this was:

// Set the DifferentFirstPageHeaderFooter.
document.DefaultPageSetup.DifferentFirstPageHeaderFooter = true;


I then change the following line:
From: var myImage = section.Headers.Primary.AddImage("ImageLocation");
To: var myImage = section.Headers.FirstPage.AddImage("ImageLocation");


// E.g. Add the image to the document's first page.
var myImage = section.Headers.FirstPage.AddImage("ImageLocation");
myImage.Height = "2.5cm";
myImage.LockAspectRatio = true;
myImage.RelativeVertical = RelativeVertical.Line;
myImage.RelativeHorizontal = RelativeHorizontal.Margin;
myImage.Top = ShapePosition.Top;
myImage.Left = ShapePosition.Right;
myImage.WrapFormat.Style = WrapStyle.Through;

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