View previous topic :: View next topic |
Author |
Message |
Mpasc
Joined: 03 Dec 2008 Posts: 6
|
Posted: Wed Dec 03, 2008 1:31 pm Post subject: Migradoc: Add an image to the header |
|
|
Hi,
I am using Migradoc to generate a PDF file on the fly. I would like to add an image on the header and leave some space between the image in the header and the first paragraph in the page.
In order to add the image I have the following code:
Code: |
public void DefineContentSection(Document document)
{
Section section = document.AddSection();
section.PageSetup.OddAndEvenPagesHeaderFooter = true;
section.PageSetup.StartingNumber = 1;
section.PageSetup.HeaderDistance = 0;
HeaderFooter header = section.Headers.Primary;
header.Format.SpaceAfter = 100;
header.AddImage(imageURL);
header = section.Headers.EvenPage;
header.AddImage(imageURL);
}
|
But the first paragraph is located in the middle of the picture. What I would like to have is the header with the image, one or two white lines and then the first paragraph.
I guess there must be a way to point out the height of the header or to indicate the location of the first paragraph in the page, but I haven't found it. Do you know how can I do it?
Thank you in advanced! _________________ MPasc |
|
Back to top |
|
|
Mpasc
Joined: 03 Dec 2008 Posts: 6
|
Posted: Wed Dec 03, 2008 1:43 pm Post subject: Solved! --> Migradoc: Add an image to the header |
|
|
I got it!
The solution consists of playing with HeaderDistance and TopMargin.
Here is the code:
Code: |
public void DefineContentSection(Document document)
{
Section section = document.AddSection();
section.PageSetup.OddAndEvenPagesHeaderFooter = true;
section.PageSetup.StartingNumber = 1;
//Sets the height of the top margin
section.PageSetup.TopMargin = 100;
//Sets the distance between the border of the page and the image
section.PageSetup.HeaderDistance = 10;
HeaderFooter header = section.Headers.Primary;
header.Format.SpaceAfter = 100;
header.AddImage(imageURL);
header = section.Headers.EvenPage;
header.AddImage(imageURL);
}
|
I hope it can help someone!! _________________ MPasc |
|
Back to top |
|
|
|