PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Jun 30, 2024 7:21 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed May 27, 2009 9:19 am 
Offline

Joined: Tue May 26, 2009 3:32 pm
Posts: 6
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


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

Joined: Tue May 26, 2009 3:32 pm
Posts: 6
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...


Top
 Profile  
Reply with quote  
 Post subject: Re:
PostPosted: Wed Nov 28, 2012 7:02 pm 
Offline

Joined: Wed Nov 28, 2012 6:57 pm
Posts: 2
trnilse wrote:
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.. ?

This is awesome! Simple, yet exactly what I need. Thanks.


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 56 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:  
cron
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group