CameraScanner Component — sgcHTML | eSeGeCe

CameraScanner

TsgcHTMLComponent_CameraScanner — a live camera panel that scans barcodes and QR codes with the browser's own native decoder, no third-party library, with photo capture and manual entry always available as a fallback, in Delphi, C++ Builder and .NET.

TsgcHTMLComponent_CameraScanner

Set Mode and Formats, then read the HTML property; the panel opens the camera, decodes with the browser's BarcodeDetector and posts the result under FieldName.

Component class

TsgcHTMLComponent_CameraScanner

Renders

Camera viewfinder panel + hidden fields + inline script

Languages

Delphi, C++ Builder, .NET

Point it at the browser's own scanner

No decoder to bundle and nothing pulled from a CDN: where BarcodeDetector is missing, the panel says so and keeps working through manual entry and photo capture.

uses
  sgcHTML_Component_CameraScanner;

var
  oScanner: TsgcHTMLComponent_CameraScanner;
begin
  oScanner := TsgcHTMLComponent_CameraScanner.Create(nil);
  try
    oScanner.ScannerID := 'receiving_scan';
    oScanner.Mode := smBoth;               // scan barcodes AND capture a photo
    oScanner.Formats := 'qr_code,ean_13,code_128';
    oScanner.FieldName := 'sku';
    oScanner.ContinuousScan := True;
    oScanner.BeepOnScan := True;

    WebModule.Response := oScanner.HTML;   // camera panel + hidden fields + inline script
  finally
    oScanner.Free;
  end;
end;
// includes: sgcHTML_Component_CameraScanner.hpp

TsgcHTMLComponent_CameraScanner *oScanner = new TsgcHTMLComponent_CameraScanner(NULL);
try
{
  oScanner->ScannerID = "receiving_scan";
  oScanner->Mode = smBoth;
  oScanner->Formats = "qr_code,ean_13,code_128";
  oScanner->FieldName = "sku";
  oScanner->ContinuousScan = true;
  oScanner->BeepOnScan = true;

  String html = oScanner->HTML;   // camera panel + hidden fields + inline script
}
__finally
{
  delete oScanner;
}
using esegece.sgcWebSockets;

var scanner = new TsgcHTMLComponent_CameraScanner();
scanner.ScannerID = "receiving_scan";
scanner.Mode = smBoth;
scanner.Formats = "qr_code,ean_13,code_128";
scanner.FieldName = "sku";
scanner.ContinuousScan = true;
scanner.BeepOnScan = true;

string html = scanner.HTML;   // camera panel + hidden fields + inline script

Key properties & methods

The members you reach for most often.

Mode

smBarcode, smPhoto or smBoth (default). smBarcode never renders the capture button; smPhoto skips the scan loop entirely.

Formats

Comma list of BarcodeDetector format strings, default qr_code,ean_13,code_128, escaped into the JS array handed to the browser's decoder.

FacingMode

sfEnvironment (default, rear camera) or sfUser (front camera).

ContinuousScan

True (default) keeps decoding after a hit; False auto-stops the camera on the first successful scan.

FieldName

Hidden field name the scanned value posts under; the captured photo posts under FieldName_photo as a JPEG data URL.

WSSend / Action

Push every scan over the sgcHTMX WebSocket bridge, or POST it to Action; either way a sgcCameraScanner:scan DOM event always fires.

Keep exploring

Online HelpFull API reference and usage guide for this component.
All sgcHTML ComponentsBrowse the full feature matrix of 80+ components.
Download Free TrialThe 30-day trial ships the 60.HTML demo projects.
PricingSingle, Team and Site licenses with full source code.
Best value: All-AccessEvery eSeGeCe product, Premium Support included, from €1,059/year.
See All-Access pricing

Ready to Get Started?

Download the free trial and start building web UIs in Delphi, C++ Builder and .NET.