• Settings
    • Locale
    • Change the locale of the datepicker, schedule and client side validation messages.

      Language
      English
      English
      English
      French
      German
      German
      German
      Italian
      Korean
      Spanish
      Catalan
      Dutch
      Portuguese
      Portuguese
      Arabic
      Arabic
      Bulgarian
      Bangla
      Bosnian
      Czech
      Greek
      Estonian
      Persian
      Finnish
      Danish
      Hindi
      Indonesian
      Icelandic
      Croatian
      Japanese
      Hungarian
      Hebrew
      Georgian
      Central Kurdish
      Khmer
      Kyrgyz
      Kazakh
      Lithuanian
      Latvian
      Malay
      Norwegian
      Polish
      Romanian
      Russian
      Slovak
      Slovenian
      Serbian
      Serbian
      Swedish
      Thai
      Turkish
      Ukrainian
      Uzbek
      Vietnamese
      Chinese
      Chinese
  • Resources

CodeScanner

CodeScanner is a multi-format 1D/2D barcode image scanner that scans bar and QR codes using a client side video input device. Based on ZXing for JS.

CodeScanner Tag Documentation

CodeScanner scans barcode and QR codes using the device camera.

NameTypeRequiredDefaultDescription
id String false generated Unique identifier of the component in a namingContainer.
rendered boolean false true Boolean value to specify the rendering of the component, when set to false component will not be rendered.
binding UIComponent false generated An EL expression referring to a server side UIComponent instance in a backing bean.
widgetVar String false generated ('widget_' + componentClientId) Name of the client side widget.
autoStart boolean false true Whether to start scanning automatically.
deviceId String false Camera device ID to use when multiple cameras are available.
for String false Search expression for the input component to write the scanned value to.
height Integer true Height of the video element in pixels.
onerror String false Client-side callback when scanning fails.
onsuccess String false Client-side callback when a code is successfully scanned.
style String false Inline style of the component.
styleClass String false Style class of the component.
type String false multi Reader type: 'multi', 'bar', or 'qr'.
video boolean false true Whether to show the video stream.
width Integer true Width of the video element in pixels.
Tag Documentation Widget Source
Basic Usage

Scan a bar or QR code with your camera. The scanned text is written to the input field (for) and the codeScanned event is sent to the server.

Requirements

Important: parts of the JavaScript of this component require https (or localhost). If the component is not working for you on a remote server, try running the showcase on localhost.

Usage


<div class="card">
    <h5>Basic Usage</h5>
    <p>Scan a bar or QR code with your camera. The scanned text is written to the input field (<code>for</code>) and the <i>codeScanned</i> event is sent to the server.</p>
    <h:form id="formBasicUsage">
        <p:growl id="growl" showDetail="true" showSummary="true" globalOnly="false"/>

        <p><p:inputText id="input" style="width:530px"/></p>
        <pe:codeScanner width="530"
                        height="400"
                        for="input">
            <p:ajax event="codeScanned" listener="#{codeScannerController.onCodeScanned}" update="growl"/>
        </pe:codeScanner>
    </h:form>
</div>