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

Formatting bold words in XRectangle
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3627
Page 1 of 1

Author:  SteBruBra [ Wed Jul 19, 2017 11:11 am ]
Post subject:  Formatting bold words in XRectangle

Hello,

I'm new to PdfSharp and need a little bit help:

I have a HTML-Formated text coming from a database. This text must be placed in a predefined rectangle (no problem). The text length is variable and it contains one or many words written in bold.
The generated text must contain this bold written words too. How can I do this?

Thanks for help.

Stephan

Author:  Thomas Hoevel [ Wed Jul 19, 2017 1:43 pm ]
Post subject:  Re: Formatting bold words in XRectangle

Hi!
SteBruBra wrote:
I have a HTML-Formated text coming from a database.
So parse that HTML and draw the text using regular and bold fonts at the appropriate positions.
Use XGraphics.MeasureString to determine the lengths of the words to as you'll have to deal with linebreaks.

MigraDoc might help making things much easier. Use the RenderObject method of DocumentRenderer if you want to try this. Create a Paragraph and add the text using the AddFormattedText method of Paragraph.
You still have parse the HTML.

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