Example usage for com.lowagie.text.pdf PushbuttonField setScaleIcon

List of usage examples for com.lowagie.text.pdf PushbuttonField setScaleIcon

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PushbuttonField setScaleIcon.

Prototype

public void setScaleIcon(int scaleIcon) 

Source Link

Document

Sets the way the icon will be scaled.

Usage

From source file:classroom.newspaper_b.Newspaper13.java

public static void addButton(PdfStamper stamper, Rectangle rect, String path, String name, int pagenumber)
        throws IOException, DocumentException {
    PushbuttonField field = new PushbuttonField(stamper.getWriter(), rect, name);
    if (path.endsWith(".pdf")) {
        PdfReader reader = new PdfReader(path);
        field.setTemplate(stamper.getImportedPage(reader, 1));
    } else {/*from www .  ja  v a 2s  . co m*/
        field.setImage(Image.getInstance(path));
    }
    field.setBackgroundColor(new Color(0xFF, 0xFF, 0xFF));
    field.setBorderColor(new Color(0xC0, 0xC0, 0xC0));
    field.setBorderWidth(0.5f);
    field.setScaleIcon(PushbuttonField.SCALE_ICON_ALWAYS);
    field.setLayout(PushbuttonField.LAYOUT_ICON_ONLY);
    stamper.addAnnotation(field.getField(), pagenumber);
}