Hi all, sorry if this is slightly out of context but I posted it to the
iTextSharp mailing list and I got an automatic response which redirected me
to this more generic list. I'm probably doing something stupid but I cannot
let the HtmlWorker parser create a PDF output from a very simple HTML
fragment. My HTML code is like:

 

<p align="center">Some text</p><p>Some other text.</p>

 

It's a short text using only tags p, b, and i. Anyway, all what I get when
creating the PDF is about 15 bytes like:

 

%PDF-1.4

%????

 

Here's my C# code (it returns a stream as it's going to be used on the web):

 

Document doc = new Document(PageSize.A4, 10, 10, 42, 35); 

MemoryStream ms = new MemoryStream(); 

PdfWriter writer = PdfWriter.GetInstance(doc, ms); 

writer.CloseStream = false; 

doc.Open(); 

StringReader reader = new StringReader(sHtml); 

HTMLWorker parser = new HTMLWorker(doc); 

parser.Parse(reader); 

ms.Flush(); 

ms.Position = 0; 

return ms;

 

I googled around for some samples, but I keep finding older code typically
using ParseToList and most of the posts I found about HtmlWorker are
concerned with style or contain code like mine. What I'm doing wrong?

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to