I have tried below code i am also facing the error, so please help me to solve
this error.
Thanks. I am using latest dll.
public void convertToPDF()
{
Document document = new Document();
try
{
//writer - have our own path!!!
PdfWriter.GetInstance(document, new FileStream(@"E:\Traning
Projects\ConvertDocFileToPDF\HTML-to-PDF.pdf", FileMode.OpenOrCreate));
document.Open();
strSelectUserListBuilder = "<table border='0' width='600'
cellspacing='0' cellpadding='0'>" +
"<tr>" +
"<td>" +
"<p align='center'><img border='0'
src='/images/ResumeBottomBorderBrown.jpg' width='600' height='10'><br>" +
"<font face='Arial' size='3'
color='#876E3A'><b>Consultants<br></b></font>" +
"<img border='0' src='images/ResumeBottomBorderBrown.jpg'
width='600' height='10'>" +
"</td>" +
"</tr>" +
" <tr><td>" +
"</td></tr>" +
// FOOTER
"<tr>" +
"<td>" +
"<p align='center'><img border='0'
src='images/ResumeBottomBorderBrown.jpg' width='600' height='10'>" +
"</td>" +
"</tr>" +
"</table>" +
"<br><br><br>";
//Here is where your HTML source goes................
String htmlText = strSelectUserListBuilder.ToString();
//make an arraylist ....with STRINGREADER since its no IO
reading file...
List<IElement> htmlarraylist =
iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(new
StringReader(htmlText), null);
//add the collection to the document
for (int k = 0; k < htmlarraylist.Count; k++)
{
IElement x = (IElement)htmlarraylist[k];
// document.Add((IElement)htmlarraylist[k]);
}
//document.Add(new Paragraph("And the same with
indentation...."));
// or add the collection to an paragraph
// if you add it to an existing non emtpy paragraph it will
insert it from
//the point youwrite -
Paragraph mypara = new Paragraph();//make an emtphy paragraph
as "holder"
mypara.IndentationLeft = 36;
mypara.InsertRange(0, htmlarraylist);
document.Add(mypara);
}
catch (Exception exx)
{
//Console.Error.WriteLine(exx.StackTrace);
//Console.Error.WriteLine(exx.StackTrace);
}
finally
{
document.Close();
}
}
I got this error: "The given key was not present in the dictionary."
Kindly help me. Thanks
Best Regards,
Qaisar Shabbir Awan | PowerObjects | 2nd Floor, 68W ASMA Plaza, Jinnah Avenue,
Blue Area| Islamabad 44000
Office: +92 51-280-3305 | Mobile: +92 333-564-1988 | Email:
qaisar.a...@powerobjects.com
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
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