PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

XTextFormatter DrawString dynamic height and getHeight
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2367
Page 1 of 1

Author:  CaptainGerrard8 [ Thu Mar 14, 2013 3:16 pm ]
Post subject:  XTextFormatter DrawString dynamic height and getHeight

Hi,

i am using PDFsharp and i have 2 questions.

1. i don't know the height of my text, so how should i handle this?

tf.DrawString(DYNAMIC TEXT, textFontBold, textColor, New XRect(XUnit.FromCentimeter(startX), XUnit.FromCentimeter(startY), XUnit.FromCentimeter(0.5), TEXT HEIGHT IS VARIABLE), XStringFormats.TopLeft)

2. to pos my next text line correct, i must know the height from the previous text (question 1), how can i get that height?

Thanks for your support!

Author:  Thomas Hoevel [ Tue Mar 19, 2013 9:32 am ]
Post subject:  Re: XTextFormatter DrawString dynamic height and getHeight

Hi!

A similar question was just asked on SO: http://stackoverflow.com/a/15478864/162529

Either modify XTextFormatter or switch to MigraDoc Foundation.
If a single page is not enough and you may need more pages, then better switch to MigraDoc directly.
If you are sure a single page will be enough for all times, just add an out parameter to XTextFormatter.DrawString that returns the height of the text that was just drawn.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/