Skip to main content
Speed up Smart Label Capture integration with Agent Skills

Install the Scandit plugin and use the /label-capture-web skill so that your AI coding agent can integrate, debug, and customize Smart Label Capture on Web following Scandit's recommended patterns. More info →

Run the following command in your project directory. It detects the supported coding agents you have installed and adds the Scandit plugin to each. Re-run it to update.

npx plugins add scandit/skills

Prefer to set it up yourself? Manual installation steps for each agent →

Scan shipping labels

Shipping Label Scanning reads a shipping label and returns its tracking ID, the receiver's name and address, and the carrier. Like receipt scanning, it uses the Adaptive Recognition Engine, which processes the label in the cloud.

To read your own set of fields on the device instead, define a custom label.

Beta

Shipping Label Scanning requires the Adaptive Recognition Engine, which is still in beta and may change in future versions of Scandit Data Capture SDK. To enable it on your subscription, contact support@scandit.com.

Before you start​

  • Use Scandit Data Capture SDK 8.6.0 or later. Shipping Label Scanning is available on iOS, Android, and Web. It isn't available on other frameworks yet.
  • Ask support@scandit.com to enable the Adaptive Recognition Engine on your subscription.
  • Make sure the device has a network connection. The Adaptive Recognition Engine processes the label in the cloud.
  • Set up a LabelCapture instance and a DataCaptureView. If you haven't done this yet, follow Get started.

Create the LabelCapture instance with LabelCaptureSettings that have no label definitions. The overlay adds its own definition for the tracking barcode. Label definitions that you add stay active alongside it, so a barcode that isn't the tracking barcode can end up as the trackingId.

import { LabelCapture, LabelCaptureSettings } from "@scandit/web-datacapture-label";

const labelCaptureSettings = await LabelCaptureSettings.fromLabelDefinitions([]);
const labelCapture = await LabelCapture.forContext(dataCaptureContext, labelCaptureSettings);

Steps​

1. Create the settings​

Create LabelCaptureAdaptiveRecognitionSettings with the result type AdaptiveRecognitionResultType.ShippingLabel. The result type sets the kind of document that the overlay looks for.

create() is asynchronous. If you call it without a result type, it creates settings for receipts.

To change the hint that the overlay shows while it processes a label, use setProcessingHintText(text).

import {
AdaptiveRecognitionResultType,
LabelCaptureAdaptiveRecognitionOverlay,
LabelCaptureAdaptiveRecognitionSettings,
ShippingLabelScanningResult,
type AdaptiveRecognitionResult,
} from "@scandit/web-datacapture-label";

const settings = await LabelCaptureAdaptiveRecognitionSettings.create(
AdaptiveRecognitionResultType.ShippingLabel
);

2. Create the overlay​

Create the overlay with LabelCaptureAdaptiveRecognitionOverlay.withLabelCaptureForView(labelCapture, view). Then apply the settings with applySettings(settings).

When you pass your DataCaptureView, the overlay adds itself to the view. If you leave out the view, add the overlay yourself with DataCaptureView.addOverlay().

const overlay = await LabelCaptureAdaptiveRecognitionOverlay.withLabelCaptureForView(
labelCapture,
dataCaptureView
);
await overlay.applySettings(settings);

3. Listen for results​

Set a LabelCaptureAdaptiveRecognitionListener as the overlay's listener. It receives two callbacks:

overlay.listener = {
onRecognized: (result: AdaptiveRecognitionResult) => {
if (!(result instanceof ShippingLabelScanningResult)) {
return;
}

const trackingId = result.trackingId;
const receiverName = result.receiverFullName;
const receiverCompany = result.receiverCompany; // null if the label doesn't show one
const carrier = result.carrier;
},
onFailure: () => {
// Recognition failed, for example because of a connection error.
},
};

4. Switch the camera back on​

When the overlay starts to process a label, it switches the camera to standby. It doesn't switch the camera back on after a result. To scan the next label, call the camera's switchToDesiredState(FrameSourceState.On) in onRecognized(result) after you handle the result.

If recognition fails, the overlay shows an error notification and switches the camera back on.

FrameSourceState is in @scandit/web-datacapture-core.

onRecognized: async (result: AdaptiveRecognitionResult) => {
// Handle the result, then get ready for the next label.
await camera.switchToDesiredState(FrameSourceState.On);
},

Shipping label fields​

ShippingLabelScanningResult has the following fields:

FieldTypeDescription
trackingIdstringThe tracking identifier, read from the tracking barcode on the label.
receiverFullNamestringThe receiver's full name.
receiverCompanystring | nullThe receiver's company. null if the label doesn't show one.
receiverStreetstringThe street of the receiver's address.
receiverCitystringThe city of the receiver's address.
receiverStatestring | nullThe state of the receiver's address. null if the label doesn't show one.
receiverPostalCodestringThe postal code of the receiver's address.
receiverCountrystring | nullThe country of the receiver's address. null if the label doesn't show one.
carrierCarrierThe postal provider of the label. See Carriers.

resultType is always AdaptiveRecognitionResultType.ShippingLabel for this result.

Handle missing values​

Carriers​

Carrier has the following values. The SDK maps the carrier that the engine identifies on the label to one of these values. The list can grow in future SDK versions.

CarrierValue
FedExCarrier.Fedex
United Parcel Service (UPS)Carrier.Ups
United States Postal Service (USPS)Carrier.Usps
DHLCarrier.Dhl
DPDCarrier.Dpd
GLSCarrier.Gls
TNTCarrier.Tnt
Amazon LogisticsCarrier.AmazonLogistics
OnTracCarrier.Ontrac
Royal MailCarrier.RoyalMail
ParcelforceCarrier.Parcelforce
EvriCarrier.Evri
YodelCarrier.Yodel
ChronopostCarrier.Chronopost
ColissimoCarrier.Colissimo
Mondial RelayCarrier.MondialRelay
Poste ItalianeCarrier.PosteItaliane
BRTCarrier.Brt
SDACarrier.Sda
HermesCarrier.Hermes
Austrian PostCarrier.AustrianPost
Swiss PostCarrier.SwissPost
PostNLCarrier.Postnl
bpostCarrier.Bpost
PostNordCarrier.Postnord
CorreosCarrier.Correos
SEURCarrier.Seur
InPostCarrier.Inpost
Classified by the engine as otherCarrier.Other
Not identified, or not in this listCarrier.NotAvailable

Verify it works​

You're done when:

  • The overlay shows its processing hint after you point the camera at a shipping label.
  • Your onRecognized(result) callback receives a ShippingLabelScanningResult, and you can read its trackingId and carrier.
  • Your onRecognized(result) code switches the camera back on after each result, so you can scan the next label.

Processing starts only after the SDK decodes a tracking barcode on the label. The tracking barcode must be Code 128, Code 39, ITF, Data Matrix, or PDF417. Processing also requires a license key that includes Adaptive Recognition. If the overlay never shows its processing hint, check that the label has one of these barcodes and that your license key includes Adaptive Recognition.

If onFailure() runs instead, recognition failed, for example because of a network problem or a label the engine can't read. Check the network connection, then scan the label again.