PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Migradoc: Add an image to the header

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
Mpasc



Joined: 03 Dec 2008
Posts: 6

PostPosted: Wed Dec 03, 2008 1:31 pm    Post subject: Migradoc: Add an image to the header Reply with quote

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
View user's profile Send private message
Mpasc



Joined: 03 Dec 2008
Posts: 6

PostPosted: Wed Dec 03, 2008 1:43 pm    Post subject: Solved! --> Migradoc: Add an image to the header Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com