如何使文本字段被隐藏? [英] How do I make text field to be hidden?
问题描述
我想用不可见的iTextSharp创建一个文本字段.这是我用来创建文本字段的代码:
I'd like to create a text field with iTextSharp that is not visible. Here's code I'm using to create a textfield:
TextField field = new iTextSharp.text.pdf.TextField(writer, new iTextSharp.text.Rectangle(x, y - h, x + w, y), name);
field.BackgroundColor = new BaseColor(bgcolor[0], bgcolor[1], bgcolor[2]);
field.BorderColor = new BaseColor(bordercolor[0], bordercolor[1], bordercolor[2]);
field.BorderWidth = border;
field.BorderStyle = PdfBorderDictionary.STYLE_SOLID;
field.Text = text;
writer.AddAnnotation(field.GetTextField());
推荐答案
In Java, the TextField
class has a method named setVisibility()
inherited from its parent, the BaseField
class. Possible values are:
-
BaseField.VISIBLE
, -
BaseField.HIDDEN
, -
BaseField.VISIBLE_BUT_DOES_NOT_PRINT
和 -
BaseField.HIDDEN_BUT_PRINTABLE
.
在使用iTextSharp时,应查找 SetVisibility()
方法或 Visibility
属性.
As you're using iTextSharp, you should look for a SetVisibility()
method or a Visibility
property.
使用另一个人在回答此问题时建议的渲染模式适用于写入内容流,XObject或外观的内容.您要隐藏一个字段,那是完全不同的.
Using a render mode as suggested by another person in answer to this question applies to content written to a content stream, XObject or appearance. You are asking to hide a field, and that's something completely different.
这篇关于如何使文本字段被隐藏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!