PDFsharp & MigraDoc Foundation http://forum.pdfsharp.de/ |
|
How to determine the height of multiline string http://forum.pdfsharp.de/viewtopic.php?f=2&t=1331 |
Page 1 of 1 |
Author: | Chau [ Mon Sep 13, 2010 2:49 pm ] |
Post subject: | How to determine the height of multiline string |
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 |
Author: | Chau [ Tue Sep 14, 2010 9:42 am ] |
Post subject: | Re: How to determine the height of multiline string |
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 ![]() |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |