Many thanks for your answer
I'll try to explain it better...

The final goal is to write Html text into Header and Footer of a Pdf. That
Html must contain the number of total pages too
For example: <b>Page 1 of <i>6</i></b>

For do that I've create a class that extend PdfPageEventHelper just like the
example.
In the onEndPage method I add a PdfTemplate object to the document.
In the onCloseDocument method, I try to write Html text to that PdfTemplate
object

For write Html I the method 'parse' of HTMLWorker object but HTMLWorker can
write only on a DocListener so I've created a new class called DocElement
that extends Paragraph and implements DocListener

After I've write the Html text in this DocElement object I add it to a
PdfPtable and I write the PdfPtable object to the template

All works fine if my Html doesn't contain any ' table' tag.

About your question, if I add my DocElement object to Document with
Document.add I can see the table in the PDF correctly

But my goal is add it to PdfTemplate. So How can I do it?

Probabily there is a simpler way to add Html text with total pages in the
Header but I'm not able to find it.

Can anyone help me?
Is it clear now my problem?

Many thanks
Tantalo Christian


-----Messaggio originale-----
Da: 1T3XT info [mailto:[email protected]] 
Inviato: venerdì 24 luglio 2009 12:13
A: Post all your questions about iText here
Oggetto: Re: [iText-questions] how to write html into PdfTemplate object

Christian wrote:
> Hi All
> 
> I’m not able to find a method to write Html text into a Template. I must 
> use a Template cause of I don’t know the number of the total pages.

Please clarify.
Saying "I must use a Template cause I don't know the number of the total 
pages" is like saying "I must eat an apple, because I don't know if 1 
plus 1 is two". Why do you need to use a Template? What do you mean by 
Template? Is it an existing PDF file? Is it a PdfTemplate object?
Specify!

> I’ve create a class called DocElement that extends Paragraph and 
> implements DocListner

Huh? Why? What does it do?

> I’ve used HTMLWorker to write Html text into a DocElement object

OK.

> I’ve added the DocElement object to a PdfPCell of a PdfPTable

Wow, why that introduce that much complexity into your application?

> I’ve write that PdfPTable to the PdfTemplate using the method 
> writeSelectedRows

Aha, you're talking about using PdfTemplate.
Please explain why you need to use PdfTemplate.
Wouldn't ColumnText do the trick?

> It works fine for all html tags except for tag table.
> 
> So If my Html is
> <p>before<table><tr><td>Col A</td><td>Col B</td><td>Col 
> C</td></tr></table>after</p>
> In the PDF I can see only “before after” without the table.

Do you see the table if you try converting the same HTML to a PDF file 
using nothing more than document.add()?

> If I add the DocElement object to the Document instead of the 
> PdfTemplate, the Html text is write correctly with the table too.
> 
> How can I write the Html text correctly to the Template too?

Your question is overly complex; you're mixing all kinds of concepts, 
and we have no idea where to start reading. Please use Occam's razor to 
distill your question to something we can understand.
-- 
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

----------------------------------------------------------------------------
--
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

__________ Informazione NOD32 4273 (20090724) __________

Questo messaggio  è stato controllato dal Sistema Antivirus NOD32
http://www.nod32.it



------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to