HiraokaHyperTools.iTextSharp-LGPL  0.2.5
iTextSharp.text.pdf.PushbuttonField Class Reference
Inheritance diagram for iTextSharp.text.pdf.PushbuttonField:
iTextSharp.text.pdf.BaseField

Public Member Functions

 PushbuttonField (PdfWriter writer, Rectangle box, String fieldName)
 
PdfAppearance GetAppearance ()
 
- Public Member Functions inherited from iTextSharp.text.pdf.BaseField
 BaseField (PdfWriter writer, Rectangle box, String fieldName)
 
void SetRotationFromPage (Rectangle page)
 

Static Public Attributes

const int LAYOUT_LABEL_ONLY = 1
 
const int LAYOUT_ICON_ONLY = 2
 
const int LAYOUT_ICON_TOP_LABEL_BOTTOM = 3
 
const int LAYOUT_LABEL_TOP_ICON_BOTTOM = 4
 
const int LAYOUT_ICON_LEFT_LABEL_RIGHT = 5
 
const int LAYOUT_LABEL_LEFT_ICON_RIGHT = 6
 
const int LAYOUT_LABEL_OVER_ICON = 7
 
const int SCALE_ICON_ALWAYS = 1
 
const int SCALE_ICON_NEVER = 2
 
const int SCALE_ICON_IS_TOO_BIG = 3
 
const int SCALE_ICON_IS_TOO_SMALL = 4
 
- Static Public Attributes inherited from iTextSharp.text.pdf.BaseField
const float BORDER_WIDTH_THIN = 1
 
const float BORDER_WIDTH_MEDIUM = 2
 
const float BORDER_WIDTH_THICK = 3
 
const int VISIBLE = 0
 
const int HIDDEN = 1
 
const int VISIBLE_BUT_DOES_NOT_PRINT = 2
 
const int HIDDEN_BUT_PRINTABLE = 3
 
const int READ_ONLY = PdfFormField.FF_READ_ONLY
 
const int REQUIRED = PdfFormField.FF_REQUIRED
 
const int MULTILINE = PdfFormField.FF_MULTILINE
 
const int DO_NOT_SCROLL = PdfFormField.FF_DONOTSCROLL
 
const int PASSWORD = PdfFormField.FF_PASSWORD
 
const int FILE_SELECTION = PdfFormField.FF_FILESELECT
 
const int DO_NOT_SPELL_CHECK = PdfFormField.FF_DONOTSPELLCHECK
 
const int EDIT = PdfFormField.FF_EDIT
 
const int COMB = PdfFormField.FF_COMB
 

Properties

int Layout [get, set]
 
Image Image [get, set]
 
PdfTemplate Template [get, set]
 
int ScaleIcon [get, set]
 
bool ProportionalIcon [get, set]
 
float IconVerticalAdjustment [get, set]
 
float IconHorizontalAdjustment [get, set]
 
PdfFormFieldField [get]
 
bool IconFitToBounds [get, set]
 
PRIndirectReference IconReference [get, set]
 
- Properties inherited from iTextSharp.text.pdf.BaseField
BaseFont RealFont [get]
 
float BorderWidth [get, set]
 
int BorderStyle [get, set]
 
Color BorderColor [get, set]
 
Color BackgroundColor [get, set]
 
Color TextColor [get, set]
 
BaseFont Font [get, set]
 
float FontSize [get, set]
 
int Alignment [get, set]
 
string Text [get, set]
 
Rectangle Box [get, set]
 
int Rotation [get, set]
 
int Visibility [get, set]
 
string FieldName [get, set]
 
int Options [get, set]
 
int MaxCharacterLength [get, set]
 
PdfWriter Writer [get, set]
 

Additional Inherited Members

- Static Public Member Functions inherited from iTextSharp.text.pdf.BaseField
static void MoveFields (PdfDictionary from, PdfDictionary to)
 
- Protected Member Functions inherited from iTextSharp.text.pdf.BaseField
PdfAppearance GetBorderAppearance ()
 
- Static Protected Member Functions inherited from iTextSharp.text.pdf.BaseField
static ArrayList GetHardBreaks (String text)
 
static void TrimRight (StringBuilder buf)
 
