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 

Finding height of render object

 
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
trnilse



Joined: 26 May 2009
Posts: 6

PostPosted: Wed May 27, 2009 9:19 am    Post subject: Finding height of render object Reply with quote

Hi,
I'm currently using the DocumentRenderer.RenderObject to place MigraDoc tables and text in my PDF, but i don't know how to calculate the size of the table/text. I need this to be able to place the next element correctly under the last.

Is there a way to find the height (in points) of the object that is rendered? Or is there another way of controlling layout when using multiple calls to RenderObject on the same page?

Thanks,
TK
Back to top
View user's profile Send private message
trnilse



Joined: 26 May 2009
Posts: 6

PostPosted: Fri May 29, 2009 8:22 am    Post subject: Reply with quote

I found at least one way, wich requires a modification to MigraDoc. It is a non-breaking change, so it might be an idea for later versions.. ?

Anyway, I modified MigraDoc.Rendering.DocumentRenderer.RenderObject() to return an XRect:

Code:
    public XRect RenderObject(XGraphics graphics, XUnit xPosition, XUnit yPosition, XUnit width, DocumentObject documentObject)


Then appended the line:

Code:
       return new XRect(renderer.RenderInfo.LayoutInfo.ContentArea.X,
            renderer.RenderInfo.LayoutInfo.ContentArea.Y,
            renderer.RenderInfo.LayoutInfo.ContentArea.Width,
            renderer.RenderInfo.LayoutInfo.ContentArea.Height);

at the end. Then it will return the dimensions of the object that is being rendered (ContentArea is an internal class, so i can't return that directly).

Improvements / other suggestions are welcome...
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