Click here to Skip to main content
15,898,371 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
See more:
Hi,

I need to check if a formfield (text field) is multiline or not using itextsharp. Any code samples?

All I know is that I need to use PdfFormField.FF_MULTILINE but I don't know how to use that.

I am new to itextsharp so any working code samples will be more helpful.

Its not the textbox but the formfield. I have the following code:

C#
iTextSharp.text.pdf.PdfDictionary dic = new PdfDictionary();
dic = (iTextSharp.text.pdf.PdfDictionary)form.GetFieldItem(key).GetMerged(0);
//Check if textbox is multiline. If yes then do not truncate.
if (!(dic.GetAsNumber(iTextSharp.text.pdf.PdfName.FF) != null && dic.GetAsNumber(iTextSharp.text.pdf.PdfName.FF).IntValue == iTextSharp.text.pdf.PdfFormField.FF_MULTILINE))
{
 //some code
}


The above code is not working. Could someone point out the mistake?
Posted
Updated 13-Aug-13 20:32pm
v2
Comments
Maciej Los 14-Aug-13 3:37am    
I'm not sure what you want to achieve... ;(
Please, be more specific and provide more details.
Do you want to get text from formfield?

1 solution

TextBox.TextMode Property
Gets or sets the behavior mode (single-line, multiline, or password) of the TextBox control.

C#:
C#
[ThemeableAttribute(false)]
public virtual TextBoxMode TextMode { get; set; }


ASP.NET
CSS
<asp:textbox textmode="TextBoxMode" xmlns:asp="#unknown" />


So :
TextBox txt = new TextBox();
... = txt.TextMode;

When the TextBox control is in multiline mode, you can control the number of rows displayed by setting the Rows property. You can also specify whether the text should wrap by setting the Wrap property.....

Regards,
Alex.
 
Share this answer
 
Comments
Zoltán Zörgő 13-Aug-13 17:10pm    
I doubt that pdf form field has anything to do with .net controls.

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