Skip to main content

RFID Printing

This guide explains how to print labels and simultaneously encode RFID inlays using the AD Device Manager SDK.

Supported Devices

RFID print-and-encode is supported on:

DeviceSDK typeRFID hardware required
PF EdgeNG/TSCYes — must be present on unit
PF6059CDILYes — must be present on unit

Not all units include RFID hardware. Always check for capability at runtime before attempting any RFID operation.

Checking for RFID Support

The SDK uses a capability pattern. Use hasCapability() and isRFIDEnabled() before calling any RFID method:

import com.averydennison.addevicemanager.capabilities.RfidCapability;

PrinterAdapter printerAdapter = deviceAdapter.getPrinterAdapter();

if (printerAdapter.hasCapability(RfidCapability.class)
&& ((RfidCapability) printerAdapter).isRFIDEnabled()) {
RfidCapability rfid = (RfidCapability) printerAdapter;
// Safe to call RFID methods
} else {
logger.warn("This device does not support RFID.");
}

Use printAndEncodeRfid() to print a label template and write data to the RFID inlay in a single operation.

Method Signature

CompletableFuture<Void> printAndEncodeRfid(
String templateName, // Template resource name
String variableData, // Template variables: "KEY1=VALUE1;KEY2=VALUE2"
int qty, // Number of labels to print (0 defaults to 1)
String epcData, // EPC memory bank data as hex string (null to skip)
String userMemory, // User memory bank data as hex string (null to skip)
String accessPwd, // Access password as hex string (null to skip)
String killPwd, // Kill password as hex string (null to skip)
String lockCode // Lock code for EPC write ("0" for no lock)
);

Device-specific Template Notes

DeviceTemplate extensionTemplate location
PF Edge.ngtLoaded in app memory via resource management
PF6059.lntRegistered on the printer via resource management

Example: Print and Encode with EPC

PrinterAdapter printerAdapter = deviceAdapter.getPrinterAdapter();

if (printerAdapter.hasCapability(RfidCapability.class)
&& ((RfidCapability) printerAdapter).isRFIDEnabled()) {
RfidCapability rfid = (RfidCapability) printerAdapter;

String template = "RFIDLabel.ngt"; // Use ".lnt" for PF6059
String variableData = "VAR1=00614141000015";
String epcData = "3034257BF40A800000000001"; // 96-bit SGTIN-96 hex
String lockCode = "0"; // No lock

rfid.printAndEncodeRfid(template, variableData, 1, epcData, null, null, null, lockCode)
.thenRun(() -> logger.info("RFID label printed and encoded successfully."))
.exceptionally(e -> {
logger.error("RFID print+encode failed: " + e.getMessage());
return null;
});
}

Parameters Reference

ParameterDescriptionExample
templateNameName of the template resource registered on the device"RFIDLabel.ngt" / "RFIDLabel.lnt"
variableDataSemicolon-separated key=value pairs for template placeholders"VAR1=123456789012"
qtyNumber of labels to print. Pass 0 to default to 11
epcDataEPC memory bank content as a hexadecimal string. null to skip"3034257BF40A800000000001"
userMemoryUser memory bank content as a hex string. null to skipnull
accessPwd32-bit access password as hex. null to skipnull
killPwd32-bit kill password as hex. null to skipnull
lockCodeLock code applied after EPC write. Use "0" for no lock"0"

Generating an EPC from an EAN-13

A common use case is encoding a GS1 SGTIN-96 EPC derived from an EAN-13 barcode. The Quick Start application includes a utility method for this:

// ean13: 12 or 13 digit EAN-13 string
// serialNumber: a unique counter incremented per label printed
String epc = Utils.ean13ToEpcSgtin96("4006381333931", serialCounter);
// Returns a 24-character uppercase hex string, e.g. "3034257BF40A800000000001"
// Returns null if the EAN-13 is invalid

The encoding follows GS1 EPC TDS SGTIN-96 with the following bit layout:

FieldBitsValue
Header80x30 (SGTIN-96)
Filter31 (retail consumer item)
Partition35 (7-digit company prefix + 5-digit item ref)
Company Prefix24First 7 digits of EAN-13
Item Reference20Digits 8–12 of EAN-13
Serial38Unique serial counter (up to 274 billion)

Note: Partition 5 (7+5 digit split) is the most common for standard European EAN-13. If your company prefix has a different length, the partition value and bit widths must be adjusted accordingly.

RFID Power Configuration

You can read and adjust the antenna power levels for both read and write operations.

Power Ranges

DeviceRead power rangeWrite power range
PF Edge1 to 271 to 27
PF6059-15 to 23-15 to 23

Reading Current Power Levels

RfidCapability rfid = (RfidCapability) printerAdapter;

rfid.getReadRfidPower()
.thenAccept(power -> logger.info("Current read power: " + power))
.exceptionally(e -> { logger.error("Failed: " + e.getMessage()); return null; });

rfid.getWriteRfidPower()
.thenAccept(power -> logger.info("Current write power: " + power))
.exceptionally(e -> { logger.error("Failed: " + e.getMessage()); return null; });

Setting Power Levels

// PF Edge: valid range 1–27. PF6059: valid range -15 to 23.
rfid.setReadRfidPower(10)
.thenRun(() -> logger.info("Read power set."))
.exceptionally(e -> { logger.error("Failed: " + e.getMessage()); return null; });

rfid.setWriteRfidPower(10)
.thenRun(() -> logger.info("Write power set."))
.exceptionally(e -> { logger.error("Failed: " + e.getMessage()); return null; });

Note (PF Edge): The TSC SDK's RFID POWER command requires both read and write values simultaneously. When you call setReadRfidPower(), the SDK automatically fetches the current write power to keep it unchanged, and vice versa.

RFID Calibration

Calibration should be performed when installing new RFID media or after changing the roll position.

DeviceWhat calibrateRFID() does
PF EdgeSends a single RFID calibration command to the printer
PF6059Runs a standard media calibration first, then auto-calibrates the RFID antenna power
RfidCapability rfid = (RfidCapability) printerAdapter;

rfid.calibrateRFID()
.thenRun(() -> logger.info("RFID calibration complete."))
.exceptionally(e -> {
logger.error("RFID calibration failed: " + e.getMessage());
return null;
});

Important: Always run calibrateRFID() after loading a new roll of RFID media to ensure reliable tag encoding.

Error Handling

RFID operations return a CompletableFuture. Common failure scenarios:

ScenarioException message
Device has no RFID hardware"This device does not have RFID hardware."
Template not found (PF Edge)"Template '<name>' not found in memory."
EPC encoding fails"RFID print operation failed"
Operation times out (PF6059)"RFID print operation timed out"
Invalid EAN-13 passed to EPC helperMethod returns null — check before passing to SDK
rfid.printAndEncodeRfid(template, data, 1, epc, null, null, null, "0")
.exceptionally(e -> {
Throwable cause = e.getCause() != null ? e.getCause() : e;
if (cause instanceof UnsupportedOperationException) {
logger.error("RFID not supported on this device.");
} else {
logger.error("RFID operation failed: " + cause.getMessage());
}
return null;
});

Next Steps