PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Wed Nov 05, 2025 7:38 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules

Also see our new Tailored Support & Services site.



Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Dynamic headers?
PostPosted: Mon Jul 08, 2013 3:24 pm 
Offline

Joined: Mon Jul 08, 2013 3:18 pm
Posts: 5
I'm ready to give up. Can anyone tell me what I'm doing wrong?

I want two headers basically. Customer info and then customer details. however, I only want customer details header to be at the top of the next page should the details break on a page. Example:

Customer 1 info
Order # Cost Date Return?
data
data
data
data
data
PAGE BREAKS HERE
NEXT PAGE:
Order # Cost Date Return?
data
data

Customer 2 info
Order # Cost Date Return?
data
data
PAGE BREAKS HERE
NEXT PAGE:
Customer 3 info
Order # Cost Date Return?
data
data


Top
 Profile  
Reply with quote  
 Post subject: Re: Dynamic headers?
PostPosted: Mon Jul 08, 2013 3:50 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3136
Location: Cologne, Germany
Start a new section for every customer, set standard header and first page header (if you want to have them different) - that's it.

See also:
viewtopic.php?p=7223#p7223

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: Dynamic headers?
PostPosted: Mon Jul 08, 2013 3:56 pm 
Offline

Joined: Mon Jul 08, 2013 3:18 pm
Posts: 5
Thanks Thomas, but will a new section cause a page break? Will I end up with this?

Customer 1
very little data


Page Break

Customer 2
very little data

Page Break...etc...


Top
 Profile  
Reply with quote  
 Post subject: Re: Dynamic headers?
PostPosted: Mon Jul 08, 2013 4:13 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3136
Location: Cologne, Germany
xedious wrote:
but will a new section cause a page break?
Yes. So it seems this is a major drawback for you.

Do you use tables?
Put customer info in one table, customer details in second table. The heading row of the table will be repeated on every page.
There is no way to prevent page breaks between the two tables, but you can prevent the first table (customer info) from breaking across two pages.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: Dynamic headers?
PostPosted: Mon Jul 08, 2013 4:44 pm 
Offline

Joined: Mon Jul 08, 2013 3:18 pm
Posts: 5
Thanks again! I am using tables. I think I solved it with your last suggestion. I was creating my details table outside of the customer loop. This caused this to happen:

Details for cust1

Details for cust 2

Details for cust 3

Cust1 header
Cust2 header
Cust3 header

I put the details table creation INSIDE the loop and all appears to be fine now.

Again, THANKS!


Top
 Profile  
Reply with quote  
 Post subject: Re: Dynamic headers?
PostPosted: Mon Jul 08, 2013 5:43 pm 
Offline

Joined: Mon Jul 08, 2013 3:18 pm
Posts: 5
One more thing if you don't mind. Are tables somehow related to each other?

If table one has one column, it is constrained to the size of the first column in Table two, instead of spanning all the way across the page.

Edit: I figured it out. I wasn't giving explicit sizes to the columns. :oops:


Top
 Profile  
Reply with quote  
 Post subject: Re: Dynamic headers?
PostPosted: Tue Jul 09, 2013 1:28 pm 
Offline

Joined: Mon Jul 08, 2013 3:18 pm
Posts: 5
And another thing. Sorry, but my boss has requested that the customer header gets printed at the top of the next page if the details get cut on a page break. Do you have any cool way of doing this?

Edit: Once again, I just needed time to think about it.

I just merged the customer and details header into one table. Duh!


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 67 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