View previous topic :: View next topic |
Author |
Message |
Grovah
Joined: 17 Sep 2008 Posts: 4
|
Posted: Wed Sep 17, 2008 10:16 am Post subject: DrawString problem |
|
|
Hello!
I am quite new to PDFSharp and I have a problem. I am trying to draw a multiline string with the XGraphics object in the same way as I do with ordinary Graphics object.
Printing this to printer using the Graphics works fine, the text in m_strText wraps within the rectangle:
RectangleF rectText = new RectangleF(500, 100, 200, 500);
ev.Graphics.DrawString(m_strText , m_Font, m_FontBrush, rectText);
While doing this with the XGraphics object, PDFSharp generates an error, stating "height must be 0":
XRect rectText = new XRect(500, 100, 200, 500);
gfx.DrawString(m_strText, m_Font, m_FontBrush, rectText);
If it is not possible to wrap text within a rectangle, is there any good desig pattern out there to solve that issue in PDFSharp?
Regards
/Magnus |
|
Back to top |
|
|
Grovah
Joined: 17 Sep 2008 Posts: 4
|
Posted: Wed Sep 17, 2008 1:58 pm Post subject: |
|
|
Answering my own post, maybe it can help someone else .
A XTextFormatter object was the solution, found it in the "TextLayout" example C# project.
/G |
|
Back to top |
|
|
gastan
Joined: 18 Oct 2008 Posts: 25
|
Posted: Sun Oct 19, 2008 7:20 pm Post subject: |
|
|
yup, that did it |
|
Back to top |
|
|
gastan
Joined: 18 Oct 2008 Posts: 25
|
Posted: Mon Oct 20, 2008 7:53 pm Post subject: |
|
|
anyway, I have now problem, that when I want to highlight some words in text I am putting together, I have to split it into pieces and add all bold text extra. Any idea on how that would be possible with some kind of formatting ?
like <b></b> in html ? |
|
Back to top |
|
|
Thomas Hoevel
Joined: 16 Oct 2006 Posts: 387 Location: Cologne, Germany
|
Posted: Tue Oct 21, 2008 7:58 am Post subject: |
|
|
Use MigraDoc for high-level formatting features. _________________ Regards
Thomas Hoevel
PDFsharp Team |
|
Back to top |
|
|
gastan
Joined: 18 Oct 2008 Posts: 25
|
Posted: Wed Oct 22, 2008 8:30 pm Post subject: |
|
|
yeah
but thaen I need to do AddText, AddTextFormat, AddText, AddTextFormat all the time.
some simple markup would be pretty cool |
|
Back to top |
|
|
|