Hi,

I'm using iTextSharp to build a PDF from XHTML data, and I'm having trouble
getting some of the default HTML tags to render properly.  I originally used
the ParseXHtml method to build the PDF, and that works fine.  I needed to
set a relative URL location for my images, so I created a custom pipeline to
do it.  While the images render correctly, some tags, such as b and i, do
not.  Am I doing something wrong setting the tag factory?  Here's the code
I'm currently using.

MemoryStream memStream = new MemoryStream();

StringReader xmlString = new StringReader(outXml);

using (Document document = new Document())
{
   PdfWriter writer = PdfWriter.GetInstance(document, memStream);
   document.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
   document.Open();

   CssFilesImpl cssFiles = new CssFilesImpl();
   cssFiles.Add(XMLWorkerHelper.GetInstance().GetDefaultCSS());
   StyleAttrCSSResolver cssRevolver = new StyleAttrCSSResolver();

   HtmlPipelineContext htmlContext = new HtmlPipelineContext();
   htmlContext.SetTagFactory(Tags.GetHtmlTagProcessorFactory());
                
   htmlContext.SetImageProvider(new MyImageProvider(imagePath));

   IPipeline pipeline = new CssResolverPipeline(cssRevolver, new
HtmlPipeline(htmlContext, new PdfWriterPipeline(document, writer)));
   XMLWorker worker = new XMLWorker(pipeline, true);
   XMLParser p = new XMLParser(worker);
   p.Parse(xmlString);

   document.Close();
}

--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/iTextSharp-XMLWorker-custom-pipeline-isn-t-rendering-HTML-tags-tp4218390p4218390.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
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