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 

measuring or getting the size of elements

 
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
standgale



Joined: 21 Dec 2006
Posts: 7

PostPosted: Tue Feb 05, 2008 3:48 am    Post subject: measuring or getting the size of elements Reply with quote

Surely there must be a way of getting the size of things like tables in migradoc/pdfsharp.
I am making tables and paragraphs, etc, with the Migradoc libraries and then placing them with pdfsharp. But, some of these elements can be different sizes depending on what is going in them, or, more likely, I might want to miss them out altogether.
How can I find out how big everything is to work out where to position things on my pages? I want to decide if I should put a particular table/image/paragraph on this page, or start a new page and put it there. I can't see anything obvious to either find out the size or test if something will fit and find out if it did or not.
Back to top
View user's profile Send private message
PeterGillespie



Joined: 14 Oct 2008
Posts: 8
Location: England

PostPosted: Fri Nov 07, 2008 12:30 pm    Post subject: Reply with quote

The reason this is quite difficult to accomplish is because until the objects are rendered in memory they cannot know thier final height. When we take into account all the factors such as font sizes, table widths, table padding, word wrapping, Page size etc.. until the object knows about each of these factors it cannot tell you how its going to end up looking.

So it is not until they are rendered and all of these pieces are brought together that the height is known. Think of it like getting all the pieces of car laid out on the floor in front of you, not until you build it do you know what it looks like.

My solution to this was to use the document renderer to render the object in memory (but not actually write it to a page) and return its height. This is a very expensive operation because you are effectively rendering the object twice, once to get its height and again to add it to the page.

Thanks

Pete
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