>> You have to use the html 3.2 <font>. 
It's a pitty to tell the users they have to use that outdated tag, 
but OK it works so they'll have to live with it.

A bug I think:
The tags <H1> to <H6> work in the reverse order they should.
H1 should be rendered in the largest font and H6 in the smallest.
HtmlWorker does the reverse.

>> I'll add support this week for the style attribute.
That would be a nice improvement!
What URL can I look at to see if that new version is available?

Thank you so much for the time you spend 
to answer these questions and to develop iText.
Geert




----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, August 29, 2006 9:12 AM
Subject: Re: [iText-questions] HTML-formatted text


Hi Paulo,
Thanks for taking the time to answer me.

OK. I searched the mailing list archives on "HTMLWorker".
But as far as I can see, you have to define/know your style beforehand:

StyleSheet style = new StyleSheet();
style.loadTagStyle("div", "color", "red");
java.io.StringReader sr = new java.io.StringReader(
      "<div style=\"color=\"red\" \">This is the TITLE in red.</div>");
java.util.ArrayList list = HTMLWorker.parseToList(sr, style);

PdfPTable table = new PdfPTable(1);
table.addCell( new PdfPCell( (Paragraph)list.get(0) ) );
document.add(table);

If I leave out the line
        style.loadTagStyle("div", "color", "red");
I don't get the resulting line in the PDF file in red.

So, I have to "parse" myself what's inside the HTML string,
to be able to apply the needed tagstyles to become the correct result?
That's not what I had expected.
I expected to simply feed HTMLWorker some HTML string
and to have HTMLWorker interpret it according to its content
with as a result a Paragraph containing text formatted
according to what's in the HTML string.

In fact, if you have to specify the styles to use yourself
'beforehand',
what's the use of HTMLWorker in my case where the user can enter
whatever HTML code he wants in the HTML string?
E.g.
<div style=\"color=\"red\" \">This is the TITLE in red with the last
word in </div>
<div style=\"color=\"red\" \">green</div>

Can I conclude that HTMLWorker is not usable in this case?
Thanks for your time.
Geert


----- Original Message ----- 
From: Paulo Soares <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 28, 2006 8:25 PM
Subject: Re: HTML-formatted text

>> Use HTMLWorker. It will give you a list of paragraphs that you can use
>> anywhere such as positioning it absolutely with ColumnText.

>> Paulo

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 28, 2006 3:21 PM
Subject: HTML-formatted text


Hi,

In my app I have to create PDF hard copies of the reports created on
the
screen (Save as PDF)
The header of a report is defined by the user himself.
He's allowed to use  HTML formatting to format the header according to
his whishes.
A possible (simple) header string could be:

       <div style=\"color:red; font-size:16px\">This is the header in
       red.</div>

Now the only possible way to add HTML formatted text to a PDF document
I
found
is using HtmlParser.parse():

         String content = "<div style=\"color:red; font-size:16px\">This
         is text in red.</div>";
         java.io.StringReader reader = new
         java.io.StringReader("<p>"+content+"</p>");
         com.lowagie.text.html.HtmlParser.parse(document, reader);

This works OK.

Now my question is this:
how can I get (a reference to) the Chunk, Paragraph, Section or
wathever
element iText creates
when it writes that HTML formatted text in the PDF file?

In fact I want to create a table with that HTML formatted text in one
of
the cells.
Is that possible?
In that case the method HtmlParser.parse(document,...) doesn't help me
much.
How do I do it?

Second question: (How) can I position that HTML-formatted text
absolutely?


Kind Regards,
Geert Delmeiren

PS. Bruno, I recently discovered you're a compatriot of me ;?)
     Nice work iText is!

-- 
http://www.fastmail.fm - Choose from over 50 domains or use your own


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to