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

How to have number of lines TextFormatter
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1410
Page 1 of 1

Author:  zolectronic [ Mon Nov 08, 2010 6:39 pm ]
Post subject:  How to have number of lines TextFormatter

Hello, i'm french (sorry for my english :oops: ) and i have a question.

The TextFormatter do back on line automatically but i want to know the number of lines display or height of text ?

Thank you.

Author:  mikesowerbutts [ Wed Nov 10, 2010 9:33 am ]
Post subject:  Re: How to have number of lines TextFormatter

Hi,

are you trying to find a way to trim text to a particular height? or do you just want to know the height for another reason?

If its trimming the text, I encountered this issue when I was trying to print a "fixed" layout pdf page where the data was frequently longer than the space allowed.

Let me know and I will try to help.

Thanks,

Mike

Author:  zolectronic [ Wed Nov 10, 2010 5:28 pm ]
Post subject:  Re: How to have number of lines TextFormatter

Hi, thanks for your reponse.

I create invoices (bill) dynamically.

In the description column, the text length is variable.
So I must know the number line of this item or I have to put the next item.

Do you understand why I need to know the real heigth of the textformatter ?

Thanks for the futur reply.

Author:  mikesowerbutts [ Thu Nov 11, 2010 9:23 am ]
Post subject:  Re: How to have number of lines TextFormatter

Hi,

you should use MigraDoc for this. I always create a MigraDoc.DocumentObjectModel.Tables.Table object, then add rows/columns to this. Then in each cell I add a MigraDoc.DocumentObjectModel.Paragraph object, then add my text to the Paragraph using the myparagraph.AddFormattedText("text", migraDocFont); function. The table/paragraph objects will then handle all the height formatting for you - you just need to put text in the correct paragraphs.

I only use PdfSharp for drawing graphics directly (i.e. line graph etc.) onto a page. for everything to do with text, I always use MigraDoc. Look at the MigraDoc samples as i believe they cover tables etc.

Hope this helps.

Mike

Author:  zolectronic [ Thu Nov 11, 2010 12:19 pm ]
Post subject:  Re: How to have number of lines TextFormatter

Thanks for your reply.

Effectively, i used the bad librairy.

With MigraDoc it's easier for create an invoice.

Thank again

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