PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Jul 18, 2024 11:34 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Mon Sep 13, 2010 2:49 pm 
Offline

Joined: Thu Jun 17, 2010 8:32 am
Posts: 4
I am using PDFSharp to do some absolute positioning of both text and images. I have a text of varying length and I need to know how much space it is going to take up on my page. I am using an XTextFormatter to do the drawing and wrapping of the text, but as far as I can see, I need to specify the rectangle it is allowed to span - which is where my problem is: How do I determine how much space it is going to require?

My late afternoon non-thinking brain tells me, that if I specify the width of the rectangle, then the XTextFormatter should be able to determine the required height - or am I completely wrong here?

Regards, Casper


Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 14, 2010 9:42 am 
Offline

Joined: Thu Jun 17, 2010 8:32 am
Posts: 4
I ended up modifying the XTextFormatter.cs to allow public access to the height of the area occupying actual text after a call to DrawString(...). The rectangle parsed on to DrawString contains a height approaching infinite, thus allowing all the text to be written.

Not the greatest approach, but it seems to work for now :?


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

All times are UTC


Who is online

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