static ArrayList BreakLines (ArrayList breaks, BaseFont font, float fontSize, float width)
 
- Protected Attributes inherited from iTextSharp.text.pdf.BaseField
float borderWidth = BORDER_WIDTH_THIN
 
int borderStyle = PdfBorderDictionary.STYLE_SOLID
 
Color borderColor
 
Color backgroundColor
 
Color textColor
 
BaseFont font
 
float fontSize = 0
 
int alignment = Element.ALIGN_LEFT
 
PdfWriter writer
 
String text
 
Rectangle box
 
int rotation = 0
 
int visibility
 
String fieldName
 
int options
 
int maxCharacterLength
 

Detailed Description

Creates a pushbutton field. It supports all the text and icon alignments. The icon may be an image or a template.

Example usage:

Document document = new Document(PageSize.A4, 50, 50, 50, 50);
PdfWriter writer = PdfWriter.GetInstance(document, new FileOutputStream("output.pdf"));
document.Open();
PdfContentByte cb = writer.GetDirectContent();
Image img = Image.GetInstance("image.png");
PushbuttonField bt = new PushbuttonField(writer, new Rectangle(100, 100, 200, 200), "Button1");
bt.SetText("My Caption");
bt.SetFontSize(0);
bt.SetImage(img);
bt.SetLayout(PushbuttonField.LAYOUT_ICON_TOP_LABEL_BOTTOM);
bt.SetBackgroundColor(Color.cyan);
bt.SetBorderStyle(PdfBorderDictionary.STYLE_SOLID);
bt.SetBorderColor(Color.red);
bt.SetBorderWidth(3);
PdfFormField ff = bt.GetField();
PdfAction ac = PdfAction.CreateSubmitForm("http://www.submit-site.com", null, 0);
ff.SetAction(ac);
writer.AddAnnotation(ff);
document.Close();
Author
Paulo Soares (psoar.nosp@m.es@c.nosp@m.onsis.nosp@m.te.p.nosp@m.t)

Constructor & Destructor Documentation

◆ PushbuttonField()

iTextSharp.text.pdf.PushbuttonField.PushbuttonField ( PdfWriter  writer,
Rectangle  box,
String  fieldName 
)

Creates a new instance of PushbuttonField

Parameters
writerthe document PdfWriter
boxthe field location and dimensions
fieldNamethe field name. If null only the widget keys will be included in the field allowing it to be used as a kid field.

Member Function Documentation

◆ GetAppearance()

PdfAppearance iTextSharp.text.pdf.PushbuttonField.GetAppearance ( )

Gets the button appearance.

Exceptions
IOExceptionon error
DocumentExceptionon error
Returns
the button appearance

Member Data Documentation

◆ LAYOUT_ICON_LEFT_LABEL_RIGHT

const int iTextSharp.text.pdf.PushbuttonField.LAYOUT_ICON_LEFT_LABEL_RIGHT = 5
static

A layout option

◆ LAYOUT_ICON_ONLY

const int iTextSharp.text.pdf.PushbuttonField.LAYOUT_ICON_ONLY = 2
static

A layout option

◆ LAYOUT_ICON_TOP_LABEL_BOTTOM

const int iTextSharp.text.pdf.PushbuttonField.LAYOUT_ICON_TOP_LABEL_BOTTOM = 3
static

A layout option

◆ LAYOUT_LABEL_LEFT_ICON_RIGHT

const int iTextSharp.text.pdf.PushbuttonField.LAYOUT_LABEL_LEFT_ICON_RIGHT = 6
static

A layout option

◆ LAYOUT_LABEL_ONLY

const int iTextSharp.text.pdf.PushbuttonField.LAYOUT_LABEL_ONLY = 1
static

A layout option

◆ LAYOUT_LABEL_OVER_ICON

const int iTextSharp.text.pdf.PushbuttonField.LAYOUT_LABEL_OVER_ICON = 7
static

A layout option

◆ LAYOUT_LABEL_TOP_ICON_BOTTOM

const int iTextSharp.text.pdf.PushbuttonField.LAYOUT_LABEL_TOP_ICON_BOTTOM = 4
static

A layout option

◆ SCALE_ICON_ALWAYS

