Hello Everyone and thanks for your help in advance.  I amusing
iTextSharp and xmlworker to convert HTML to PDF.  I have working code
that converts some basic HTML to PDF successfully, however, when I
attempted to convert a particular HTML block in, it only generates a
blank PDF.  I have attached the code, HTML, and resulting PDF.  Any
insight into the problem would be greatly appreciated.

 

Thanks 

        Dim outXml As String = "C:\inlinetest.html"

        Dim xmlString As New StringReader(outXml)

        Dim document As New 
iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 0, 0, 0, 0)

        Dim ResultFile As String = "C:\inlineresult.pdf"

        Dim writer As PdfWriter = PdfWriter.GetInstance(document, New 
System.IO.FileStream(ResultFile, System.IO.FileMode.Create))

        document.Open()

        Dim cssFiles As New CssFilesImpl()
        cssFiles.Add(XMLWorkerHelper.GetInstance().GetDefaultCSS())
        Dim cssRevolver As New StyleAttrCSSResolver()

        Dim fp As New XMLWorkerFontProvider()
        Dim CssAppliers As New CssAppliersImpl(fp)
        Dim htmlContext As New HtmlPipelineContext(CssAppliers)

        htmlContext.SetTagFactory(Tags.GetHtmlTagProcessorFactory())

        Dim pipeline As IPipeline = New CssResolverPipeline(cssRevolver, New 
HtmlPipeline(htmlContext, New PdfWriterPipeline(document, writer)))
        Dim worker As New XMLWorker(pipeline, True)
        Dim p As New XMLParser(worker)

        Dim sr As StreamReader = New StreamReader(outXml)
        p.Parse(sr)

        document.Close()
LABORATORY REPORT

Attachment: inlineresult.pdf
Description: inlineresult.pdf

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
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