PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 10:42 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: Thu Mar 14, 2013 3:16 pm 
Offline

Joined: Thu Mar 14, 2013 3:11 pm
Posts: 5
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!


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 19, 2013 9:32 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


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 363 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