Click here to Skip to main content
15,908,444 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi,

I am getting null reference exception for a variable to which i am assigning values. Below is the code,
C#
string htmlDetail = string.Empty ;
htmlDetail = "<html><head></head><body><div style='removed: absolute;removed 250px;removed 450px;font-size: 36;border-removed1px solid black; height:100px;'>" +
"<div style='margin-removed10px;'><span style='color:red;'>Branded</span> <span>Showroom Graphics</span><hr style='margin-removed1px;'/></div>" +
"</div></body></html>";
HTMLWorker htmlWorker = new HTMLWorker(document);
PdfWriter ty = PdfWriter.GetInstance(document, Response.OutputStream);
document.Open();
htmlWorker.Parse(new StringReader(htmlDetail));

In the last statement i am getting this error for htmlDetail variable.
Any help would be appreciated.
Posted
Updated 3-Sep-13 14:15pm
v2
Comments
idenizeni 3-Sep-13 22:32pm    
Where do you initialize the document object? The htmlDetail is just a string and you are clearly setting that in your code.

http://www.codeproject.com/Articles/277065/Creating-PDF-documents-with-iTextSharp

http://www.mikesdotnetting.com/Article/80/Create-PDFs-in-ASP.NET-getting-started-with-iTextSharp

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900