const int iTextSharp.text.pdf.PushbuttonField.SCALE_ICON_ALWAYS = 1
static

An icon scaling option

◆ SCALE_ICON_IS_TOO_BIG

const int iTextSharp.text.pdf.PushbuttonField.SCALE_ICON_IS_TOO_BIG = 3
static

An icon scaling option

◆ SCALE_ICON_IS_TOO_SMALL

const int iTextSharp.text.pdf.PushbuttonField.SCALE_ICON_IS_TOO_SMALL = 4
static

An icon scaling option

◆ SCALE_ICON_NEVER

const int iTextSharp.text.pdf.PushbuttonField.SCALE_ICON_NEVER = 2
static

An icon scaling option

Property Documentation

◆ Field

PdfFormField? iTextSharp.text.pdf.PushbuttonField.Field
get

Gets the pushbutton field.

Exceptions
IOExceptionon error
DocumentExceptionon error
Returns
the pushbutton field

◆ IconFitToBounds

bool iTextSharp.text.pdf.PushbuttonField.IconFitToBounds
getset

If true the icon will be scaled to fit fully within the bounds of the annotation, if false the border width will be taken into account. The default is false.

Parameters
iconFitToBoundsif true the icon will be scaled to fit fully within the bounds of the annotation, if false the border width will be taken into account

◆ IconHorizontalAdjustment

float iTextSharp.text.pdf.PushbuttonField.IconHorizontalAdjustment
getset

A number between 0 and 1 indicating the fraction of leftover space to allocate at the left of the icon. A value of 0 positions the icon at the left of the annotation rectangle. A value of 0.5 centers it within the rectangle. The default is 0.5.

Parameters
iconHorizontalAdjustmenta number between 0 and 1 indicating the fraction of leftover space to allocate at the left of the icon

◆ IconReference

PRIndirectReference iTextSharp.text.pdf.PushbuttonField.IconReference
getset

Sets the reference to an existing icon.

Parameters
iconReferencethe reference to an existing icon

◆ IconVerticalAdjustment

float iTextSharp.text.pdf.PushbuttonField.IconVerticalAdjustment
getset

A number between 0 and 1 indicating the fraction of leftover space to allocate at the bottom of the icon. A value of 0 positions the icon at the bottom of the annotation rectangle. A value of 0.5 centers it within the rectangle. The default is 0.5.

Parameters
iconVerticalAdjustmenta number between 0 and 1 indicating the fraction of leftover space to allocate at the bottom of the icon

◆ Image

Image iTextSharp.text.pdf.PushbuttonField.Image
getset

Sets the icon as an image.

Parameters
imagethe image

◆ Layout

int iTextSharp.text.pdf.PushbuttonField.Layout
getset

Sets the icon and label layout. Possible values are LAYOUT_LABEL_ONLY, LAYOUT_ICON_ONLY, LAYOUT_ICON_TOP_LABEL_BOTTOM, LAYOUT_LABEL_TOP_ICON_BOTTOM, LAYOUT_ICON_LEFT_LABEL_RIGHT, LAYOUT_LABEL_LEFT_ICON_RIGHT and LAYOUT_LABEL_OVER_ICON. The default is LAYOUT_LABEL_ONLY.

Parameters
layoutNew value of property layout.

◆ ProportionalIcon

bool iTextSharp.text.pdf.PushbuttonField.ProportionalIcon
getset

Sets the way the icon is scaled. If true the icon is scaled proportionally, if false the scaling is done anamorphicaly.

Parameters
proportionalIconthe way the icon is scaled

◆ ScaleIcon

int iTextSharp.text.pdf.PushbuttonField.ScaleIcon
getset

Sets the way the icon will be scaled. Possible values are SCALE_ICON_ALWAYS, SCALE_ICON_NEVER, SCALE_ICON_IS_TOO_BIG and SCALE_ICON_IS_TOO_SMALL. The default is SCALE_ICON_ALWAYS.

Parameters
scaleIconthe way the icon will be scaled

◆ Template

PdfTemplate iTextSharp.text.pdf.PushbuttonField.Template
getset

Sets the icon as a template.

Parameters
templatethe template

The documentation for this class was generated from the following file: