PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 10:47 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Oct 11, 2018 8:48 am 
Offline

Joined: Thu Oct 11, 2018 8:37 am
Posts: 5
Hi everyone,
I'm lurking here around for the last few days, and thank you for the huge amount of really useful clarifications I've found so far!
But I have a problem I can't solve.
I need to make a PDF, with MigraDoc, with a quite "particular" format.
I've several sections (Cover, TOC, Chapter 1, Chapter 2, and so on) and I need to have the first page of the section without any header/footer, but from page 2 until the end of the section, the header/footer should be present.
I've tried several combination of Section.PageSetup.DifferentFirstPageHeaderFooter / Section.Headers.FirstPage / Section.Headers.Primary with no luck :( :( :( :( .
Do you have any ideas on how can I have this behavior :roll: ?

Thanks a lot in advance!

Best regards


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 11, 2018 9:22 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Hi!
Anandir wrote:
I've tried several combination of Section.PageSetup.DifferentFirstPageHeaderFooter / Section.Headers.FirstPage / Section.Headers.Primary with no luck
This approach works when used properly.
We use it in our applications.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 11, 2018 9:30 am 
Offline

Joined: Thu Oct 11, 2018 8:37 am
Posts: 5
Thomas Hoevel wrote:
Hi!
This approach works when used properly.
We use it in our applications.


First of all, thanks for your reply!
There are some example, that I didn't found, that I can use as "source of ideas"?
What I'm doing at the moment is something like that (only for the footer at the moment):

Code:
actualSection.PageSetup.DifferentFirstPageHeaderFooter = true;
BuildFirstFooter(actualSection.Footers.FirstPage);
BuildFooter(actualSection.Footers.Primary);


BuildFirstFooter, just an "empty footer":
Code:
private void BuildFirstFooter(HeaderFooter hr)
{
Paragraph paragraph = hr.AddParagraph();
paragraph.Format = new ParagraphFormat();
}


In the BuildFooter function, a build the "real" footer. A table with some elements and a top border.
I don't understand what I'm doing wrong here :| :| :| !


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 11, 2018 1:20 pm 
Offline

Joined: Thu Oct 11, 2018 8:37 am
Posts: 5
After a partial rewrite the problem "is gone".
Now is working properly.
Probably something wrong happened in the code...

Thanks a lot for the help!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 139 guests


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 post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group