PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DrawString problem

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
Grovah



Joined: 17 Sep 2008
Posts: 4

PostPosted: Wed Sep 17, 2008 10:16 am    Post subject: DrawString problem Reply with quote

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
View user's profile Send private message
Grovah



Joined: 17 Sep 2008
Posts: 4

PostPosted: Wed Sep 17, 2008 1:58 pm    Post subject: Reply with quote

Answering my own post, maybe it can help someone else Wink.

A XTextFormatter object was the solution, found it in the "TextLayout" example C# project.

/G
Back to top
View user's profile Send private message
gastan



Joined: 18 Oct 2008
Posts: 25

PostPosted: Sun Oct 19, 2008 7:20 pm    Post subject: Reply with quote

yup, that did it
Back to top
View user's profile Send private message
gastan



Joined: 18 Oct 2008
Posts: 25

PostPosted: Mon Oct 20, 2008 7:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Tue Oct 21, 2008 7:58 am    Post subject: Reply with quote

Use MigraDoc for high-level formatting features.
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
gastan



Joined: 18 Oct 2008
Posts: 25

PostPosted: Wed Oct 22, 2008 8:30 pm    Post subject: Reply with quote

yeah
but thaen I need to do AddText, AddTextFormat, AddText, AddTextFormat all the time.
some simple markup would be pretty cool
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com