PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
Increase first page header margin only https://forum.pdfsharp.net/viewtopic.php?f=2&t=2430 |
Page 1 of 1 |
Author: | benfosterdev [ Wed May 08, 2013 11:01 am ] |
Post subject: | Increase first page header margin only |
Hey guys, How can I increase the margin of my first page header only? On my first page I have a company logo. If I set the Section.PageSetup.TopMargin it sets the margin for all pages. Here's my code for setting up the header: Code: var section = doc.AddSection();
section.PageSetup.DifferentFirstPageHeaderFooter = true; var image = section.Headers.FirstPage.AddImage("logo.png"); image.Width = "4cm"; image.LockAspectRatio = true; image.RelativeVertical = RelativeVertical.Line; image.RelativeHorizontal = RelativeHorizontal.Margin; image.Top = ShapePosition.Top; image.Left = ShapePosition.Right; // doc content var heading = section.AddParagraph("This is a heading"); |
Author: | Thomas Hoevel [ Wed May 08, 2013 11:58 am ] |
Post subject: | Re: Increase first page header margin only |
Hi! As a workaround, I would add an empty paragraph to the first page (before the visible heading) and set its height to get that extra margin. Or create a special style for the first heading on the first page and set SpaceBefore for this style. |
Author: | benfosterdev [ Wed May 08, 2013 2:49 pm ] |
Post subject: | Re: Increase first page header margin only |
Hi Thomas, I can't see an option for specifying the Height of a Paragraph. Thanks, |
Author: | Thomas Hoevel [ Wed May 08, 2013 3:01 pm ] |
Post subject: | Re: Increase first page header margin only |
To set the spacing with the first paragraph, try something like this: Code: paragraph.Format.SpaceBefore = "20mm"; Or if you add an empty dummy paragraph, try something like this: Code: paragraph.Format.LineSpacingRule = LineSpacingRule.Exactly;
paragraph.Format.LineSpacing = "20mm"; |
Author: | benfosterdev [ Wed May 08, 2013 3:06 pm ] |
Post subject: | Re: Increase first page header margin only |
Thanks, that works great. Out of interest what is the standard Unit type for SpaceBefore/After? |
Author: | Thomas Hoevel [ Wed May 08, 2013 3:26 pm ] |
Post subject: | Re: Increase first page header margin only |
The standard is points (1/72"). |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |