PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 10:54 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: Fri Jul 10, 2009 6:30 am 
Offline

Joined: Fri Jul 10, 2009 6:26 am
Posts: 6
Hello.

I am generating tables to a pdf document using MigraDoc and I want to make sure the whole table is on the same page (given that the page height is less than the document page's height, which should always be true). I thought KeepTogether property might have something to do with this, however it seems to have no effect (either set to true or false).

Please help!

PS: Is there any documentation available?


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 13, 2009 9:41 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Hi!

Documentation will be available with the next release (scheduled for this summer (northern hemisphere)).

Theoretically you should be able to solve the problem using the KeepWith property of the first row (this is an Int that indicates how many rows will be kept together).

Another approach would be setting the HeadingFormat property of every row to true. This is just a bool, therefore no calculations required.
This is a bit of a hack. Make sure the table fits on one page!

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 13, 2009 10:29 am 
Offline

Joined: Fri Jul 10, 2009 6:26 am
Posts: 6
Thank you for your response, it works now.

Now I'd just like to know how do I get height of the page? I tried with

Code:
Document document;
Table data;

...

double pageheight = document.LastSection.PageSetup.PageHeight.Centimeter;
double rowheight = data.Rows[0].Height.Centimeter;



however this property is always 0 (for both Document and Table). Is there any way I can get to the information so I can make sure the table will fit on the page?


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 13, 2009 11:17 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
This is a chicken or egg dilemma: these properties will be filled after the document was rendered.

With "make sure" I meant to use a limit in your code.
E. g. for an invoice table, only use KeepWith if there are less than e. g. 20 rows (or even less if there can be long texts in the rows).
I don't know what's in your table so I don't know whether or not this is possible.

I'm not sure what will happen if you try to force the program to put something on one page that is too big to fit:
  • maybe it'll break
  • maybe it'll look ugly (drawing beyond the page boundary)
  • maybe it'll get stuck in an endless loop (this should not happen (if it happens please report it as a bug))

_________________
Regards
Thomas Hoevel
PDFsharp Team


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: Bing [Bot] and 374 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