Click here to Skip to main content
11,479,096 members (57,114 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C#
Hi all,
I am unable to display 'Text Box' in pdf while converting html string to pdf using HTMLWorker(iTextSharp.dll)


Document pdfDoc = new Document();
iTextSharp.text.html.simpleparser.HTMLWorker hw = new
string sttt = "<input type='text' name='firstname' value='Hello/>";
hw.Parse(new StringReader(sttt ));
Posted 18-Sep-13 19:58pm
Edited 22-Sep-13 6:23am
Sergey Alexandrovich Kryukov at 19-Sep-13 1:03am
Not informative. What does it mean, "I'm unable"? And how it is, "display Text Box"? What it should be? PDF is not HTML...
Ramanjaneya002 at 19-Sep-13 1:10am
Hello, do u have any solution for this problem?
Ramanjaneya002 at 19-Sep-13 1:05am
Just I need to display text box in my pdf
Rohan Leuva at 19-Sep-13 1:06am
Use reply button while making comment.
Ramanjaneya002 at 19-Sep-13 1:08am
Ya fine, is there any specific reason behind it?
Sergey Alexandrovich Kryukov at 19-Sep-13 1:56am
Yes, very important one. If you comment by "Reply", the person you reply to gets a notification. Otherwise your comment may remain unattended.
Ramanjaneya002 at 19-Sep-13 1:14am
Do you know the solution for above problem?
Rohan Leuva at 19-Sep-13 1:15am
Specific reason is that i will get notification regarding your comment if you did it using reply button. Don't use words that cant be understood by everyone.
Ramanjaneya002 at 19-Sep-13 1:17am
Finally do the answer or not ?
Rohan Leuva at 19-Sep-13 1:19am
Don't you follow the comment by Sergey above? How do any one know the solution if you won't provide concrete info? He has asked you some thing.
Ramanjaneya002 at 19-Sep-13 1:21am
Hey dude,
He was commented before my question update,
If you don't know the answer just leave it and do your work
Sergey Alexandrovich Kryukov at 19-Sep-13 1:53am
This is very, very rude. Here, we support free exchange of opinion and knowledge. How can you say anyone "leave it and do your work"? Nobody ever tell you to stop your questions, even is somebody does not like them...

This member knows better who he should do and what not. And he was trying to help you. Who do you think will want to help you if you talk to people this way?

Ramanjaneya002 at 19-Sep-13 3:05am
I am asking regarding my problem but no one here is trying to talk about this,
then how can I react?
ThePhantomUpvoter at 19-Sep-13 6:38am
With some manners.
Ramanjaneya002 at 19-Sep-13 7:17am
Fine thank you for suggestion could you please provide solution.
Ramanjaneya002 at 19-Sep-13 3:07am
I agree with you guys but discussing unwanted stuff is also not correct just think of it!
Sergey Alexandrovich Kryukov at 19-Sep-13 11:00am
No one told you anything rude, like "leave it and do your work". Who is talking unwanted stuff? Unwanted by who? :-)
Ramanjaneya002 at 20-Sep-13 1:04am
Any way still I didn't get an answer
Ramanjaneya002 at 20-Sep-13 1:30am
k yar I don't want to argue with you because you are senior than me
Finally if you know the answer post it Thank you in advance
Ramanjaneya002 at 19-Sep-13 1:06am
I am able to display total Html string in pdf but not Textbox
Member 11473491 at 26-Apr-15 11:40am
textbox ,radiobutton,checkbox is not display and it gives an error input string was not in correct format.(please give solution anybody)

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If you want to add a text box to your PDF file, then have a look here:[^]


I found the reason why it is not working: your HTML code is not well-formed, because the value attribute is not closed: there's an apostrophe missing.
Try this:
string sttt = "<input type='text' name='firstname' value='Hello'/>";
Ram424 at 23-Sep-13 0:44am
That's fine ProgramFOX, and thank you first of all,

Here the problem is, I want to add text box through html code. Because I am converting html code to pdf using HTMLParser.

Here I am able to parse total my html code into pdf except this text box so.....
ProgramFOX at 23-Sep-13 12:32pm
I'm sorry, but I'm afraid there's a way to create the text box from the input tag, because I find nothing about it in Google. I only found the way as described in the link. Again, I'm sorry.
What you can try: use a HTML parser such as the HtmlAgilityPack, and parse some input tags from the HTML, and make sure that they're added as described in the link.
Ram424 at 25-Sep-13 0:30am
Hi ProgramFOX,
Actually I used HTMLWorker which belongs to iTextSharp.dll.
It's open source dll to convert any page into pdf format. Using this dll I am unable to add textbox to pdf.(Me to also searched lot of sites in Google to solve this issue.)
Ram424 at 25-Sep-13 4:18am
Hello Program FOX,
I think it's not correct ask you in this way
Please go through below link
ProgramFOX at 25-Sep-13 11:44am
I don't really understand the question.
Ram424 at 26-Sep-13 0:14am
Hi FOX good morning,
See the question once, there is some discussion happened with some other person,
if possible go through it otherwise just leave it.
Thank you
ProgramFOX at 26-Sep-13 11:20am
Now I know the answer: your HTML is not well-formed! The value attribute is not closed!
Try this:
string sttt = "<input type='text' name='firstname' value='Hello'/>";
Ram424 at 27-Sep-13 0:26am
that's fine and thank you.
Have you tried this one or not, In my real time there is no such mistakes are placed.
If you want to try this one please download itextsharp.dll and do it.

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 215
1 F-ES Sitecore 195
2 OriginalGriff 165
3 Frankie-C 120
4 DamithSL 95
0 Sergey Alexandrovich Kryukov 7,890
1 OriginalGriff 7,366
2 Sascha Lefèvre 3,064
3 Maciej Los 2,491
4 Richard Deeming 2,335

Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 26 Sep 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100