| |
|
| java.lang.Object com.lowagie.text.pdf.BaseField com.lowagie.text.pdf.PushbuttonField
PushbuttonField | public class PushbuttonField extends BaseField (Code) | | 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 (psoares@consiste.pt) |
Constructor Summary | |
public | PushbuttonField(PdfWriter writer, Rectangle box, String fieldName) Creates a new instance of PushbuttonField
Parameters: writer - the document PdfWriter Parameters: box - the field location and dimensions Parameters: fieldName - the field name. |
LAYOUT_ICON_LEFT_LABEL_RIGHT | final public static int LAYOUT_ICON_LEFT_LABEL_RIGHT(Code) | | A layout option
|
LAYOUT_ICON_ONLY | final public static int LAYOUT_ICON_ONLY(Code) | | A layout option
|
LAYOUT_ICON_TOP_LABEL_BOTTOM | final public static int LAYOUT_ICON_TOP_LABEL_BOTTOM(Code) | | A layout option
|
LAYOUT_LABEL_LEFT_ICON_RIGHT | final public static int LAYOUT_LABEL_LEFT_ICON_RIGHT(Code) | | A layout option
|
LAYOUT_LABEL_ONLY | final public static int LAYOUT_LABEL_ONLY(Code) | | A layout option
|
LAYOUT_LABEL_OVER_ICON | final public static int LAYOUT_LABEL_OVER_ICON(Code) | | A layout option
|
LAYOUT_LABEL_TOP_ICON_BOTTOM | final public static int LAYOUT_LABEL_TOP_ICON_BOTTOM(Code) | | A layout option
|
SCALE_ICON_ALWAYS | final public static int SCALE_ICON_ALWAYS(Code) | | An icon scaling option
|
SCALE_ICON_IS_TOO_BIG | final public static int SCALE_ICON_IS_TOO_BIG(Code) | | An icon scaling option
|
SCALE_ICON_IS_TOO_SMALL | final public static int SCALE_ICON_IS_TOO_SMALL(Code) | | An icon scaling option
|
SCALE_ICON_NEVER | final public static int SCALE_ICON_NEVER(Code) | | An icon scaling option
|
PushbuttonField | public PushbuttonField(PdfWriter writer, Rectangle box, String fieldName)(Code) | | Creates a new instance of PushbuttonField
Parameters: writer - the document PdfWriter Parameters: box - the field location and dimensions Parameters: fieldName - the field name. If null only the widget keyswill be included in the field allowing it to be used as a kid field. |
getIconHorizontalAdjustment | public float getIconHorizontalAdjustment()(Code) | | Getter for property iconHorizontalAdjustment.
Value of property iconHorizontalAdjustment. |
getIconReference | public PRIndirectReference getIconReference()(Code) | | Gets the reference to an existing icon.
the reference to an existing icon. |
getIconVerticalAdjustment | public float getIconVerticalAdjustment()(Code) | | Getter for property iconVerticalAdjustment.
Value of property iconVerticalAdjustment. |
getImage | public Image getImage()(Code) | | Getter for property image.
Value of property image. |
getLayout | public int getLayout()(Code) | | Getter for property layout.
Value of property layout. |
getScaleIcon | public int getScaleIcon()(Code) | | Getter for property scaleIcon.
Value of property scaleIcon. |
getTemplate | public PdfTemplate getTemplate()(Code) | | Getter for property template.
Value of property template. |
isIconFitToBounds | public boolean isIconFitToBounds()(Code) | | Getter for property iconFitToBounds.
Value of property iconFitToBounds. |
isProportionalIcon | public boolean isProportionalIcon()(Code) | | Getter for property proportionalIcon.
Value of property proportionalIcon. |
setIconFitToBounds | public void setIconFitToBounds(boolean iconFitToBounds)(Code) | | 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: iconFitToBounds - 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 |
setIconHorizontalAdjustment | public void setIconHorizontalAdjustment(float iconHorizontalAdjustment)(Code) | | 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: iconHorizontalAdjustment - a number between 0 and 1 indicating the fraction of leftover space to allocate at the left of the icon |
setIconReference | public void setIconReference(PRIndirectReference iconReference)(Code) | | Sets the reference to an existing icon.
Parameters: iconReference - the reference to an existing icon |
setIconVerticalAdjustment | public void setIconVerticalAdjustment(float iconVerticalAdjustment)(Code) | | 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: iconVerticalAdjustment - a number between 0 and 1 indicating the fraction of leftover space to allocate at the bottom of the icon |
setImage | public void setImage(Image image)(Code) | | Sets the icon as an image.
Parameters: image - the image |
setLayout | public void setLayout(int layout)(Code) | | 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: layout - New value of property layout. |
setProportionalIcon | public void setProportionalIcon(boolean proportionalIcon)(Code) | | Sets the way the icon is scaled. If true the icon is scaled proportionally,
if false the scaling is done anamorphicaly.
Parameters: proportionalIcon - the way the icon is scaled |
setScaleIcon | public void setScaleIcon(int scaleIcon)(Code) | | 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: scaleIcon - the way the icon will be scaled |
setTemplate | public void setTemplate(PdfTemplate template)(Code) | | Sets the icon as a template.
Parameters: template - the template |
|
|
|