Ok so this is my code. I am having difficulties figuring out how to access the image provider.
Try
' step 1
Dim doc As New Document()
doc.SetPageSize(PageSize.A4)
Dim styles As New StyleSheet()
styles.LoadTagStyle(HtmlTags.BODY, HtmlTags.FONTSIZE, "13px")
styles.LoadTagStyle(HtmlTags.BODY, HtmlTags.FONTWEIGHT, "normal")
styles.LoadTagStyle(HtmlTags.BODY, HtmlTags.FONTFAMILY, "Arial")
styles.LoadStyle("hr1", "background-color", "#FFFFFF")
styles.LoadStyle("hr1", "border", "1px solid #000000")
styles.LoadStyle("hr1", "height", "2px")
styles.LoadStyle("hr1", "margin", "10px 0")
styles.LoadStyle("hr1", "width", "600px")
Dim bfTimes As pdf.BaseFont =
pdf.BaseFont.CreateFont(pdf.BaseFont.TIMES_ROMAN, pdf.BaseFont.CP1252, False)
Dim fntTIMES_ROMAN As New Font(bfTimes, 12)
Dim imageData = Convert.FromBase64String(strHexiDecimalToBase64BMP)
Dim providers As New Dictionary(Of String, Object)
providers.Add(HTMLWorker.FONT_PROVIDER, fntTIMES_ROMAN)
providers.Add(HTMLWorker.IMG_PROVIDER,
iTextSharp.text.Image.GetInstance(imageData))
Dim filePath As String = "C:\Users\anil.george\Documents\Visual
Studio 2010\Projects\phc_eSig\phc_eSig\images\test.pdf"
Using pdfStream As New FileStream(filePath, FileMode.Create,
FileAccess.Write, FileShare.None)
Using writer As iTextSharp.text.pdf.PdfWriter =
iTextSharp.text.pdf.PdfWriter.GetInstance(doc, pdfStream)
writer.CloseStream = False
doc.Open()
doc.OpenDocument()
doc.NewPage()
If doc.IsOpen() = True Then
Dim strHTML As String
Using sr As New
StreamReader("C:\Users\anil.george\Documents\Visual Studio
2010\Projects\phc_eSig\phc_eSig\multimedia\template\default-abn-part-1.html")
strHTML = sr.ReadToEnd()
End Using
Using reader As New StringReader(strHTML)
Dim ie As List(Of IElement) =
HTMLWorker.ParseToList(reader, styles, providers)
For Each element As IElement In ie
doc.Add(element)
Next
End Using
End If
doc.CloseDocument()
doc.Close()
doc.Dispose()
writer.Close()
End Using
End Using
Anil George
Senior Web Developer
[cid:[email protected]]HEALTHWORKS a division of
PASSPORTHEALTH
COMMUNICATIONS INC.
1265 Drummers La., Suite 202
Wayne, PA 19087
610-994-0302
610-354-0900 ext. 302 (Toll Free)
[email protected]<mailto:[email protected]>
http://www.passporthealth.com<http://www.passporthealth.com/>
CONFIDENTIALITY NOTICE: This e-mail communication and all attachments are for
the sole use of the intended recipient(s) and may contain confidential and
privileged information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended recipient, please
contact the sender by replying to this e-mail message and delete all copies and
attachments of the original message.
From: iText Info [mailto:[email protected]]
Sent: Thursday, April 18, 2013 9:26 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] can iTextSharp.text.Image be placed in between
external html tag
Op 18/04/2013 15:19, Anil George schreef:
Anyway I can drop a iTextSharp.text.Image in the html?
1. You're using HTMLWorker; we don't support HTMLWorker anymore. Read
http://t.co/xf02B00wgU
2. You say you need support for images, but I don't see you creating an
ImageProvider anywhere in your code.
<<inline: image001.png>>
------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________ 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
