ByteScout Barcode Reader SDK - PHP - Read Barcode From Image - ByteScout

ByteScout Barcode Reader SDK – PHP – Read Barcode From Image

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Reader SDK – PHP – Read Barcode From Image

How to read barcode from image in PHP and ByteScout BarCode Reader SDK

The tutorial shows how to read barcode from image in PHP

We made thousands of pre-made source code pieces for easy implementation in your own programming projects. What is ByteScout BarCode Reader SDK? It is the barcode decoder with support for code 39, code 128, QR Code, Datamatrix, GS1, PDF417 and all other popular barcodes. Can read barcodes from images, pdf, tiff documents and live web camera. Supports noisy and damaged documents, can split and merge pdf and tiff documents based on barcodes. Can export barcode decoder results to XML, JSON, CSV and into custom data structures. It can help you to read barcode from image in your PHP application.

You will save a lot of time on writing and testing code as you may just take the PHP code from ByteScout BarCode Reader SDK for read barcode from image below and use it in your application. This PHP sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Use of ByteScout BarCode Reader SDK in PHP is also explained in the documentation included along with the product.

ByteScout BarCode Reader SDK free trial version is available on our website. PHP and other programming languages are supported.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

HelloWorld.php
      
<?php // this PHP script reads barcodes from image using BarCode Reader SDK /* IMPORTANT: to use COM objects in PHP need to enable it by adding the following line into php.ini: extension=php_com_dotnet.dll If you are usiung EasyPHP DevServer then to edit php.ini just right-click on the tray icon and select "Configuration"->"PHP" */ try { // create reader object $reader = new COM("Bytescout.BarCodeReader.Reader"); // Limit search to 1D barcodes only (exclude 2D barcodes to speed up the search). // Change to bc.BarcodeTypesToFind.SetAll() to scan for all supported 1D and 2D barcodes // or select specific type, e.g. bc.BarcodeTypesToFind.PDF417 = True $bc->BarcodeTypesToFind->SetAll1D(); $bc->ReadFromFile("BarcodePhoto.jpg"); For(i = 0; i< $bc->FoundCount-1; i++) { echo "Found barcode on page #" . $bc->GetFoundBarcodePage(i)) . " with type " . $bc->GetFoundBarcodeType(i) . " and value " & bc.GetFoundBarcodeValue(i) & vbCRLF & " and confidence=" . $bc->GetFoundBarcodeConfidence(i) } } catch(Exception $err) // catch exception if any { header("Content-Type: text/plain"); // switch to plain text output type echo($err->getMessage()); // write error message to the output } ?>

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next