Hi,

I have tried using the HTMLWorker and it works quite good but I have a small
problem.
-------------
The HTML formatted string looks like this: "<strong>text
text</strong><br/><br/>more text<br/>more text"
I want to use one font for the text inside the <strong>-tags and another for
the rest of the text.
After processing, I insert it into a ColumnText.

To solve the font problem I inserted the text between <li>-tags before
parsing it (don't know if it was the best solution, but it works):
"<li><strong>text text</strong><br/><br/>more text<br/>more text</li>"
-------------
However, I have problem with the line breaks not appearing in the PDF.
When I add the string directly to the ColumnText the line breaks are shown,
but when I parse it through HTMLWorker the line breaks are omitted.

How do I solve this?
An example would be much appreciated.

//Daniel


Bruno Lowagie (iText) wrote:
> 
> meeger wrote:
>> Hi,
>> 
>> Is it possible to change the font inside a string?
> 
> Yes.
> 
>> I have a string containing html formatting tags and want to change the
>> font
>> depending on these tags.
> 
> Use HTMLWorker. See chapter 14.
> When I refer to a chapter number, but you don't have the book,
> you can always look for the examples in that chapter here:
> http://1t3xt.info/examples/itext-in-action.php
> You'll find this example:
> http://1t3xt.info/examples/browse/?page=example&id=233
> 
> Suppose that the 'tags' aren't HTML, then you could create
> your own parser and use Chunks as explained by Alexis and
> combine different chunks into a Phrase or a Paragraph.
> This is explained in chapter 4 of the book.
> 
>> I know this is possible with PDFLib (replacing the tags with <fontname
>> ...>)
>> but how should I do in iText?
> 
> With iText you even have a mechanism called FontSelector.
> But that's another story. FontSelector doesn't work with
> tags, but looks at the UNICODE value of each character.
> If a Chinese character encountered, it tries finding a
> font (in a list of fonts you've provided) that has this
> character. (This is explained in chapter 9.)
> 
> best regards,
> Bruno
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> Do you like iText?
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> Or leave a tip: https://tipit.to/itexttipjar
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Different-fonts-in-single-string-tp17556542p17587390.html
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to