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

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

Introduction

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

Prototype

int SCALE_ICON_ALWAYS

To view the source code for com.lowagie.text.pdf PushbuttonField SCALE_ICON_ALWAYS.

Click Source Link

Document

An icon scaling option

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   w  w w.ja  v a 2 s.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);
}