TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Snehal Pawar
NA
25
19.9k
expected closing tag img error in itext xmlworker
Nov 2 2017 1:08 AM
I am trying to convert webpage content into pdf using itextsharp
following is the code
protected
void
btnExport_Click(
object
sender, EventArgs e)
{
StringReader sr =
new
StringReader(Request.Form[hfGridHtml.UniqueID]);
Document pdfDoc =
new
Document(PageSize.A4, 10f, 10f, 10f, 0f);
PdfWriter writer = PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
XMLWorkerHelper.GetInstance().ParseXHtml(writer, pdfDoc, sr);
pdfDoc.Close();
Response.ContentType =
"application/pdf"
;
Response.AddHeader(
"content-disposition"
,
"attachment;filename=HTML.pdf"
);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Write(pdfDoc);
Response.End();
}
and below is my source code
<
div
class
=
"Container"
>
<
div
>
<
table
style
=
"width: 100%"
>
<
tr
>
<
td
style
=
"font-weight: bold;font-size: 12px"
colspan
=
"2"
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"2"
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"font-size: 9px;height: 50px;width:50%"
>
</
td
>
<
td
align
=
"right"
style
=
"font-weight: bold;font-size: 10px"
>
<
div
>
<
span
>
CENTRAL KYC REGISTRY
</
span
>
<
span
>
</
span
>
</
div
>
</
td
>
</
tr
>
</
table
>
<
table
style
=
"width: 100%; border-collapse:collapse"
cellpadding
=
"4"
border
=
"1"
>
<
tr
>
<
td
colspan
=
"3"
style
=
"height: 25px;font-weight: bold;font-size: 12px"
>
<
div
>
1. Personal Details
</
div
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"2"
style
=
"font-size: 10px; height: 3%"
>
<
span
style
=
"font-weight:bold;font-size: 10px"
>
Name*
</
span
>
(Same as ID proof):
<
asp:Label
ID
=
"lbName"
runat
=
"server"
Text
=
""
>
</
asp:Label
>
</
td
>
<
td
rowspan
=
"4"
>
<
img
src
=
""
height
=
"100"
alt
=
""
width
=
"100"
id
=
"imgs"
runat
=
"server"
>
</
img
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"height: 3%;font-size: 10px"
colspan
=
"2"
>
<
div
>
<
span
style
=
"font-weight:bold"
>
Maiden name
</
span
>
(If any)* :
<
asp:Label
ID
=
"lbMaidenName"
runat
=
"server"
Text
=
""
>
</
asp:Label
>
</
div
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"height: 3%;font-size: 10px"
colspan
=
"2"
>
<
div
>
<
span
style
=
"font-weight:bold"
>
Father's/Spouse Name*
</
span
>
:
<
asp:Label
ID
=
"lbFatherName"
runat
=
"server"
Text
=
""
>
</
asp:Label
>
</
div
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"height: 3%;font-size: 10px"
colspan
=
"2"
>
<
div
>
<
span
style
=
"font-weight:bold"
>
Mother name*
</
span
>
:
<
asp:Label
ID
=
"lbMotherName"
runat
=
"server"
Text
=
""
>
</
asp:Label
>
</
div
>
</
td
>
</
tr
>
</
table
>
</
div
>
</
div
>
while exporting it gives me error like this
'Invalid nested tag td found, expected closing tag img' and 'br'
I tried <img src='...'></img>and <br/>
But it gives me same error while exporting,
help me to resolve this issue, Thank you
Reply
Answers (
7
)
Don't Fill Data to dropdown list in angularjs!
What is the difference between .Net Core and .Net Framework?