Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Icon

Icon object represents an icon stored at the document level in a PDF file. Icons can be used with button form fields to display custom images. Icons are accessed through the Doc.icons property or created using Doc.addIcon.

example:

// Get an existing icon from the document
var icon = this.getIcon("MyIcon")

// Apply the icon to a button field
var button = this.getField("MyButton")
button.buttonSetIcon(icon)

properties

name

SecureTypeAccess
NostringR

The name of the icon as stored in the PDF document.

example:

// List all icon names in the document
if (this.icons != null) {
    this.icons.forEach(icon => {
        console.println("Icon name: " + icon.name)
    })
}

methods

Icon objects in Revu do not expose any public methods. Icons are managed through the Doc object methods such as addIcon, getIcon, importIcon, and removeIcon.

usage notes

Icons are typically used in conjunction with button form fields to display custom graphics. The workflow generally involves:

  1. Importing an icon into the document using Doc.importIcon()
  2. Retrieving the icon using Doc.getIcon() or accessing it through Doc.icons
  3. Applying the icon to a button field using Field.buttonSetIcon()

example:

// Complete workflow for using icons
// 1. Import an icon (user will be prompted to select an image file)
var result = this.importIcon("CompanyLogo")

if (result == 0) {
    // 2. Get the icon reference
    var logoIcon = this.getIcon("CompanyLogo")
    
    // 3. Apply to a button field
    var logoButton = this.getField("LogoButton")
    if (logoButton) {
        logoButton.buttonSetIcon(logoIcon)
    }
}